-
Notifications
You must be signed in to change notification settings - Fork 2
[PLAT-8122] React19, Stencil4, & other framework tooling upgrades #763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 15 commits
8587feb
48b1ecb
3b17207
5850586
f824a25
e179ee1
9924829
a3f9a32
cfea7c6
45c10d2
3f6860e
8e4072c
afa7ca8
dd52889
a527d05
59f27b4
a21f413
8b0939b
14d94b3
81803f2
691e1af
1a7586c
56ba9c1
f7afa72
72c5511
712fa0b
c78e14b
a52ffd4
7bda5d3
46f1a5a
e29999f
e8313d3
2d301bf
867de4d
466bab6
55bb5ef
6cb4499
7e92766
b8c96b1
9e26ec1
b446dfa
d181168
2ae52f1
8bcc23b
3a394f9
525b825
76857ad
4235cf0
72d3efd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,113 @@ | ||
| import { config, input, output, typescript } from '@vertexvis/build-tools'; | ||
| import commonjs from '@rollup/plugin-commonjs'; | ||
| import { nodeResolve } from '@rollup/plugin-node-resolve'; | ||
| import fs from 'fs'; | ||
|
Check warning on line 3 in internal/build/rollup.config.js
|
||
| import { builtinModules } from 'module'; | ||
|
Check warning on line 4 in internal/build/rollup.config.js
|
||
| // TODO: update some TS stuff in build-tools so we can use that again here. | ||
|
Check warning on line 5 in internal/build/rollup.config.js
|
||
| // import { config, input, output, typescript } from '@vertexvis/build-tools'; | ||
| import path from 'path'; | ||
|
Check warning on line 7 in internal/build/rollup.config.js
|
||
| import ts from 'typescript'; | ||
|
|
||
| export default config( | ||
| input('src/index.ts'), | ||
| typescript(), | ||
| output({ enableInlineDynamicImports: true }) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The common build-tool config was abandoned for this package. This was somewhat a decision I inherited from the initial draft PR ( #729 ). I have tried to understand if I could update
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. think I figured this out, not how to test it, but should be ready to test |
||
| function loadTsConfig(tsconfigPath) { | ||
| const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile); | ||
| if (configFile.error != null) { | ||
| throw new Error( | ||
| ts.formatDiagnosticsWithColorAndContext([configFile.error], { | ||
| getCanonicalFileName: (fileName) => fileName, | ||
| getCurrentDirectory: () => process.cwd(), | ||
| getNewLine: () => '\n', | ||
| }) | ||
| ); | ||
| } | ||
|
|
||
| return ts.parseJsonConfigFileContent( | ||
| configFile.config, | ||
| ts.sys, | ||
| path.dirname(tsconfigPath), | ||
| undefined, | ||
| tsconfigPath | ||
| ); | ||
| } | ||
|
|
||
| function createTypeScriptPlugin() { | ||
| const parsedConfig = loadTsConfig( | ||
| path.resolve(process.cwd(), 'tsconfig.json') | ||
| ); | ||
| const transpileOptions = { | ||
| ...parsedConfig.options, | ||
| declaration: false, | ||
| declarationMap: false, | ||
| module: ts.ModuleKind.ESNext, | ||
| noEmit: false, | ||
| }; | ||
|
|
||
| return { | ||
| name: 'vertex-typescript', | ||
| transform(source, id) { | ||
| if (!/\.(ts|tsx)$/.test(id) || id.endsWith('.d.ts')) { | ||
| return null; | ||
| } | ||
|
|
||
| const transpiled = ts.transpileModule(source, { | ||
| compilerOptions: transpileOptions, | ||
| fileName: id, | ||
| reportDiagnostics: true, | ||
| }); | ||
|
|
||
| const errors = (transpiled.diagnostics ?? []).filter( | ||
| (diagnostic) => diagnostic.category === ts.DiagnosticCategory.Error | ||
| ); | ||
| if (errors.length > 0) { | ||
| this.error( | ||
| ts.formatDiagnosticsWithColorAndContext(errors, { | ||
| getCanonicalFileName: (fileName) => fileName, | ||
| getCurrentDirectory: () => process.cwd(), | ||
| getNewLine: () => '\n', | ||
| }) | ||
| ); | ||
| } | ||
|
|
||
| return { | ||
| code: transpiled.outputText, | ||
| map: | ||
| transpiled.sourceMapText != null | ||
| ? JSON.parse(transpiled.sourceMapText) | ||
| : null, | ||
| }; | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| const packageJson = JSON.parse( | ||
| fs.readFileSync(new URL('./package.json', import.meta.url), 'utf8') | ||
| ); | ||
| const builtins = builtinModules.flatMap((module) => [module, `node:${module}`]); | ||
|
|
||
| export default { | ||
| external: [ | ||
| ...builtins, | ||
| ...Object.keys(packageJson.dependencies ?? {}), | ||
| ...Object.keys(packageJson.peerDependencies ?? {}), | ||
| ], | ||
| input: 'src/index.ts', | ||
| output: [ | ||
| { | ||
| file: 'dist/bundle.cjs.js', | ||
| format: 'cjs', | ||
| sourcemap: true, | ||
| inlineDynamicImports: true, | ||
| }, | ||
| { | ||
| file: 'dist/bundle.esm.js', | ||
| format: 'esm', | ||
| sourcemap: true, | ||
| inlineDynamicImports: true, | ||
| }, | ||
| ], | ||
| plugins: [ | ||
| nodeResolve({ | ||
| extensions: ['.mjs', '.js', '.json', '.node', '.ts', '.tsx'], | ||
| }), | ||
| commonjs(), | ||
| createTypeScriptPlugin(), | ||
| ], | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.