@checkdigit/typescript-config 11.0.0-PR.82-4b7f → 11.0.0-PR.82-fd65

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.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # checkdigit/typescript-config
2
2
 
3
- [![MIT License](https://img.shields.io/github/license/checkdigit/typescript-config)](https://github.com/checkdigit/typescript-config/blob/master/LICENSE.txt)
3
+ [![MIT License](https://img.shields.io/github/license/checkdigit/typescript-config)](https://github.com/checkdigit/typescript-config/blob/main/LICENSE.txt)
4
4
 
5
5
  Copyright © 2021–2026 [Check Digit, LLC](https://checkdigit.com)
6
6
 
@@ -10,35 +10,46 @@ This module contains the standard Check Digit TypeScript configuration, along wi
10
10
 
11
11
  ## TypeScript Configuration
12
12
 
13
- - currently supports Node 24 starting at 24.18.0, or Node 26 and above.
14
- - Node 25 is intentionally not part of the support contract.
15
- - emits `esnext`, with the default libraries, to avoid down-leveling. It is intended that application spec tests pick
16
- up any issues with using newer features unavailable in a particular environment. Browsers and Node.js are fast-moving
17
- targets, and can add language features at any time.
18
- - uses the `module` type of `esnext`.
19
- - all compiler options set for maximum strictness.
13
+ - Requires Node.js 26.13 or later and `@types/node` 26 or later.
14
+ - Targets `esnext`, with the default libraries. Application tests should check that the features used are available
15
+ in the deployment runtime.
16
+ - Uses `moduleResolution: "bundler"` and `verbatimModuleSyntax`.
17
+ - Enables `strict` mode and additional checks, including `noUncheckedIndexedAccess`, `exactOptionalPropertyTypes`,
18
+ and unused local and parameter checks.
19
+ - Enables `isolatedDeclarations`, `allowImportingTsExtensions`, and `erasableSyntaxOnly`.
20
+ - Sets `noEmit: true`; use `builder` to generate JavaScript and declarations.
20
21
 
21
22
  ## Builder
22
23
 
23
- `builder` is a command line tool that generates ESM modules from the TypeScript source.
24
- It is intended to be used when publishing a package to NPM, or to bundle a package for deployment.
25
- It uses `tsc` for generating types, and `esbuild` for generating code.
24
+ `builder` is a command line tool that generates ESM `.mjs` modules or TypeScript `.d.ts` declarations.
25
+ It is intended to be used when publishing a package to npm, or to bundle a package for deployment to Node.js.
26
+ It type-checks the source with the native TypeScript compiler before generating output, using the compiler's async API
27
+ for declarations and `esbuild` for JavaScript.
26
28
 
27
- **Note:** the `require` function will be defined as a global variable, to allow
28
- dynamic `require`s by CommonJS submodules. This is not a problem for Node.js, but will cause issues in a browser environment.
29
+ The compiler peer dependency is TypeScript `7.1.0`, installed under the `@typescript/native` npm alias.
30
+ This repository's lint tooling separately uses the TypeScript 6 compatibility package (`@typescript/typescript6`,
31
+ installed as `typescript`) for `typescript-eslint`.
32
+
33
+ The builder uses this package's compiler configuration directly; it does not read the consuming project's `tsconfig.json`.
34
+ Without an entry point, it processes all `.ts` files under the input directory recursively, including test files,
35
+ and rewrites relative TypeScript imports for the generated `.mjs` files.
36
+
37
+ Single-file bundles include Node.js compatibility bindings for `require`, `__filename`, and `__dirname` to support
38
+ bundled CommonJS dependencies. These bindings are local to the bundle, and the output is intended for Node.js.
39
+ Bundle builds also write `metafile.json` in the output directory and print a size summary.
29
40
 
30
41
  ### Options
31
42
 
32
- - `--type` the type of output to generate. Defaults to `module` (ESM). Valid values are `module` or `types`.
33
- - `--entryPoint` the entry point for the bundle, relative to the inDir. if not provided, the files in the inDir will
34
- be processed as individual unbundled files.
35
- - `--inDir` the input source code directory.
36
- - `--outDir` the output directory.
37
- - `--outFile` the output file, relative to `--outDir`. This is provided for single-file bundles, along with `--entryPoint`.
38
- - `--external` external modules to exclude from the bundle. Built-in `node` modules are automatically excluded.
39
- A wildcard `*` can be used to exclude multiple external modules.
40
- - `--minify` whether to minify the output.
41
- - `--sourceMap` whether to include inline sourcemap.
43
+ | Option | Short form | Description |
44
+ | -------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------- |
45
+ | `--type` | `-t` | Output type: `module` (ESM, the default) or `types` (declarations). |
46
+ | `--inDir` | `-i` | Input source directory, relative to the current directory. Defaults to `src`. |
47
+ | `--outDir` | `-o` | Output directory, relative to the current directory. Defaults to `build`. |
48
+ | `--entryPoint` | `-e` | Entry point relative to `--inDir`. For module output, enables a single-file bundle. Requires `--outFile`. |
49
+ | `--outFile` | `-f` | Bundle filename relative to `--outDir`. Requires `--entryPoint`. Does not combine declaration files. |
50
+ | `--external` | `-x` | Modules to exclude from a bundle. Repeat for multiple patterns; quote wildcard `*` patterns. Node.js built-ins are always external. |
51
+ | `--minify` | `-m` | Minify JavaScript output. Defaults to `false`. |
52
+ | `--sourceMap` | `-s` | Include inline JavaScript source maps. Defaults to `false`. |
42
53
 
43
54
  ### Examples
44
55
 
@@ -48,20 +59,25 @@ npx builder --type=module --outDir=build-esm
48
59
 
49
60
  # build single-file ESM .mjs bundle from TypeScript source
50
61
  npx builder --type=module --outDir=build-esm-bundle --entryPoint=index.ts --outFile=index.mjs
62
+
63
+ # generate declarations alongside the JavaScript build
64
+ npx builder --type=types --outDir=build-types
65
+
66
+ # bundle with source maps while leaving selected dependencies external
67
+ npx builder --entryPoint=index.ts --outFile=index.mjs --sourceMap --external='@example/*' --external=another-package
51
68
  ```
52
69
 
53
70
  ## Tests
54
71
 
55
- This module includes a number of integration-style tests,
56
- to ensure that a specific version of TypeScript will interoperate
57
- with `builder`, in addition to runtimes, libraries and frameworks used by Check Digit:
72
+ This module includes compiler, builder, and runtime tests to check interoperability with the tools and
73
+ language features used by Check Digit:
58
74
 
59
75
  - Recent TC39 proposals
60
- - Node versions supported by AWS Lambda, Google Cloud Functions, and Azure Functions
61
- - ESLint and `@typescript-eslint/eslint-plugin`
76
+ - Node.js APIs, with version-specific tests
77
+ - ESLint and `typescript-eslint`
62
78
  - Built-in `node:test` runner
63
79
  - `prettier`
64
- - `tsc`, and specific features introduced in each version of TypeScript
80
+ - The native TypeScript compiler, and features introduced in TypeScript 5.x, 6.0, and 7.1
65
81
  - `esbuild`
66
82
  - Wallaby.js (supports `node:test` by relying on native Node type-stripping support)
67
83
 
@@ -77,12 +93,10 @@ the new version of TypeScript, and/or without emitting warnings during these tes
77
93
 
78
94
  Strict semver is a little complicated, as TypeScript itself does not adhere to semver. So our "best effort" policy is:
79
95
 
80
- - Each update to the minimum Node target (e.g., Node 18 to Node 20), or a change to a major compiler output option
96
+ - Each update to the minimum supported Node.js version, or a change to a major compiler output option
81
97
  (e.g. `module`, `target` or `moduleResolution`) will result in a new major version of this module.
82
- We coordinate this with whatever the latest LTS version of Node is currently supported by Amazon Lambda,
83
- Google Cloud Functions, and Azure Functions.
84
- - Each new "major" version of TypeScript (e.g. `5.7.x` to `5.8.x`) will result in a new minor version of this module.
85
- - A new minor update of TypeScript (e.g. `5.7.2` to `5.7.3`) or a key dependency (e.g., Node `22.11` to Node `22.14`) _may_ result in a patch.
98
+ - Each new TypeScript feature release (e.g. `7.0.x` to `7.1.x`) will result in a new minor version of this module.
99
+ - A TypeScript patch release or a key dependency update _may_ result in a patch version of this module.
86
100
 
87
101
  Bear in mind, any update of TypeScript can potentially break your build. But hopefully in a way that's useful.
88
102
 
@@ -92,8 +106,8 @@ Bear in mind, any update of TypeScript can potentially break your build. But hop
92
106
  npm add -D @checkdigit/typescript-config
93
107
  ```
94
108
 
95
- Note: you do not need to explicitly install TypeScript itself, as the most recent supported version comes in as a
96
- peer dependency of `@checkdigit/typescript-config`.
109
+ The required compiler (`@typescript/native`), `@types/node`, and `esbuild` are peer dependencies, which npm installs
110
+ automatically by default. A separate `typescript` installation is not required to use the builder.
97
111
 
98
112
  Make sure your project's `tsconfig.json` extends `@checkdigit/typescript-config`.
99
113
 
@@ -105,9 +119,8 @@ Make sure your project's `tsconfig.json` extends `@checkdigit/typescript-config`
105
119
  }
106
120
  ```
107
121
 
108
- Note this configuration has `moduleResolution` set to `bundler`.
109
- This requires the use of the `builder` command
110
- to produce working code for deployment.
122
+ This configuration checks types without emitting files and uses `moduleResolution: "bundler"`.
123
+ Use `builder` to produce deployable Node.js code, or another build tool that handles these module resolution rules.
111
124
 
112
125
  ## License
113
126
 
package/bin/builder.mjs CHANGED
@@ -49,10 +49,9 @@ function analyze(metafile) {
49
49
  // src/compile.ts
50
50
  import { strict as assert2 } from "node:assert";
51
51
  import { promises as fs } from "node:fs";
52
- import module from "node:module";
53
52
  import path from "node:path";
54
53
  import { fileURLToPath } from "node:url";
55
- import typescript from "typescript";
54
+ import { API } from "@typescript/native/async";
56
55
  import { build } from "esbuild";
57
56
 
58
57
  // tsconfig.json
@@ -60,9 +59,6 @@ var tsconfig_default = {
60
59
  compilerOptions: {
61
60
  target: "esnext",
62
61
  moduleResolution: "bundler",
63
- paths: {
64
- "@js-temporal/polyfill": ["./src/types/js-temporal-polyfill.d.ts"]
65
- },
66
62
  sourceMap: true,
67
63
  inlineSources: true,
68
64
  declaration: true,
@@ -98,11 +94,10 @@ var tsconfig_default = {
98
94
 
99
95
  // src/compile.ts
100
96
  var commonJsCompatabilityBanner = `import { createRequire as __createRequire } from "node:module";
101
- import { fileURLToPath as __fileURLToPath } from "node:url";
102
- import { default as __path } from "node:path";
103
- const __filename = __fileURLToPath(import.meta.url);
104
- const __dirname = __path.dirname(__filename);
97
+ const __filename = import.meta.filename;
105
98
  const require = __createRequire(import.meta.url);`;
99
+ var dirNameJsCompatibilityInjection = `export const __dirname = import.meta.dirname;`;
100
+ var dirNameJsCompatibilityInjectionURL = `data:text/javascript,${encodeURIComponent(dirNameJsCompatibilityInjection)}`;
106
101
  async function getFiles(directory) {
107
102
  const entries = await fs.readdir(directory, { withFileTypes: true });
108
103
  const files = await Promise.all(
@@ -113,6 +108,14 @@ async function getFiles(directory) {
113
108
  );
114
109
  return files.flat();
115
110
  }
111
+ function flattenDiagnosticMessage(diagnostic, indent = 0) {
112
+ return [
113
+ `${" ".repeat(indent)}${diagnostic.text}`,
114
+ ...(diagnostic.messageChain ?? []).map(
115
+ (child) => flattenDiagnosticMessage(child, indent + 1)
116
+ )
117
+ ].join("\n");
118
+ }
116
119
  function excludeSourceMaps(filter) {
117
120
  return (pluginBuild) => {
118
121
  pluginBuild.onLoad({ filter }, async (args) => {
@@ -153,38 +156,6 @@ function resolveTypescriptPaths() {
153
156
  });
154
157
  };
155
158
  }
156
- function getTemporalPolyfillModulePath({
157
- exports
158
- }) {
159
- return exports?.["."]?.find((entry) => entry.import?.default !== void 0)?.import?.default;
160
- }
161
- function resolveRuntimeTemporalPolyfill(external2) {
162
- return (pluginBuild) => {
163
- pluginBuild.onResolve(
164
- // Note: the /u flag cannot be used here because the underlying Go implementation does not support it
165
- // eslint-disable-next-line require-unicode-regexp
166
- { filter: /^@js-temporal\/polyfill$/ },
167
- async (resolved) => {
168
- const packageJsonPath = module.findPackageJSON(
169
- resolved.path,
170
- resolved.resolveDir
171
- );
172
- assert2.ok(packageJsonPath !== void 0);
173
- if (external2.includes("./node_modules/*")) {
174
- return { path: resolved.path, external: true };
175
- }
176
- const packageJson = JSON.parse(
177
- await fs.readFile(packageJsonPath, "utf8")
178
- );
179
- const modulePath = getTemporalPolyfillModulePath(packageJson);
180
- assert2.ok(modulePath !== void 0);
181
- return {
182
- path: path.join(path.dirname(packageJsonPath), modulePath)
183
- };
184
- }
185
- );
186
- };
187
- }
188
159
  async function compile_default({
189
160
  type: type2,
190
161
  entryPoint: entryPoint2,
@@ -203,56 +174,55 @@ async function compile_default({
203
174
  );
204
175
  const allSourceFiles = await getFiles(inDir2);
205
176
  const productionSourceFiles = entryPoint2 === void 0 ? allSourceFiles.filter((file) => file.endsWith(".ts")) : [path.join(inDir2, entryPoint2)];
206
- const compilerOptions = typescript.parseJsonConfigFileContent(
207
- tsconfig_default,
208
- typescript.sys,
177
+ await using api = new API();
178
+ const compilerOptions = (await api.parseJsonConfigFileContent(tsconfig_default, {
209
179
  // @checkdigit/typescript-config package root:
210
- path.dirname(path.dirname(fileURLToPath(import.meta.url)))
211
- ).options;
212
- const program = typescript.createProgram(productionSourceFiles, {
180
+ configDirectory: path.dirname(
181
+ path.dirname(fileURLToPath(import.meta.url))
182
+ )
183
+ })).options;
184
+ await using program = await api.createProgram(productionSourceFiles, {
213
185
  ...compilerOptions,
214
186
  noEmit: type2 !== "types",
215
187
  emitDeclarationOnly: type2 === "types",
216
188
  rootDir: inDir2,
217
189
  outDir: outDir2
218
190
  });
219
- const declarationFiles = [];
220
- const emitResult = program.emit(void 0, (fileName, data) => {
221
- declarationFiles.push({ path: fileName, text: data });
222
- });
223
- const allDiagnostics = typescript.sortAndDeduplicateDiagnostics([
224
- ...typescript.getPreEmitDiagnostics(program),
191
+ const emitResult = await program.emitToString();
192
+ const allDiagnostics = [
193
+ ...(await Promise.all([
194
+ program.getGlobalDiagnostics(),
195
+ program.getProgramDiagnostics(),
196
+ program.getSyntacticDiagnostics(),
197
+ program.getSemanticDiagnostics(),
198
+ program.getDeclarationDiagnostics()
199
+ ])).flat(),
225
200
  ...emitResult.diagnostics
226
- ]);
201
+ ];
227
202
  for (const diagnostic of allDiagnostics) {
228
- if (diagnostic.file) {
229
- assert2.ok(diagnostic.start !== void 0);
230
- const { line, character } = typescript.getLineAndCharacterOfPosition(
231
- diagnostic.file,
232
- diagnostic.start
233
- );
234
- const message = typescript.flattenDiagnosticMessageText(
235
- diagnostic.messageText,
236
- "\n"
237
- );
238
- messages.push(
239
- `tsc: ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`
240
- );
203
+ const message = flattenDiagnosticMessage(diagnostic);
204
+ if (diagnostic.fileName === void 0) {
205
+ messages.push(`tsc: ${message}`);
241
206
  } else {
207
+ assert2.ok(diagnostic.startPosition !== void 0);
208
+ const { line, character } = diagnostic.startPosition;
242
209
  messages.push(
243
- `tsc: ${typescript.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`
210
+ `tsc: ${diagnostic.fileName} (${line + 1},${character + 1}): ${message}`
244
211
  );
245
212
  }
246
213
  }
247
214
  if (messages.length > 0) {
248
- throw new Error(`tsc failed ${JSON.stringify(messages)}`);
215
+ throw new Error(`tsc failed ${JSON.stringify([...new Set(messages)])}`);
249
216
  }
250
217
  if (type2 === "types") {
251
218
  return {
252
- outputFiles: declarationFiles
219
+ outputFiles: [...emitResult.outputFiles].map(([filePath, file]) => ({
220
+ path: filePath,
221
+ text: file.text
222
+ }))
253
223
  };
254
224
  }
255
- const buildResult = await build({
225
+ return await build({
256
226
  entryPoints: productionSourceFiles,
257
227
  bundle: true,
258
228
  minify: minify2,
@@ -264,6 +234,7 @@ async function compile_default({
264
234
  metafile: outFile2 !== void 0,
265
235
  sourcesContent: false,
266
236
  logLevel: "error",
237
+ inject: outFile2 === void 0 ? [] : [dirNameJsCompatibilityInjectionURL],
267
238
  banner: outFile2 === void 0 ? {} : {
268
239
  js: commonJsCompatabilityBanner
269
240
  },
@@ -284,10 +255,6 @@ async function compile_default({
284
255
  legalComments: "none",
285
256
  external: external2,
286
257
  plugins: [
287
- {
288
- name: "resolve-runtime-temporal-polyfill",
289
- setup: resolveRuntimeTemporalPolyfill(external2)
290
- },
291
258
  {
292
259
  name: "exclude-source-maps",
293
260
  // Note: the /u flag cannot be used here because the underlying Go implementation does not support it
@@ -297,13 +264,6 @@ async function compile_default({
297
264
  ]
298
265
  }
299
266
  });
300
- messages.push(
301
- ...buildResult.errors.map((error) => `esbuild error: ${error.text}`)
302
- );
303
- if (messages.length > 0) {
304
- throw new Error(`esbuild failed ${JSON.stringify(messages)}`);
305
- }
306
- return buildResult;
307
267
  }
308
268
 
309
269
  // src/builder.ts
@@ -1,18 +1,16 @@
1
1
  // src/compile.ts
2
2
  import { strict as assert } from "node:assert";
3
3
  import { promises as fs } from "node:fs";
4
- import module from "node:module";
5
4
  import path from "node:path";
6
5
  import { fileURLToPath } from "node:url";
7
- import typescript from "typescript";
6
+ import { API } from "@typescript/native/async";
8
7
  import { build } from "esbuild";
9
8
  import tsConfigJson from "../tsconfig.json" with { type: "json" };
10
9
  var commonJsCompatabilityBanner = `import { createRequire as __createRequire } from "node:module";
11
- import { fileURLToPath as __fileURLToPath } from "node:url";
12
- import { default as __path } from "node:path";
13
- const __filename = __fileURLToPath(import.meta.url);
14
- const __dirname = __path.dirname(__filename);
10
+ const __filename = import.meta.filename;
15
11
  const require = __createRequire(import.meta.url);`;
12
+ var dirNameJsCompatibilityInjection = `export const __dirname = import.meta.dirname;`;
13
+ var dirNameJsCompatibilityInjectionURL = `data:text/javascript,${encodeURIComponent(dirNameJsCompatibilityInjection)}`;
16
14
  async function getFiles(directory) {
17
15
  const entries = await fs.readdir(directory, { withFileTypes: true });
18
16
  const files = await Promise.all(
@@ -23,6 +21,14 @@ async function getFiles(directory) {
23
21
  );
24
22
  return files.flat();
25
23
  }
24
+ function flattenDiagnosticMessage(diagnostic, indent = 0) {
25
+ return [
26
+ `${" ".repeat(indent)}${diagnostic.text}`,
27
+ ...(diagnostic.messageChain ?? []).map(
28
+ (child) => flattenDiagnosticMessage(child, indent + 1)
29
+ )
30
+ ].join("\n");
31
+ }
26
32
  function excludeSourceMaps(filter) {
27
33
  return (pluginBuild) => {
28
34
  pluginBuild.onLoad({ filter }, async (args) => {
@@ -63,38 +69,6 @@ function resolveTypescriptPaths() {
63
69
  });
64
70
  };
65
71
  }
66
- function getTemporalPolyfillModulePath({
67
- exports
68
- }) {
69
- return exports?.["."]?.find((entry) => entry.import?.default !== void 0)?.import?.default;
70
- }
71
- function resolveRuntimeTemporalPolyfill(external) {
72
- return (pluginBuild) => {
73
- pluginBuild.onResolve(
74
- // Note: the /u flag cannot be used here because the underlying Go implementation does not support it
75
- // eslint-disable-next-line require-unicode-regexp
76
- { filter: /^@js-temporal\/polyfill$/ },
77
- async (resolved) => {
78
- const packageJsonPath = module.findPackageJSON(
79
- resolved.path,
80
- resolved.resolveDir
81
- );
82
- assert.ok(packageJsonPath !== void 0);
83
- if (external.includes("./node_modules/*")) {
84
- return { path: resolved.path, external: true };
85
- }
86
- const packageJson = JSON.parse(
87
- await fs.readFile(packageJsonPath, "utf8")
88
- );
89
- const modulePath = getTemporalPolyfillModulePath(packageJson);
90
- assert.ok(modulePath !== void 0);
91
- return {
92
- path: path.join(path.dirname(packageJsonPath), modulePath)
93
- };
94
- }
95
- );
96
- };
97
- }
98
72
  async function compile_default({
99
73
  type,
100
74
  entryPoint,
@@ -113,56 +87,55 @@ async function compile_default({
113
87
  );
114
88
  const allSourceFiles = await getFiles(inDir);
115
89
  const productionSourceFiles = entryPoint === void 0 ? allSourceFiles.filter((file) => file.endsWith(".ts")) : [path.join(inDir, entryPoint)];
116
- const compilerOptions = typescript.parseJsonConfigFileContent(
117
- tsConfigJson,
118
- typescript.sys,
90
+ await using api = new API();
91
+ const compilerOptions = (await api.parseJsonConfigFileContent(tsConfigJson, {
119
92
  // @checkdigit/typescript-config package root:
120
- path.dirname(path.dirname(fileURLToPath(import.meta.url)))
121
- ).options;
122
- const program = typescript.createProgram(productionSourceFiles, {
93
+ configDirectory: path.dirname(
94
+ path.dirname(fileURLToPath(import.meta.url))
95
+ )
96
+ })).options;
97
+ await using program = await api.createProgram(productionSourceFiles, {
123
98
  ...compilerOptions,
124
99
  noEmit: type !== "types",
125
100
  emitDeclarationOnly: type === "types",
126
101
  rootDir: inDir,
127
102
  outDir
128
103
  });
129
- const declarationFiles = [];
130
- const emitResult = program.emit(void 0, (fileName, data) => {
131
- declarationFiles.push({ path: fileName, text: data });
132
- });
133
- const allDiagnostics = typescript.sortAndDeduplicateDiagnostics([
134
- ...typescript.getPreEmitDiagnostics(program),
104
+ const emitResult = await program.emitToString();
105
+ const allDiagnostics = [
106
+ ...(await Promise.all([
107
+ program.getGlobalDiagnostics(),
108
+ program.getProgramDiagnostics(),
109
+ program.getSyntacticDiagnostics(),
110
+ program.getSemanticDiagnostics(),
111
+ program.getDeclarationDiagnostics()
112
+ ])).flat(),
135
113
  ...emitResult.diagnostics
136
- ]);
114
+ ];
137
115
  for (const diagnostic of allDiagnostics) {
138
- if (diagnostic.file) {
139
- assert.ok(diagnostic.start !== void 0);
140
- const { line, character } = typescript.getLineAndCharacterOfPosition(
141
- diagnostic.file,
142
- diagnostic.start
143
- );
144
- const message = typescript.flattenDiagnosticMessageText(
145
- diagnostic.messageText,
146
- "\n"
147
- );
148
- messages.push(
149
- `tsc: ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`
150
- );
116
+ const message = flattenDiagnosticMessage(diagnostic);
117
+ if (diagnostic.fileName === void 0) {
118
+ messages.push(`tsc: ${message}`);
151
119
  } else {
120
+ assert.ok(diagnostic.startPosition !== void 0);
121
+ const { line, character } = diagnostic.startPosition;
152
122
  messages.push(
153
- `tsc: ${typescript.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`
123
+ `tsc: ${diagnostic.fileName} (${line + 1},${character + 1}): ${message}`
154
124
  );
155
125
  }
156
126
  }
157
127
  if (messages.length > 0) {
158
- throw new Error(`tsc failed ${JSON.stringify(messages)}`);
128
+ throw new Error(`tsc failed ${JSON.stringify([...new Set(messages)])}`);
159
129
  }
160
130
  if (type === "types") {
161
131
  return {
162
- outputFiles: declarationFiles
132
+ outputFiles: [...emitResult.outputFiles].map(([filePath, file]) => ({
133
+ path: filePath,
134
+ text: file.text
135
+ }))
163
136
  };
164
137
  }
165
- const buildResult = await build({
138
+ return await build({
166
139
  entryPoints: productionSourceFiles,
167
140
  bundle: true,
168
141
  minify,
@@ -174,6 +147,7 @@ async function compile_default({
174
147
  metafile: outFile !== void 0,
175
148
  sourcesContent: false,
176
149
  logLevel: "error",
150
+ inject: outFile === void 0 ? [] : [dirNameJsCompatibilityInjectionURL],
177
151
  banner: outFile === void 0 ? {} : {
178
152
  js: commonJsCompatabilityBanner
179
153
  },
@@ -194,10 +168,6 @@ async function compile_default({
194
168
  legalComments: "none",
195
169
  external,
196
170
  plugins: [
197
- {
198
- name: "resolve-runtime-temporal-polyfill",
199
- setup: resolveRuntimeTemporalPolyfill(external)
200
- },
201
171
  {
202
172
  name: "exclude-source-maps",
203
173
  // Note: the /u flag cannot be used here because the underlying Go implementation does not support it
@@ -207,15 +177,8 @@ async function compile_default({
207
177
  ]
208
178
  }
209
179
  });
210
- messages.push(
211
- ...buildResult.errors.map((error) => `esbuild error: ${error.text}`)
212
- );
213
- if (messages.length > 0) {
214
- throw new Error(`esbuild failed ${JSON.stringify(messages)}`);
215
- }
216
- return buildResult;
217
180
  }
218
181
  export {
219
182
  compile_default as default
220
183
  };
221
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL2NvbXBpbGUudHMiXSwKICAibWFwcGluZ3MiOiAiO0FBRUEsU0FBUyxVQUFVLGNBQWM7QUFDakMsU0FBUyxZQUFZLFVBQVU7QUFDL0IsT0FBTyxZQUFZO0FBQ25CLE9BQU8sVUFBVTtBQUNqQixTQUFTLHFCQUFxQjtBQUU5QixPQUFPLGdCQUFnQjtBQUN2QixTQUFTLGFBQStCO0FBRXhDLE9BQU8sa0JBQWtCLG1CQUFtQixLQUFLLEVBQUUsTUFBTSxPQUFPO0FBRWhFLElBQU0sOEJBQThCO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQW9IcEMsZUFBZSxTQUFTLFdBQXNDO0FBQzVELFFBQU0sVUFBVSxNQUFNLEdBQUcsUUFBUSxXQUFXLEVBQUUsZUFBZSxLQUFLLENBQUM7QUFDbkUsUUFBTSxRQUFRLE1BQU0sUUFBUTtBQUFBLElBQzFCLFFBQVEsSUFBSSxPQUFPLFVBQVU7QUFDM0IsWUFBTSxTQUFTLEtBQUssUUFBUSxXQUFXLE1BQU0sSUFBSTtBQUNqRCxhQUFPLE1BQU0sWUFBWSxJQUFJLE1BQU0sU0FBUyxNQUFNLElBQUk7QUFBQSxJQUN4RCxDQUFDO0FBQUEsRUFDSDtBQUNBLFNBQU8sTUFBTSxLQUFLO0FBQ3BCO0FBRUEsU0FBUyxrQkFBa0IsUUFBZ0I7QUFDekMsU0FBTyxDQUFDLGdCQUE2QjtBQUVuQyxnQkFBWSxPQUFPLEVBQUUsT0FBTyxHQUFHLE9BQU8sU0FBUztBQUM3QyxVQUFJLEtBQUssS0FBSyxTQUFTLEtBQUssS0FBSyxLQUFLLEtBQUssU0FBUyxNQUFNLEdBQUc7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escript configuration","homepage":"https://github.com/checkdigit/typescript-config#readme","bugs":{"url":"https://github.com/checkdigit/typescript-config/issues"},"repository":{"type":"git","url":"git+https://github.com/checkdigit/typescript-config.git"},"license":"MIT","author":"Check Digit, LLC","type":"module","exports":{".":{"types":"./dist-types/index.d.ts","import":"./dist-mjs/index.mjs","default":"./tsconfig.json"}},"bin":{"builder":"./bin/builder.mjs","tsc":"./node_modules/.bin/tscgo"},"files":["bin","tsconfig.json","src","dist-types","dist-mjs","!src/**/test/**","!src/**/*.test.ts","!src/**/*.spec.ts","!dist-types/**/test/**","!dist-types/**/*.test.d.ts","!dist-types/**/*.spec.d.ts","!dist-mjs/**/test/**","!dist-mjs/**/*.test.mjs","!dist-mjs/**/*.spec.mjs","SECURITY.md"],"scripts":{"build":"npm run build:builder && npm run build:types && npm run build:mjs && npm run build:mjs-bundle && npm run build:mjs-bundle-minify && npm run build:mjs-bundle-no-external","build:builder":"esbuild src/builder.ts --bundle --platform=node --format=esm --external:typescript --external:esbuild --outfile=build-builder/builder.mjs && mkdir -p bin && { echo '#!/usr/bin/env node'; cat build-builder/builder.mjs; } > bin/builder.mjs && chmod +x bin/builder.mjs","build:dist-mjs":"node -e \"require('node:fs').rmSync('dist-mjs', { recursive: true, force: true })\" && npx builder --type=module --sourceMap --outDir=dist-mjs && node dist-mjs/index.mjs","build:dist-types":"node -e \"require('node:fs').rmSync('dist-types', { recursive: true, force: true })\" && npx builder --type=types --outDir=dist-types","build:mjs":"node -e \"require('node:fs').rmSync('build-mjs', { recursive: true, force: true })\" && bin/builder.mjs --type=module --outDir=build-mjs","build:mjs-bundle":"node -e \"require('node:fs').rmSync('build-mjs-bundle', { recursive: true, force: true })\" && bin/builder.mjs --type=module --outDir=build-mjs-bundle --entryPoint=index.test.ts --outFile=index.test.mjs","build:mjs-bundle-minify":"node -e \"require('node:fs').rmSync('build-mjs-bundle-minify', { recursive: true, force: true })\" && bin/builder.mjs --type=module --minify --outDir=build-mjs-bundle-minify --entryPoint=index.test.ts --outFile=index.test.mjs","build:mjs-bundle-no-external":"node -e \"require('node:fs').rmSync('build-mjs-bundle-no-external', { recursive: true, force: true })\" && bin/builder.mjs --type=module --external=./node_modules/* --outDir=build-mjs-bundle-no-external --entryPoint=index.test.ts --outFile=index.test.mjs --minify","build:types":"node -e \"require('node:fs').rmSync('build-types', { recursive: true, force: true })\" && bin/builder.mjs --type=types --outDir=build-types","ci:compile":"time tsgo && time tsc","ci:lint":"npm run lint","ci:style":"npm run prettier","ci:test":"npm run build && npm run test:node && npm run test:mjs && npm run test:mjs-bundle && npm run test:mjs-bundle-no-external","lint":"eslint . --max-warnings=0 --concurrency=auto --flag unstable_native_nodejs_ts_config","lint:fix":"eslint . --fix --concurrency=auto --flag unstable_native_nodejs_ts_config","prepare":"","prepublishOnly":"npm run build:builder && npm run build:dist-types && npm run build:dist-mjs","prettier":"prettier . --check","prettier:fix":"prettier . --write","test":"npm run ci:compile && npm run ci:test && npm run ci:lint && npm run ci:style","test:mjs":"node --test build-mjs/test/index.mjs","test:mjs-bundle":"node --test build-mjs-bundle/index.test.mjs","test:mjs-bundle-minify":"node --test build-mjs-bundle-minify/index.test.mjs","test:mjs-bundle-no-external":"node --test build-mjs-bundle-no-external/index.test.mjs","test:node":"node --disable-warning ExperimentalWarning --experimental-strip-types --test-timeout 600000 --test \"src/**/*.spec.ts\""},"prettier":"@checkdigit/prettier-config","devDependencies":{"@checkdigit/prettier-config":"^8.1.1","@eslint/js":"^10.0.1","@eslint/json":"^2.0.1","@eslint/markdown":"^8.0.3","@js-temporal/polyfill":"^0.5.1","eslint":"^10.8.0","eslint-config-prettier":"^10.1.8","eslint-plugin-yml":"^3.6.0","typescript-eslint":"^8.65.0"},"peerDependencies":{"@types/node":">=24","@typescript/native-preview":"7.0.0-dev.20260707.2","esbuild":"0.28.1","typescript":">=6.0.3 <7"},"engines":{"node":">=24.18.0 <25 || >=26"}}
1
+ {"name":"@checkdigit/typescript-config","version":"11.0.0-PR.82-fd65","description":"Check Digit standard Typescript configuration","homepage":"https://github.com/checkdigit/typescript-config#readme","bugs":{"url":"https://github.com/checkdigit/typescript-config/issues"},"repository":{"type":"git","url":"git+https://github.com/checkdigit/typescript-config.git"},"license":"MIT","author":"Check Digit, LLC","type":"module","exports":{".":{"types":"./dist-types/index.d.ts","import":"./dist-mjs/index.mjs","default":"./tsconfig.json"}},"bin":{"builder":"./bin/builder.mjs"},"files":["bin","tsconfig.json","src","dist-types","dist-mjs","!src/**/test/**","!src/**/*.test.ts","!src/**/*.spec.ts","!dist-types/**/test/**","!dist-types/**/*.test.d.ts","!dist-types/**/*.spec.d.ts","!dist-mjs/**/test/**","!dist-mjs/**/*.test.mjs","!dist-mjs/**/*.spec.mjs","SECURITY.md"],"scripts":{"build":"npm run build:builder && npm run build:types && npm run build:mjs && npm run build:mjs-bundle && npm run build:mjs-bundle-minify && npm run build:mjs-bundle-no-external","build:builder":"esbuild src/builder.ts --bundle --platform=node --format=esm --external:@typescript/native --external:esbuild --outfile=build-builder/builder.mjs && mkdir -p bin && { echo '#!/usr/bin/env node'; cat build-builder/builder.mjs; } > bin/builder.mjs && chmod +x bin/builder.mjs","build:dist-mjs":"node -e \"require('node:fs').rmSync('dist-mjs', { recursive: true, force: true })\" && npx builder --type=module --sourceMap --outDir=dist-mjs && node dist-mjs/index.mjs","build:dist-types":"node -e \"require('node:fs').rmSync('dist-types', { recursive: true, force: true })\" && npx builder --type=types --outDir=dist-types","build:mjs":"node -e \"require('node:fs').rmSync('build-mjs', { recursive: true, force: true })\" && bin/builder.mjs --type=module --outDir=build-mjs","build:mjs-bundle":"node -e \"require('node:fs').rmSync('build-mjs-bundle', { recursive: true, force: true })\" && bin/builder.mjs --type=module --outDir=build-mjs-bundle --entryPoint=index.test.ts --outFile=index.test.mjs","build:mjs-bundle-minify":"node -e \"require('node:fs').rmSync('build-mjs-bundle-minify', { recursive: true, force: true })\" && bin/builder.mjs --type=module --minify --outDir=build-mjs-bundle-minify --entryPoint=index.test.ts --outFile=index.test.mjs","build:mjs-bundle-no-external":"node -e \"require('node:fs').rmSync('build-mjs-bundle-no-external', { recursive: true, force: true })\" && bin/builder.mjs --type=module --external=./node_modules/* --outDir=build-mjs-bundle-no-external --entryPoint=index.test.ts --outFile=index.test.mjs --minify","build:types":"node -e \"require('node:fs').rmSync('build-types', { recursive: true, force: true })\" && bin/builder.mjs --type=types --outDir=build-types","ci:compile":"tsc","ci:coverage":"node -e \"process.argv.slice(1).forEach((path) => require('node:fs').rmSync(path, { recursive: true, force: true }))\" -- coverage && mkdir coverage && node --test-timeout 600000 --experimental-test-coverage --test-coverage-include-all --test-coverage-include=\"src/**/*.ts\" --test-coverage-exclude=\"src/test/**\" --test-coverage-exclude=\"src/**/*.test.ts\" --test-coverage-exclude=\"src/**/*.spec.ts\" --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test \"src/**/*.spec.ts\"","ci:lint":"npm run lint","ci:style":"npm run prettier","ci:test":"npm run build && npm run test:node && npm run test:mjs && npm run test:mjs-bundle && npm run test:mjs-bundle-no-external","coverage":"node --test-timeout 600000 --experimental-test-coverage --test-coverage-include-all --test-coverage-include=\"src/**/*.ts\" --test-coverage-exclude=\"src/test/**\" --test-coverage-exclude=\"src/**/*.test.ts\" --test-coverage-exclude=\"src/**/*.spec.ts\" --test \"src/**/*.spec.ts\"","lint":"eslint . --max-warnings=0 --concurrency=auto --flag unstable_native_nodejs_ts_config","lint:fix":"eslint . --fix --concurrency=auto --flag unstable_native_nodejs_ts_config","prepublishOnly":"npm run build:builder && npm run build:dist-types && npm run build:dist-mjs","prettier":"prettier . --check","prettier:fix":"prettier . --write","test":"npm run ci:compile && npm run ci:test && npm run ci:lint && npm run ci:style","test:mjs":"node --throw-deprecation --pending-deprecation --test build-mjs/test/index.mjs","test:mjs-bundle":"node --throw-deprecation --pending-deprecation --test build-mjs-bundle/index.test.mjs","test:mjs-bundle-minify":"node --throw-deprecation --pending-deprecation --test build-mjs-bundle-minify/index.test.mjs","test:mjs-bundle-no-external":"node --throw-deprecation --pending-deprecation --test build-mjs-bundle-no-external/index.test.mjs","test:node":"node --throw-deprecation --pending-deprecation --test-timeout 600000 --test \"src/**/*.spec.ts\""},"prettier":"@checkdigit/prettier-config","devDependencies":{"@checkdigit/prettier-config":"^8.3.0","@eslint/js":"^10.0.1","@eslint/json":"^2.1.1","@eslint/markdown":"^8.0.3","eslint":"^10.14.0","eslint-config-prettier":"^10.1.8","eslint-plugin-yml":"^3.10.0","typescript":"npm:@typescript/typescript6@^6.0.2","typescript-eslint":"^8.72.2"},"peerDependencies":{"@types/node":">=26","@typescript/native":"npm:typescript@7.1.0-beta","esbuild":"0.28.2"},"engines":{"node":">=26.13"}}
package/src/compile.ts CHANGED
@@ -2,22 +2,21 @@
2
2
 
3
3
  import { strict as assert } from 'node:assert';
4
4
  import { promises as fs } from 'node:fs';
5
- import module from 'node:module';
6
5
  import path from 'node:path';
7
6
  import { fileURLToPath } from 'node:url';
8
7
 
9
- import typescript from 'typescript';
8
+ import { API, type Diagnostic } from '@typescript/native/async';
10
9
  import { build, type PluginBuild } from 'esbuild';
11
10
 
12
11
  import tsConfigJson from '../tsconfig.json' with { type: 'json' };
13
12
 
14
13
  const commonJsCompatabilityBanner = `import { createRequire as __createRequire } from "node:module";
15
- import { fileURLToPath as __fileURLToPath } from "node:url";
16
- import { default as __path } from "node:path";
17
- const __filename = __fileURLToPath(import.meta.url);
18
- const __dirname = __path.dirname(__filename);
14
+ const __filename = import.meta.filename;
19
15
  const require = __createRequire(import.meta.url);`;
20
16
 
17
+ const dirNameJsCompatibilityInjection = `export const __dirname = import.meta.dirname;`;
18
+ const dirNameJsCompatibilityInjectionURL = `data:text/javascript,${encodeURIComponent(dirNameJsCompatibilityInjection)}`;
19
+
21
20
  export type ImportKind =
22
21
  | 'entry-point'
23
22
  | 'import-statement'
@@ -124,8 +123,6 @@ export interface CompileOptions {
124
123
 
125
124
  /**
126
125
  * Recursively obtains all files in a directory
127
- * @param {string} directory
128
- * @returns {Promise<string[]>}
129
126
  */
130
127
  async function getFiles(directory: string): Promise<string[]> {
131
128
  const entries = await fs.readdir(directory, { withFileTypes: true });
@@ -138,9 +135,18 @@ async function getFiles(directory: string): Promise<string[]> {
138
135
  return files.flat();
139
136
  }
140
137
 
138
+ function flattenDiagnosticMessage(diagnostic: Diagnostic, indent = 0): string {
139
+ return [
140
+ `${' '.repeat(indent)}${diagnostic.text}`,
141
+ ...(diagnostic.messageChain ?? []).map((child) =>
142
+ flattenDiagnosticMessage(child, indent + 1),
143
+ ),
144
+ ].join('\n');
145
+ }
146
+
141
147
  function excludeSourceMaps(filter: RegExp) {
142
148
  return (pluginBuild: PluginBuild) => {
143
- // ignore source maps for any Javascript file that matches filter
149
+ // ignore source maps for any JavaScript file that matches filter
144
150
  pluginBuild.onLoad({ filter }, async (args) => {
145
151
  if (args.path.endsWith('.js') || args.path.endsWith('.mjs')) {
146
152
  return {
@@ -190,57 +196,6 @@ function resolveTypescriptPaths() {
190
196
  };
191
197
  }
192
198
 
193
- /**
194
- * The Temporal polyfill handling can be removed once Node 26 becomes minimum version
195
- */
196
- interface TemporalPolyfillPackageJson {
197
- exports?: {
198
- '.'?: {
199
- import?: {
200
- default?: string;
201
- };
202
- }[];
203
- };
204
- }
205
-
206
- function getTemporalPolyfillModulePath({
207
- exports,
208
- }: TemporalPolyfillPackageJson): string | undefined {
209
- return exports?.['.']?.find((entry) => entry.import?.default !== undefined)
210
- ?.import?.default;
211
- }
212
-
213
- function resolveRuntimeTemporalPolyfill(external: string[]) {
214
- return (pluginBuild: PluginBuild) => {
215
- pluginBuild.onResolve(
216
- // Note: the /u flag cannot be used here because the underlying Go implementation does not support it
217
- // eslint-disable-next-line require-unicode-regexp
218
- { filter: /^@js-temporal\/polyfill$/ },
219
- async (resolved) => {
220
- const packageJsonPath = module.findPackageJSON(
221
- resolved.path,
222
- resolved.resolveDir,
223
- );
224
-
225
- assert.ok(packageJsonPath !== undefined);
226
- if (external.includes('./node_modules/*')) {
227
- return { path: resolved.path, external: true };
228
- }
229
-
230
- const packageJson = JSON.parse(
231
- await fs.readFile(packageJsonPath, 'utf8'),
232
- ) as TemporalPolyfillPackageJson;
233
- const modulePath = getTemporalPolyfillModulePath(packageJson);
234
-
235
- assert.ok(modulePath !== undefined);
236
- return {
237
- path: path.join(path.dirname(packageJsonPath), modulePath),
238
- };
239
- },
240
- );
241
- };
242
- }
243
-
244
199
  // eslint-disable-next-line max-lines-per-function
245
200
  export default async function ({
246
201
  type,
@@ -270,62 +225,62 @@ export default async function ({
270
225
  /**
271
226
  * Emit declarations using TypeScript compiler if the type is 'types'. Otherwise, compile to ensure the build is good.
272
227
  */
273
- const compilerOptions = typescript.parseJsonConfigFileContent(
274
- tsConfigJson,
275
- typescript.sys,
276
- // @checkdigit/typescript-config package root:
277
- path.dirname(path.dirname(fileURLToPath(import.meta.url))),
228
+ await using api = new API();
229
+ const compilerOptions = (
230
+ await api.parseJsonConfigFileContent(tsConfigJson, {
231
+ // @checkdigit/typescript-config package root:
232
+ configDirectory: path.dirname(
233
+ path.dirname(fileURLToPath(import.meta.url)),
234
+ ),
235
+ })
278
236
  ).options;
279
- const program = typescript.createProgram(productionSourceFiles, {
237
+ await using program = await api.createProgram(productionSourceFiles, {
280
238
  ...compilerOptions,
281
239
  noEmit: type !== 'types',
282
240
  emitDeclarationOnly: type === 'types',
283
241
  rootDir: inDir,
284
242
  outDir,
285
243
  });
286
- const declarationFiles: OutputFile[] = [];
287
- const emitResult = program.emit(undefined, (fileName, data) => {
288
- declarationFiles.push({ path: fileName, text: data });
289
- });
290
- const allDiagnostics = typescript.sortAndDeduplicateDiagnostics([
291
- ...typescript.getPreEmitDiagnostics(program),
244
+ const emitResult = await program.emitToString();
245
+ const allDiagnostics = [
246
+ ...(
247
+ await Promise.all([
248
+ program.getGlobalDiagnostics(),
249
+ program.getProgramDiagnostics(),
250
+ program.getSyntacticDiagnostics(),
251
+ program.getSemanticDiagnostics(),
252
+ program.getDeclarationDiagnostics(),
253
+ ])
254
+ ).flat(),
292
255
  ...emitResult.diagnostics,
293
- ]);
256
+ ];
294
257
  for (const diagnostic of allDiagnostics) {
295
- if (diagnostic.file) {
296
- assert.ok(diagnostic.start !== undefined);
297
- const { line, character } = typescript.getLineAndCharacterOfPosition(
298
- diagnostic.file,
299
- diagnostic.start,
300
- );
301
- const message = typescript.flattenDiagnosticMessageText(
302
- diagnostic.messageText,
303
- '\n',
304
- );
305
- messages.push(
306
- `tsc: ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`,
307
- );
258
+ const message = flattenDiagnosticMessage(diagnostic);
259
+ if (diagnostic.fileName === undefined) {
260
+ messages.push(`tsc: ${message}`);
308
261
  } else {
262
+ assert.ok(diagnostic.startPosition !== undefined);
263
+ const { line, character } = diagnostic.startPosition;
309
264
  messages.push(
310
- `tsc: ${typescript.flattenDiagnosticMessageText(diagnostic.messageText, '\n')}`,
265
+ `tsc: ${diagnostic.fileName} (${line + 1},${character + 1}): ${message}`,
311
266
  );
312
267
  }
313
268
  }
314
269
 
315
270
  if (messages.length > 0) {
316
- throw new Error(`tsc failed ${JSON.stringify(messages)}`);
271
+ throw new Error(`tsc failed ${JSON.stringify([...new Set(messages)])}`);
317
272
  }
318
273
 
319
274
  if (type === 'types') {
320
275
  return {
321
- outputFiles: declarationFiles,
276
+ outputFiles: [...emitResult.outputFiles].map(([filePath, file]) => ({
277
+ path: filePath,
278
+ text: file.text,
279
+ })),
322
280
  };
323
281
  }
324
282
 
325
- /**
326
- * Emit ESM javascript using esbuild
327
- */
328
- const buildResult = await build({
283
+ return await build({
329
284
  entryPoints: productionSourceFiles,
330
285
  bundle: true,
331
286
  minify,
@@ -337,6 +292,7 @@ export default async function ({
337
292
  metafile: outFile !== undefined,
338
293
  sourcesContent: false,
339
294
  logLevel: 'error',
295
+ inject: outFile === undefined ? [] : [dirNameJsCompatibilityInjectionURL],
340
296
  banner:
341
297
  outFile === undefined
342
298
  ? {}
@@ -362,10 +318,6 @@ export default async function ({
362
318
  legalComments: 'none',
363
319
  external,
364
320
  plugins: [
365
- {
366
- name: 'resolve-runtime-temporal-polyfill',
367
- setup: resolveRuntimeTemporalPolyfill(external),
368
- },
369
321
  {
370
322
  name: 'exclude-source-maps',
371
323
  // Note: the /u flag cannot be used here because the underlying Go implementation does not support it
@@ -375,13 +327,4 @@ export default async function ({
375
327
  ],
376
328
  }),
377
329
  });
378
-
379
- messages.push(
380
- ...buildResult.errors.map((error) => `esbuild error: ${error.text}`),
381
- );
382
- if (messages.length > 0) {
383
- throw new Error(`esbuild failed ${JSON.stringify(messages)}`);
384
- }
385
-
386
- return buildResult;
387
330
  }
package/tsconfig.json CHANGED
@@ -2,9 +2,6 @@
2
2
  "compilerOptions": {
3
3
  "target": "esnext",
4
4
  "moduleResolution": "bundler",
5
- "paths": {
6
- "@js-temporal/polyfill": ["./src/types/js-temporal-polyfill.d.ts"]
7
- },
8
5
  "sourceMap": true,
9
6
  "inlineSources": true,
10
7
  "declaration": true,
@@ -1 +0,0 @@
1
- //# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFtdLAogICJtYXBwaW5ncyI6ICIiLAogICJuYW1lcyI6IFtdCn0K
@@ -1,5 +0,0 @@
1
- // types/js-temporal-polyfill.ts
2
-
3
- export declare const Temporal: typeof globalThis.Temporal;
4
- export declare const Intl: typeof globalThis.Intl;
5
- export declare function toTemporalInstant(this: Date): Temporal.Instant;