babelfhir-ts 1.6.4 → 1.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -128,33 +128,41 @@ function resolveGeneratorTypeRoots() {
128
128
  }
129
129
  return [];
130
130
  }
131
+ /**
132
+ * The tsconfig generated output is compiled with.
133
+ *
134
+ * `types: []` is load-bearing and pairs with the emitters: generated code imports no node
135
+ * builtins, so naming a type package here is a promise to ship one. `['node']` was that promise,
136
+ * kept by writing an @types/node stub into the output; both go together or neither does.
137
+ */
138
+ export function buildOutputTsconfig() {
139
+ return {
140
+ compilerOptions: {
141
+ target: 'ES2020',
142
+ module: 'ESNext',
143
+ moduleResolution: 'Bundler',
144
+ declaration: true,
145
+ outDir: '.',
146
+ rootDir: '.',
147
+ skipLibCheck: true,
148
+ esModuleInterop: true,
149
+ allowSyntheticDefaultImports: true,
150
+ strict: true,
151
+ resolveJsonModule: true,
152
+ // Relative to the output dir; the generator's own @types is appended absolute so
153
+ // `@types/fhir` resolves even when the output's deps were skipped.
154
+ typeRoots: ['./node_modules/@types', ...resolveGeneratorTypeRoots()],
155
+ types: []
156
+ },
157
+ include: ['./**/*.ts'],
158
+ exclude: ['node_modules']
159
+ };
160
+ }
131
161
  /** Compile TypeScript files to JavaScript with declaration files */
132
162
  async function compileTypeScriptToJS(dir) {
133
163
  return new Promise((resolve, reject) => {
134
164
  const tscCmd = process.platform === 'win32' ? 'tsc.cmd' : 'tsc';
135
- // Create a temporary tsconfig.json for compilation
136
- // Paths are relative to tsconfig location (which is `dir` itself); the
137
- // generator's own @types (absolute) is appended so `@types/fhir` resolves
138
- // even when the output's deps were skipped (see resolveGeneratorTypeRoots).
139
- const tsconfig = {
140
- compilerOptions: {
141
- target: 'ES2020',
142
- module: 'ESNext',
143
- moduleResolution: 'Bundler',
144
- declaration: true,
145
- outDir: '.',
146
- rootDir: '.',
147
- skipLibCheck: true,
148
- esModuleInterop: true,
149
- allowSyntheticDefaultImports: true,
150
- strict: true,
151
- resolveJsonModule: true,
152
- typeRoots: ['./node_modules/@types', ...resolveGeneratorTypeRoots()],
153
- types: ['node']
154
- },
155
- include: ['./**/*.ts'],
156
- exclude: ['node_modules']
157
- };
165
+ const tsconfig = buildOutputTsconfig();
158
166
  const tsconfigPath = path.join(dir, 'tsconfig.temp.json');
159
167
  fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2));
160
168
  // shell required on Windows for .cmd wrappers; disabled on Unix to prevent injection
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babelfhir-ts",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "description": "BabelFHIR-TS: generate TypeScript interfaces, validators, and helper classes from FHIR R4/R4B/R5 StructureDefinitions (profiles) directly inside package archives.",
5
5
  "type": "module",
6
6
  "main": "out/src/main.js",