@checkdigit/typescript-config 11.0.0-PR.82-4b7f → 11.0.0-PR.82-1629
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 +4 -0
- package/bin/builder.mjs +37 -72
- package/dist-mjs/compile.mjs +38 -70
- package/package.json +1 -1
- package/src/compile.ts +39 -88
- package/tsconfig.json +0 -3
- package/dist-mjs/types/js-temporal-polyfill.d.mjs +0 -1
- package/src/types/js-temporal-polyfill.d.ts +0 -5
package/README.md
CHANGED
|
@@ -24,6 +24,10 @@ This module contains the standard Check Digit TypeScript configuration, along wi
|
|
|
24
24
|
It is intended to be used when publishing a package to NPM, or to bundle a package for deployment.
|
|
25
25
|
It uses `tsc` for generating types, and `esbuild` for generating code.
|
|
26
26
|
|
|
27
|
+
The compiler and builder use TypeScript 7.1, installed as the
|
|
28
|
+
`@typescript/native` npm alias. Development tooling uses the TypeScript 6
|
|
29
|
+
compatibility package for `typescript-eslint`.
|
|
30
|
+
|
|
27
31
|
**Note:** the `require` function will be defined as a global variable, to allow
|
|
28
32
|
dynamic `require`s by CommonJS submodules. This is not a problem for Node.js, but will cause issues in a browser environment.
|
|
29
33
|
|
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
|
|
54
|
+
import { API } from "@typescript/native/sync";
|
|
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,
|
|
@@ -99,10 +95,11 @@ var tsconfig_default = {
|
|
|
99
95
|
// src/compile.ts
|
|
100
96
|
var commonJsCompatabilityBanner = `import { createRequire as __createRequire } from "node:module";
|
|
101
97
|
import { fileURLToPath as __fileURLToPath } from "node:url";
|
|
102
|
-
import { default as __path } from "node:path";
|
|
103
98
|
const __filename = __fileURLToPath(import.meta.url);
|
|
104
|
-
const __dirname = __path.dirname(__filename);
|
|
105
99
|
const require = __createRequire(import.meta.url);`;
|
|
100
|
+
var dirNameJsCompatibilityInjection = `import path from 'node:path';
|
|
101
|
+
export const __dirname = path.dirname(__filename);`;
|
|
102
|
+
var dirNameJsCompatibilityInjectionURL = `data:text/javascript,${encodeURIComponent(dirNameJsCompatibilityInjection)}`;
|
|
106
103
|
async function getFiles(directory) {
|
|
107
104
|
const entries = await fs.readdir(directory, { withFileTypes: true });
|
|
108
105
|
const files = await Promise.all(
|
|
@@ -113,6 +110,14 @@ async function getFiles(directory) {
|
|
|
113
110
|
);
|
|
114
111
|
return files.flat();
|
|
115
112
|
}
|
|
113
|
+
function flattenDiagnosticMessage(diagnostic, indent = 0) {
|
|
114
|
+
return [
|
|
115
|
+
`${" ".repeat(indent)}${diagnostic.text}`,
|
|
116
|
+
...(diagnostic.messageChain ?? []).map(
|
|
117
|
+
(child) => flattenDiagnosticMessage(child, indent + 1)
|
|
118
|
+
)
|
|
119
|
+
].join("\n");
|
|
120
|
+
}
|
|
116
121
|
function excludeSourceMaps(filter) {
|
|
117
122
|
return (pluginBuild) => {
|
|
118
123
|
pluginBuild.onLoad({ filter }, async (args) => {
|
|
@@ -153,38 +158,6 @@ function resolveTypescriptPaths() {
|
|
|
153
158
|
});
|
|
154
159
|
};
|
|
155
160
|
}
|
|
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
161
|
async function compile_default({
|
|
189
162
|
type: type2,
|
|
190
163
|
entryPoint: entryPoint2,
|
|
@@ -203,53 +176,48 @@ async function compile_default({
|
|
|
203
176
|
);
|
|
204
177
|
const allSourceFiles = await getFiles(inDir2);
|
|
205
178
|
const productionSourceFiles = entryPoint2 === void 0 ? allSourceFiles.filter((file) => file.endsWith(".ts")) : [path.join(inDir2, entryPoint2)];
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
typescript.sys,
|
|
179
|
+
using api = new API();
|
|
180
|
+
const compilerOptions = api.parseJsonConfigFileContent(tsconfig_default, {
|
|
209
181
|
// @checkdigit/typescript-config package root:
|
|
210
|
-
path.dirname(path.dirname(fileURLToPath(import.meta.url)))
|
|
211
|
-
).options;
|
|
212
|
-
|
|
182
|
+
configDirectory: path.dirname(path.dirname(fileURLToPath(import.meta.url)))
|
|
183
|
+
}).options;
|
|
184
|
+
using program = 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
|
|
220
|
-
const
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
...
|
|
191
|
+
const emitResult = program.emitToString();
|
|
192
|
+
const allDiagnostics = [
|
|
193
|
+
...program.getGlobalDiagnostics(),
|
|
194
|
+
...program.getProgramDiagnostics(),
|
|
195
|
+
...program.getSyntacticDiagnostics(),
|
|
196
|
+
...program.getSemanticDiagnostics(),
|
|
197
|
+
...program.getDeclarationDiagnostics(),
|
|
225
198
|
...emitResult.diagnostics
|
|
226
|
-
]
|
|
199
|
+
];
|
|
227
200
|
for (const diagnostic of allDiagnostics) {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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
|
-
);
|
|
201
|
+
const message = flattenDiagnosticMessage(diagnostic);
|
|
202
|
+
if (diagnostic.fileName === void 0) {
|
|
203
|
+
messages.push(`tsc: ${message}`);
|
|
241
204
|
} else {
|
|
205
|
+
assert2.ok(diagnostic.startPosition !== void 0);
|
|
206
|
+
const { line, character } = diagnostic.startPosition;
|
|
242
207
|
messages.push(
|
|
243
|
-
`tsc: ${
|
|
208
|
+
`tsc: ${diagnostic.fileName} (${line + 1},${character + 1}): ${message}`
|
|
244
209
|
);
|
|
245
210
|
}
|
|
246
211
|
}
|
|
247
212
|
if (messages.length > 0) {
|
|
248
|
-
throw new Error(`tsc failed ${JSON.stringify(messages)}`);
|
|
213
|
+
throw new Error(`tsc failed ${JSON.stringify([...new Set(messages)])}`);
|
|
249
214
|
}
|
|
250
215
|
if (type2 === "types") {
|
|
251
216
|
return {
|
|
252
|
-
outputFiles:
|
|
217
|
+
outputFiles: [...emitResult.outputFiles].map(([filePath, file]) => ({
|
|
218
|
+
path: filePath,
|
|
219
|
+
text: file.text
|
|
220
|
+
}))
|
|
253
221
|
};
|
|
254
222
|
}
|
|
255
223
|
const buildResult = await build({
|
|
@@ -264,6 +232,7 @@ async function compile_default({
|
|
|
264
232
|
metafile: outFile2 !== void 0,
|
|
265
233
|
sourcesContent: false,
|
|
266
234
|
logLevel: "error",
|
|
235
|
+
inject: outFile2 === void 0 ? [] : [dirNameJsCompatibilityInjectionURL],
|
|
267
236
|
banner: outFile2 === void 0 ? {} : {
|
|
268
237
|
js: commonJsCompatabilityBanner
|
|
269
238
|
},
|
|
@@ -284,10 +253,6 @@ async function compile_default({
|
|
|
284
253
|
legalComments: "none",
|
|
285
254
|
external: external2,
|
|
286
255
|
plugins: [
|
|
287
|
-
{
|
|
288
|
-
name: "resolve-runtime-temporal-polyfill",
|
|
289
|
-
setup: resolveRuntimeTemporalPolyfill(external2)
|
|
290
|
-
},
|
|
291
256
|
{
|
|
292
257
|
name: "exclude-source-maps",
|
|
293
258
|
// Note: the /u flag cannot be used here because the underlying Go implementation does not support it
|
package/dist-mjs/compile.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
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
|
|
6
|
+
import { API } from "@typescript/native/sync";
|
|
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
10
|
import { fileURLToPath as __fileURLToPath } from "node:url";
|
|
12
|
-
import { default as __path } from "node:path";
|
|
13
11
|
const __filename = __fileURLToPath(import.meta.url);
|
|
14
|
-
const __dirname = __path.dirname(__filename);
|
|
15
12
|
const require = __createRequire(import.meta.url);`;
|
|
13
|
+
var dirNameJsCompatibilityInjection = `import path from 'node:path';
|
|
14
|
+
export const __dirname = path.dirname(__filename);`;
|
|
15
|
+
var dirNameJsCompatibilityInjectionURL = `data:text/javascript,${encodeURIComponent(dirNameJsCompatibilityInjection)}`;
|
|
16
16
|
async function getFiles(directory) {
|
|
17
17
|
const entries = await fs.readdir(directory, { withFileTypes: true });
|
|
18
18
|
const files = await Promise.all(
|
|
@@ -23,6 +23,14 @@ async function getFiles(directory) {
|
|
|
23
23
|
);
|
|
24
24
|
return files.flat();
|
|
25
25
|
}
|
|
26
|
+
function flattenDiagnosticMessage(diagnostic, indent = 0) {
|
|
27
|
+
return [
|
|
28
|
+
`${" ".repeat(indent)}${diagnostic.text}`,
|
|
29
|
+
...(diagnostic.messageChain ?? []).map(
|
|
30
|
+
(child) => flattenDiagnosticMessage(child, indent + 1)
|
|
31
|
+
)
|
|
32
|
+
].join("\n");
|
|
33
|
+
}
|
|
26
34
|
function excludeSourceMaps(filter) {
|
|
27
35
|
return (pluginBuild) => {
|
|
28
36
|
pluginBuild.onLoad({ filter }, async (args) => {
|
|
@@ -63,38 +71,6 @@ function resolveTypescriptPaths() {
|
|
|
63
71
|
});
|
|
64
72
|
};
|
|
65
73
|
}
|
|
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
74
|
async function compile_default({
|
|
99
75
|
type,
|
|
100
76
|
entryPoint,
|
|
@@ -113,53 +89,48 @@ async function compile_default({
|
|
|
113
89
|
);
|
|
114
90
|
const allSourceFiles = await getFiles(inDir);
|
|
115
91
|
const productionSourceFiles = entryPoint === void 0 ? allSourceFiles.filter((file) => file.endsWith(".ts")) : [path.join(inDir, entryPoint)];
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
typescript.sys,
|
|
92
|
+
using api = new API();
|
|
93
|
+
const compilerOptions = api.parseJsonConfigFileContent(tsConfigJson, {
|
|
119
94
|
// @checkdigit/typescript-config package root:
|
|
120
|
-
path.dirname(path.dirname(fileURLToPath(import.meta.url)))
|
|
121
|
-
).options;
|
|
122
|
-
|
|
95
|
+
configDirectory: path.dirname(path.dirname(fileURLToPath(import.meta.url)))
|
|
96
|
+
}).options;
|
|
97
|
+
using program = 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
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
...
|
|
104
|
+
const emitResult = program.emitToString();
|
|
105
|
+
const allDiagnostics = [
|
|
106
|
+
...program.getGlobalDiagnostics(),
|
|
107
|
+
...program.getProgramDiagnostics(),
|
|
108
|
+
...program.getSyntacticDiagnostics(),
|
|
109
|
+
...program.getSemanticDiagnostics(),
|
|
110
|
+
...program.getDeclarationDiagnostics(),
|
|
135
111
|
...emitResult.diagnostics
|
|
136
|
-
]
|
|
112
|
+
];
|
|
137
113
|
for (const diagnostic of allDiagnostics) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
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
|
-
);
|
|
114
|
+
const message = flattenDiagnosticMessage(diagnostic);
|
|
115
|
+
if (diagnostic.fileName === void 0) {
|
|
116
|
+
messages.push(`tsc: ${message}`);
|
|
151
117
|
} else {
|
|
118
|
+
assert.ok(diagnostic.startPosition !== void 0);
|
|
119
|
+
const { line, character } = diagnostic.startPosition;
|
|
152
120
|
messages.push(
|
|
153
|
-
`tsc: ${
|
|
121
|
+
`tsc: ${diagnostic.fileName} (${line + 1},${character + 1}): ${message}`
|
|
154
122
|
);
|
|
155
123
|
}
|
|
156
124
|
}
|
|
157
125
|
if (messages.length > 0) {
|
|
158
|
-
throw new Error(`tsc failed ${JSON.stringify(messages)}`);
|
|
126
|
+
throw new Error(`tsc failed ${JSON.stringify([...new Set(messages)])}`);
|
|
159
127
|
}
|
|
160
128
|
if (type === "types") {
|
|
161
129
|
return {
|
|
162
|
-
outputFiles:
|
|
130
|
+
outputFiles: [...emitResult.outputFiles].map(([filePath, file]) => ({
|
|
131
|
+
path: filePath,
|
|
132
|
+
text: file.text
|
|
133
|
+
}))
|
|
163
134
|
};
|
|
164
135
|
}
|
|
165
136
|
const buildResult = await build({
|
|
@@ -174,6 +145,7 @@ async function compile_default({
|
|
|
174
145
|
metafile: outFile !== void 0,
|
|
175
146
|
sourcesContent: false,
|
|
176
147
|
logLevel: "error",
|
|
148
|
+
inject: outFile === void 0 ? [] : [dirNameJsCompatibilityInjectionURL],
|
|
177
149
|
banner: outFile === void 0 ? {} : {
|
|
178
150
|
js: commonJsCompatabilityBanner
|
|
179
151
|
},
|
|
@@ -194,10 +166,6 @@ async function compile_default({
|
|
|
194
166
|
legalComments: "none",
|
|
195
167
|
external,
|
|
196
168
|
plugins: [
|
|
197
|
-
{
|
|
198
|
-
name: "resolve-runtime-temporal-polyfill",
|
|
199
|
-
setup: resolveRuntimeTemporalPolyfill(external)
|
|
200
|
-
},
|
|
201
169
|
{
|
|
202
170
|
name: "exclude-source-maps",
|
|
203
171
|
// Note: the /u flag cannot be used here because the underlying Go implementation does not support it
|
|
@@ -218,4 +186,4 @@ async function compile_default({
|
|
|
218
186
|
export {
|
|
219
187
|
compile_default as default
|
|
220
188
|
};
|
|
221
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
189
|
+
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL2NvbXBpbGUudHMiXSwKICAibWFwcGluZ3MiOiAiO0FBRUEsU0FBUyxVQUFVLGN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TLFNBQVMsR0FBRztBQUN2QixVQUFNLElBQUksTUFBTSxrQkFBa0IsS0FBSyxVQUFVLFFBQVEsQ0FBQyxFQUFFO0FBQUEsRUFDOUQ7QUFFQSxTQUFPO0FBQ1Q7IiwKICAibmFtZXMiOiBbXQp9Cg==
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@checkdigit/typescript-config","version":"11.0.0-PR.82-
|
|
1
|
+
{"name":"@checkdigit/typescript-config","version":"11.0.0-PR.82-1629","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: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 --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"}}
|
package/src/compile.ts
CHANGED
|
@@ -2,22 +2,23 @@
|
|
|
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
|
|
8
|
+
import { API, type Diagnostic } from '@typescript/native/sync';
|
|
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
14
|
import { fileURLToPath as __fileURLToPath } from "node:url";
|
|
16
|
-
import { default as __path } from "node:path";
|
|
17
15
|
const __filename = __fileURLToPath(import.meta.url);
|
|
18
|
-
const __dirname = __path.dirname(__filename);
|
|
19
16
|
const require = __createRequire(import.meta.url);`;
|
|
20
17
|
|
|
18
|
+
const dirNameJsCompatibilityInjection = `import path from 'node:path';
|
|
19
|
+
export const __dirname = path.dirname(__filename);`; // relies on __filename from commonJsCompatabilityBanner
|
|
20
|
+
const dirNameJsCompatibilityInjectionURL = `data:text/javascript,${encodeURIComponent(dirNameJsCompatibilityInjection)}`;
|
|
21
|
+
|
|
21
22
|
export type ImportKind =
|
|
22
23
|
| 'entry-point'
|
|
23
24
|
| 'import-statement'
|
|
@@ -138,6 +139,15 @@ async function getFiles(directory: string): Promise<string[]> {
|
|
|
138
139
|
return files.flat();
|
|
139
140
|
}
|
|
140
141
|
|
|
142
|
+
function flattenDiagnosticMessage(diagnostic: Diagnostic, indent = 0): string {
|
|
143
|
+
return [
|
|
144
|
+
`${' '.repeat(indent)}${diagnostic.text}`,
|
|
145
|
+
...(diagnostic.messageChain ?? []).map((child) =>
|
|
146
|
+
flattenDiagnosticMessage(child, indent + 1),
|
|
147
|
+
),
|
|
148
|
+
].join('\n');
|
|
149
|
+
}
|
|
150
|
+
|
|
141
151
|
function excludeSourceMaps(filter: RegExp) {
|
|
142
152
|
return (pluginBuild: PluginBuild) => {
|
|
143
153
|
// ignore source maps for any Javascript file that matches filter
|
|
@@ -190,57 +200,6 @@ function resolveTypescriptPaths() {
|
|
|
190
200
|
};
|
|
191
201
|
}
|
|
192
202
|
|
|
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
203
|
// eslint-disable-next-line max-lines-per-function
|
|
245
204
|
export default async function ({
|
|
246
205
|
type,
|
|
@@ -270,55 +229,50 @@ export default async function ({
|
|
|
270
229
|
/**
|
|
271
230
|
* Emit declarations using TypeScript compiler if the type is 'types'. Otherwise, compile to ensure the build is good.
|
|
272
231
|
*/
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
typescript.sys,
|
|
232
|
+
using api = new API();
|
|
233
|
+
const compilerOptions = api.parseJsonConfigFileContent(tsConfigJson, {
|
|
276
234
|
// @checkdigit/typescript-config package root:
|
|
277
|
-
path.dirname(path.dirname(fileURLToPath(import.meta.url))),
|
|
278
|
-
).options;
|
|
279
|
-
|
|
235
|
+
configDirectory: path.dirname(path.dirname(fileURLToPath(import.meta.url))),
|
|
236
|
+
}).options;
|
|
237
|
+
using program = 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
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
...
|
|
244
|
+
const emitResult = program.emitToString();
|
|
245
|
+
const allDiagnostics = [
|
|
246
|
+
...program.getGlobalDiagnostics(),
|
|
247
|
+
...program.getProgramDiagnostics(),
|
|
248
|
+
...program.getSyntacticDiagnostics(),
|
|
249
|
+
...program.getSemanticDiagnostics(),
|
|
250
|
+
...program.getDeclarationDiagnostics(),
|
|
292
251
|
...emitResult.diagnostics,
|
|
293
|
-
]
|
|
252
|
+
];
|
|
294
253
|
for (const diagnostic of allDiagnostics) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
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
|
-
);
|
|
254
|
+
const message = flattenDiagnosticMessage(diagnostic);
|
|
255
|
+
if (diagnostic.fileName === undefined) {
|
|
256
|
+
messages.push(`tsc: ${message}`);
|
|
308
257
|
} else {
|
|
258
|
+
assert.ok(diagnostic.startPosition !== undefined);
|
|
259
|
+
const { line, character } = diagnostic.startPosition;
|
|
309
260
|
messages.push(
|
|
310
|
-
`tsc: ${
|
|
261
|
+
`tsc: ${diagnostic.fileName} (${line + 1},${character + 1}): ${message}`,
|
|
311
262
|
);
|
|
312
263
|
}
|
|
313
264
|
}
|
|
314
265
|
|
|
315
266
|
if (messages.length > 0) {
|
|
316
|
-
throw new Error(`tsc failed ${JSON.stringify(messages)}`);
|
|
267
|
+
throw new Error(`tsc failed ${JSON.stringify([...new Set(messages)])}`);
|
|
317
268
|
}
|
|
318
269
|
|
|
319
270
|
if (type === 'types') {
|
|
320
271
|
return {
|
|
321
|
-
outputFiles:
|
|
272
|
+
outputFiles: [...emitResult.outputFiles].map(([filePath, file]) => ({
|
|
273
|
+
path: filePath,
|
|
274
|
+
text: file.text,
|
|
275
|
+
})),
|
|
322
276
|
};
|
|
323
277
|
}
|
|
324
278
|
|
|
@@ -337,6 +291,7 @@ export default async function ({
|
|
|
337
291
|
metafile: outFile !== undefined,
|
|
338
292
|
sourcesContent: false,
|
|
339
293
|
logLevel: 'error',
|
|
294
|
+
inject: outFile === undefined ? [] : [dirNameJsCompatibilityInjectionURL],
|
|
340
295
|
banner:
|
|
341
296
|
outFile === undefined
|
|
342
297
|
? {}
|
|
@@ -362,10 +317,6 @@ export default async function ({
|
|
|
362
317
|
legalComments: 'none',
|
|
363
318
|
external,
|
|
364
319
|
plugins: [
|
|
365
|
-
{
|
|
366
|
-
name: 'resolve-runtime-temporal-polyfill',
|
|
367
|
-
setup: resolveRuntimeTemporalPolyfill(external),
|
|
368
|
-
},
|
|
369
320
|
{
|
|
370
321
|
name: 'exclude-source-maps',
|
|
371
322
|
// Note: the /u flag cannot be used here because the underlying Go implementation does not support it
|
package/tsconfig.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFtdLAogICJtYXBwaW5ncyI6ICIiLAogICJuYW1lcyI6IFtdCn0K
|