@knighted/duel 2.1.4 → 2.1.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.
- package/dist/cjs/duel.cjs +7 -3
- package/dist/esm/duel.js +9 -5
- package/package.json +29 -21
package/dist/cjs/duel.cjs
CHANGED
|
@@ -25,9 +25,13 @@ const duel = async (args) => {
|
|
|
25
25
|
const { projectDir, tsconfig, configPath, modules, dirs, pkg } = ctx;
|
|
26
26
|
const tsc = await (0, find_up_1.findUp)(async (dir) => {
|
|
27
27
|
const tscBin = (0, node_path_1.join)(dir, 'node_modules', '.bin', 'tsc');
|
|
28
|
-
|
|
28
|
+
try {
|
|
29
|
+
await (0, promises_1.access)(tscBin);
|
|
29
30
|
return tscBin;
|
|
30
31
|
}
|
|
32
|
+
catch {
|
|
33
|
+
/* continue */
|
|
34
|
+
}
|
|
31
35
|
}, { cwd: projectDir });
|
|
32
36
|
const runBuild = (project, outDir) => {
|
|
33
37
|
return new Promise((resolve, reject) => {
|
|
@@ -113,7 +117,7 @@ const duel = async (args) => {
|
|
|
113
117
|
* Transform ambiguous modules for the target dual build.
|
|
114
118
|
* @see https://github.com/microsoft/TypeScript/issues/58658
|
|
115
119
|
*/
|
|
116
|
-
const toTransform = await (0, glob_1.glob)(`${subDir}/**/*{.js,.jsx,.ts,.tsx}`, {
|
|
120
|
+
const toTransform = await (0, glob_1.glob)(`${subDir.replace(/\\/g, '/')}/**/*{.js,.jsx,.ts,.tsx}`, {
|
|
117
121
|
ignore: 'node_modules/**',
|
|
118
122
|
});
|
|
119
123
|
for (const file of toTransform) {
|
|
@@ -157,7 +161,7 @@ const duel = async (args) => {
|
|
|
157
161
|
}
|
|
158
162
|
}
|
|
159
163
|
if (success) {
|
|
160
|
-
const filenames = await (0, glob_1.glob)(`${absoluteDualOutDir}/**/*{.js,.d.ts}`, {
|
|
164
|
+
const filenames = await (0, glob_1.glob)(`${absoluteDualOutDir.replace(/\\/g, '/')}/**/*{.js,.d.ts}`, {
|
|
161
165
|
ignore: 'node_modules/**',
|
|
162
166
|
});
|
|
163
167
|
await updateSpecifiersAndFileExtensions(filenames);
|
package/dist/esm/duel.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { argv, platform } from 'node:process';
|
|
3
3
|
import { join, dirname, resolve, relative } from 'node:path';
|
|
4
4
|
import { spawn } from 'node:child_process';
|
|
5
|
-
import { writeFile, rm, rename, mkdir, cp } from 'node:fs/promises';
|
|
5
|
+
import { writeFile, rm, rename, mkdir, cp, access } from 'node:fs/promises';
|
|
6
6
|
import { randomBytes } from 'node:crypto';
|
|
7
7
|
import { performance } from 'node:perf_hooks';
|
|
8
8
|
import { glob } from 'glob';
|
|
9
|
-
import { findUp
|
|
9
|
+
import { findUp } from 'find-up';
|
|
10
10
|
import { specifier } from '@knighted/specifier';
|
|
11
11
|
import { transform } from '@knighted/module';
|
|
12
12
|
import { init } from './init.js';
|
|
@@ -22,9 +22,13 @@ const duel = async (args) => {
|
|
|
22
22
|
const { projectDir, tsconfig, configPath, modules, dirs, pkg } = ctx;
|
|
23
23
|
const tsc = await findUp(async (dir) => {
|
|
24
24
|
const tscBin = join(dir, 'node_modules', '.bin', 'tsc');
|
|
25
|
-
|
|
25
|
+
try {
|
|
26
|
+
await access(tscBin);
|
|
26
27
|
return tscBin;
|
|
27
28
|
}
|
|
29
|
+
catch {
|
|
30
|
+
/* continue */
|
|
31
|
+
}
|
|
28
32
|
}, { cwd: projectDir });
|
|
29
33
|
const runBuild = (project, outDir) => {
|
|
30
34
|
return new Promise((resolve, reject) => {
|
|
@@ -110,7 +114,7 @@ const duel = async (args) => {
|
|
|
110
114
|
* Transform ambiguous modules for the target dual build.
|
|
111
115
|
* @see https://github.com/microsoft/TypeScript/issues/58658
|
|
112
116
|
*/
|
|
113
|
-
const toTransform = await glob(`${subDir}/**/*{.js,.jsx,.ts,.tsx}`, {
|
|
117
|
+
const toTransform = await glob(`${subDir.replace(/\\/g, '/')}/**/*{.js,.jsx,.ts,.tsx}`, {
|
|
114
118
|
ignore: 'node_modules/**',
|
|
115
119
|
});
|
|
116
120
|
for (const file of toTransform) {
|
|
@@ -154,7 +158,7 @@ const duel = async (args) => {
|
|
|
154
158
|
}
|
|
155
159
|
}
|
|
156
160
|
if (success) {
|
|
157
|
-
const filenames = await glob(`${absoluteDualOutDir}/**/*{.js,.d.ts}`, {
|
|
161
|
+
const filenames = await glob(`${absoluteDualOutDir.replace(/\\/g, '/')}/**/*{.js,.d.ts}`, {
|
|
158
162
|
ignore: 'node_modules/**',
|
|
159
163
|
});
|
|
160
164
|
await updateSpecifiersAndFileExtensions(filenames);
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knighted/duel",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.6",
|
|
4
4
|
"description": "TypeScript dual packages.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/esm/duel.js",
|
|
7
|
-
"bin":
|
|
7
|
+
"bin": {
|
|
8
|
+
"duel": "dist/esm/duel.js"
|
|
9
|
+
},
|
|
8
10
|
"exports": {
|
|
9
11
|
".": {
|
|
10
12
|
"import": "./dist/esm/duel.js",
|
|
@@ -47,35 +49,41 @@
|
|
|
47
49
|
"license": "MIT",
|
|
48
50
|
"repository": {
|
|
49
51
|
"type": "git",
|
|
50
|
-
"url": "https://github.com/knightedcodemonkey/duel.git"
|
|
52
|
+
"url": "git+https://github.com/knightedcodemonkey/duel.git"
|
|
51
53
|
},
|
|
52
54
|
"bugs": {
|
|
53
55
|
"url": "https://github.com/knightedcodemonkey/duel/issues"
|
|
54
56
|
},
|
|
55
57
|
"peerDependencies": {
|
|
56
|
-
"typescript": ">=5.5.0
|
|
58
|
+
"typescript": ">=5.5.0 <6",
|
|
59
|
+
"typescript-next": "npm:typescript@next"
|
|
60
|
+
},
|
|
61
|
+
"peerDependenciesMeta": {
|
|
62
|
+
"typescript-next": {
|
|
63
|
+
"optional": true
|
|
64
|
+
}
|
|
57
65
|
},
|
|
58
66
|
"devDependencies": {
|
|
59
|
-
"@eslint/js": "^9.
|
|
60
|
-
"@tsconfig/recommended": "^1.0.
|
|
61
|
-
"@types/node": "^
|
|
67
|
+
"@eslint/js": "^9.39.1",
|
|
68
|
+
"@tsconfig/recommended": "^1.0.10",
|
|
69
|
+
"@types/node": "^24.10.1",
|
|
62
70
|
"c8": "^10.1.3",
|
|
63
|
-
"eslint": "^9.
|
|
64
|
-
"eslint-plugin-n": "^17.
|
|
65
|
-
"globals": "^
|
|
66
|
-
"node-module-type": "^1.0.
|
|
67
|
-
"prettier": "^3.
|
|
68
|
-
"tsx": "^4.
|
|
69
|
-
"typescript": "^5.
|
|
70
|
-
"vite": "^
|
|
71
|
+
"eslint": "^9.39.1",
|
|
72
|
+
"eslint-plugin-n": "^17.23.1",
|
|
73
|
+
"globals": "^16.3.0",
|
|
74
|
+
"node-module-type": "^1.0.4",
|
|
75
|
+
"prettier": "^3.6.2",
|
|
76
|
+
"tsx": "^4.20.6",
|
|
77
|
+
"typescript": "^5.9.3",
|
|
78
|
+
"vite": "^7.2.4"
|
|
71
79
|
},
|
|
72
80
|
"dependencies": {
|
|
73
|
-
"@knighted/module": "^1.0.0-alpha.
|
|
74
|
-
"@knighted/specifier": "^2.0.
|
|
75
|
-
"find-up": "^
|
|
76
|
-
"get-tsconfig": "^4.
|
|
77
|
-
"glob": "^
|
|
78
|
-
"read-package-up": "^
|
|
81
|
+
"@knighted/module": "^1.0.0-alpha.10",
|
|
82
|
+
"@knighted/specifier": "^2.0.9",
|
|
83
|
+
"find-up": "^8.0.0",
|
|
84
|
+
"get-tsconfig": "^4.13.0",
|
|
85
|
+
"glob": "^13.0.0",
|
|
86
|
+
"read-package-up": "^12.0.0"
|
|
79
87
|
},
|
|
80
88
|
"prettier": {
|
|
81
89
|
"arrowParens": "avoid",
|