@gjsify/tsc 0.4.37 → 0.4.38
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/dist/tsc.gjs.mjs +68 -68
- package/package.json +9 -8
- package/src/index.gjs.spec.ts +29 -1
- package/src/index.ts +7 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/tsc",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.38",
|
|
4
4
|
"description": "TypeScript compiler for GJS — bundles upstream `typescript` to a single GJS module + ships a Node-free `tsc` bin.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
|
-
"dist/tsc.gjs.mjs"
|
|
24
|
+
"dist/tsc.gjs.mjs",
|
|
25
|
+
"lib/lib*.d.ts"
|
|
25
26
|
],
|
|
26
27
|
"scripts": {
|
|
27
28
|
"clear": "rm -rf dist tsconfig.tsbuildinfo || exit 0",
|
|
@@ -50,15 +51,15 @@
|
|
|
50
51
|
"homepage": "https://github.com/gjsify/gjsify/tree/main/packages/infra/tsc#readme",
|
|
51
52
|
"license": "MIT",
|
|
52
53
|
"dependencies": {
|
|
53
|
-
"@gjsify/console": "^0.4.
|
|
54
|
-
"@gjsify/node-globals": "^0.4.
|
|
55
|
-
"@gjsify/web-globals": "^0.4.
|
|
54
|
+
"@gjsify/console": "^0.4.38",
|
|
55
|
+
"@gjsify/node-globals": "^0.4.38",
|
|
56
|
+
"@gjsify/web-globals": "^0.4.38"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
|
-
"@gjsify/cli": "^0.4.
|
|
59
|
-
"@gjsify/unit": "^0.4.
|
|
59
|
+
"@gjsify/cli": "^0.4.38",
|
|
60
|
+
"@gjsify/unit": "^0.4.38",
|
|
60
61
|
"@girs/gio-2.0": "2.88.0-4.0.4",
|
|
61
62
|
"@girs/glib-2.0": "2.88.0-4.0.4",
|
|
62
|
-
"typescript": "^
|
|
63
|
+
"typescript": "^6.0.3"
|
|
63
64
|
}
|
|
64
65
|
}
|
package/src/index.gjs.spec.ts
CHANGED
|
@@ -30,7 +30,7 @@ function runTsc(args: string[]): { stdout: string; stderr: string; status: numbe
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/** Create a throwaway tsconfig + source-file fixture, return its absolute path. */
|
|
33
|
-
function makeProject(filename: string, source: string): string {
|
|
33
|
+
function makeProject(filename: string, source: string, lib?: string[]): string {
|
|
34
34
|
const tmp = GLib.dir_make_tmp('gjsify-tsc-spec-XXXXXX');
|
|
35
35
|
if (!tmp) {
|
|
36
36
|
throw new Error('GLib.dir_make_tmp returned null');
|
|
@@ -42,6 +42,7 @@ function makeProject(filename: string, source: string): string {
|
|
|
42
42
|
target: 'ES2020',
|
|
43
43
|
module: 'ESNext',
|
|
44
44
|
moduleResolution: 'bundler',
|
|
45
|
+
...(lib ? { lib } : {}),
|
|
45
46
|
},
|
|
46
47
|
include: ['*.ts'],
|
|
47
48
|
});
|
|
@@ -106,6 +107,33 @@ export default async () => {
|
|
|
106
107
|
cleanupProject(tmp);
|
|
107
108
|
}
|
|
108
109
|
});
|
|
110
|
+
|
|
111
|
+
// Drop-in regression: with an explicit `"lib": ["ESNext","DOM"]`,
|
|
112
|
+
// the bundled `lib.*.d.ts` must resolve from the SHIPPED libs (the
|
|
113
|
+
// consumer has no upstream `typescript`). Before the lib-resolution
|
|
114
|
+
// fix this printed `error TS6053: File '…/lib.esnext.d.ts' not found`
|
|
115
|
+
// + a cascade of `error TS2318: Cannot find global type 'Array'/…`.
|
|
116
|
+
// Now the only error must be the deliberate Promise type mismatch.
|
|
117
|
+
await it('resolves explicit "lib" without TS6053/TS2318 and still catches the deliberate error', async () => {
|
|
118
|
+
const tmp = makeProject(
|
|
119
|
+
'libcheck.ts',
|
|
120
|
+
'const p: Promise<number> = "x";\nexport { p };\n',
|
|
121
|
+
['ESNext', 'DOM'],
|
|
122
|
+
);
|
|
123
|
+
try {
|
|
124
|
+
const { stdout, status } = runTsc(['-p', tmp]);
|
|
125
|
+
// No missing-lib / missing-global-type errors.
|
|
126
|
+
expect(stdout.includes('TS6053')).toBe(false);
|
|
127
|
+
expect(stdout.includes('TS2318')).toBe(false);
|
|
128
|
+
expect(stdout.includes('lib.esnext.d.ts')).toBe(false);
|
|
129
|
+
// The deliberate `Promise<number> = "x"` must still be caught.
|
|
130
|
+
expect(status).toBe(2);
|
|
131
|
+
expect(stdout).toContain('TS2322');
|
|
132
|
+
expect(stdout).toContain('libcheck.ts');
|
|
133
|
+
} finally {
|
|
134
|
+
cleanupProject(tmp);
|
|
135
|
+
}
|
|
136
|
+
});
|
|
109
137
|
});
|
|
110
138
|
});
|
|
111
139
|
};
|
package/src/index.ts
CHANGED
|
@@ -27,10 +27,11 @@ export const TSC_BUNDLE_PATH: string = resolve(
|
|
|
27
27
|
|
|
28
28
|
/** Pinned upstream TypeScript version the shipped bundle was built from.
|
|
29
29
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
30
|
+
* This is the version actually bundled into `dist/tsc.gjs.mjs`. The whole
|
|
31
|
+
* workspace declares `typescript: "^6.0.3"` (the single, workspace-wide range
|
|
32
|
+
* enforced by the `gjsify upgrade --check` CI gate), so `gjsify install`
|
|
33
|
+
* resolves the same 6.x the bundle is built from. CI cross-checks this constant
|
|
34
|
+
* against the committed bundle's reported `--version`, so keep it in lockstep
|
|
35
|
+
* with the `typescript` devDep when bumping the bundled toolchain.
|
|
35
36
|
*/
|
|
36
|
-
export const TYPESCRIPT_VERSION = '
|
|
37
|
+
export const TYPESCRIPT_VERSION = '6.0.3' as const;
|