@_linked/cli 1.7.0 → 1.8.0
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/CHANGELOG.md +10 -0
- package/defaults/app-with-backend/linked.backend.storage.ts +1 -1
- package/defaults/app-with-backend/src/linked.frontend.storage.ts +1 -1
- package/defaults/app-with-backend/src/package.ts +5 -1
- package/lib/cjs/cli-methods.d.ts.map +1 -1
- package/lib/cjs/cli-methods.js +9 -0
- package/lib/cjs/cli-methods.js.map +1 -1
- package/lib/cjs/loaders/ts-loader.d.mts +3 -0
- package/lib/cjs/loaders/ts-loader.d.mts.map +1 -0
- package/lib/cjs/loaders/ts-loader.mjs +116 -0
- package/lib/cjs/loaders/ts-loader.mjs.map +1 -0
- package/lib/cjs/package.json +2 -1
- package/lib/esm/cli-methods.d.ts.map +1 -1
- package/lib/esm/cli-methods.js +9 -0
- package/lib/esm/cli-methods.js.map +1 -1
- package/lib/esm/launch.js +10 -9
- package/lib/esm/launch.js.map +1 -1
- package/lib/esm/loaders/ts-loader.d.mts +3 -0
- package/lib/esm/loaders/ts-loader.d.mts.map +1 -0
- package/lib/esm/loaders/ts-loader.mjs +129 -0
- package/lib/esm/loaders/ts-loader.mjs.map +1 -0
- package/lib/esm/package.json +2 -1
- package/package.json +2 -1
package/lib/esm/launch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launch.js","sourceRoot":"","sources":["../../src/launch.ts"],"names":[],"mappings":";AACA,
|
|
1
|
+
{"version":3,"file":"launch.js","sourceRoot":"","sources":["../../src/launch.ts"],"names":[],"mappings":";AACA,uEAAuE;AACvE,yEAAyE;AACzE,+DAA+D;AAC/D,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AACxE,uEAAuE;AACvE,8DAA8D;AAC9D,gCAAgC;AAChC,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAErC,QAAQ,CAAC,IAAI,GAAG,CAAC,0BAA0B,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,QAAQ,CAAC,IAAI,GAAG,CAAC,yBAAyB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE9D,MAAM,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IAC/B,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function resolve(specifier: string, context: any, nextResolve: (specifier: string, context: any) => Promise<any>): Promise<any>;
|
|
2
|
+
export declare function load(url: string, context: any, nextLoad: (url: string, context: any) => Promise<any>): Promise<any>;
|
|
3
|
+
//# sourceMappingURL=ts-loader.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-loader.d.mts","sourceRoot":"","sources":["../../../src/loaders/ts-loader.mts"],"names":[],"mappings":"AAsCA,wBAAsB,OAAO,CAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,GAAG,EACZ,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,GAC7D,OAAO,CAAC,GAAG,CAAC,CA0Dd;AAED,wBAAsB,IAAI,CACxB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,GAAG,EACZ,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,GACpD,OAAO,CAAC,GAAG,CAAC,CAwBd"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var _a;
|
|
11
|
+
// Node ESM loader for .ts / .tsx / .mts / .cts. Transforms via esbuild
|
|
12
|
+
// with `experimentalDecorators: true` forced on — @_linked/core's
|
|
13
|
+
// @literalProperty / @objectProperty / @linkedShape ship the legacy
|
|
14
|
+
// signature `(target, propertyKey, descriptor)`, so the loader has to
|
|
15
|
+
// produce legacy `__decorate(...)` calls. tsx (which we previously
|
|
16
|
+
// relied on) ignores experimentalDecorators since esbuild's default
|
|
17
|
+
// follows the TC39 standard decorator proposal — that mismatch silently
|
|
18
|
+
// broke decorator-based property registration in user scripts.
|
|
19
|
+
import { readFileSync, existsSync, statSync } from 'node:fs';
|
|
20
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
21
|
+
import path from 'node:path';
|
|
22
|
+
import { transformSync } from 'esbuild';
|
|
23
|
+
// Read the user's tsconfig once at boot. We re-use it for every TS file
|
|
24
|
+
// we transform so a single source of truth (the user app's tsconfig)
|
|
25
|
+
// drives target / jsx / paths / etc.
|
|
26
|
+
const userTsconfigPath = path.join(process.cwd(), 'tsconfig.json');
|
|
27
|
+
let userTsconfigRaw = { compilerOptions: {} };
|
|
28
|
+
if (existsSync(userTsconfigPath)) {
|
|
29
|
+
try {
|
|
30
|
+
userTsconfigRaw = JSON.parse(readFileSync(userTsconfigPath, 'utf8'));
|
|
31
|
+
userTsconfigRaw.compilerOptions = (_a = userTsconfigRaw.compilerOptions) !== null && _a !== void 0 ? _a : {};
|
|
32
|
+
}
|
|
33
|
+
catch (_b) {
|
|
34
|
+
// Fall back to empty config if parsing fails — esbuild still works.
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Force legacy decorator emit regardless of what the user's tsconfig says.
|
|
38
|
+
userTsconfigRaw.compilerOptions.experimentalDecorators = true;
|
|
39
|
+
const tsconfigRaw = JSON.stringify(userTsconfigRaw);
|
|
40
|
+
const TS_EXT = /\.(tsx?|mts|cts)$/;
|
|
41
|
+
const TS_RESOLUTION_EXTS = ['.ts', '.tsx', '.mts', '.cts'];
|
|
42
|
+
// Node's default ESM resolver requires explicit extensions on relative
|
|
43
|
+
// specifiers. App code (and the cli's user-app imports) routinely omits
|
|
44
|
+
// them — tsx used to backfill this, so we have to as well. We only
|
|
45
|
+
// touch `./foo` / `../foo` style imports; bare specifiers go straight to
|
|
46
|
+
// Node's resolver.
|
|
47
|
+
export function resolve(specifier, context, nextResolve) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
// Direct .ts/.tsx/.mts/.cts specifier (relative or absolute path).
|
|
50
|
+
// Node's default ESM resolver doesn't accept these extensions, so we
|
|
51
|
+
// short-circuit and let our `load` hook do the transform.
|
|
52
|
+
if (TS_EXT.test(specifier)) {
|
|
53
|
+
if (specifier.startsWith('file://')) {
|
|
54
|
+
return { url: specifier, shortCircuit: true, format: 'module' };
|
|
55
|
+
}
|
|
56
|
+
if (path.isAbsolute(specifier)) {
|
|
57
|
+
return {
|
|
58
|
+
url: pathToFileURL(specifier).href,
|
|
59
|
+
shortCircuit: true,
|
|
60
|
+
format: 'module',
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
if (specifier.startsWith('./') || specifier.startsWith('../')) {
|
|
64
|
+
const parentUrl = context.parentURL;
|
|
65
|
+
if (parentUrl) {
|
|
66
|
+
const parentPath = fileURLToPath(parentUrl);
|
|
67
|
+
const resolved = path.resolve(path.dirname(parentPath), specifier);
|
|
68
|
+
return {
|
|
69
|
+
url: pathToFileURL(resolved).href,
|
|
70
|
+
shortCircuit: true,
|
|
71
|
+
format: 'module',
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// Extension-less relative specifier — backfill the extension by probing
|
|
77
|
+
// the disk. App code routinely omits `.ts`/`.tsx` on intra-app imports.
|
|
78
|
+
if ((specifier.startsWith('./') || specifier.startsWith('../')) &&
|
|
79
|
+
!path.extname(specifier)) {
|
|
80
|
+
const parentUrl = context.parentURL;
|
|
81
|
+
if (parentUrl) {
|
|
82
|
+
const parentPath = fileURLToPath(parentUrl);
|
|
83
|
+
const resolvedBase = path.resolve(path.dirname(parentPath), specifier);
|
|
84
|
+
const candidates = [
|
|
85
|
+
...TS_RESOLUTION_EXTS.map((ext) => resolvedBase + ext),
|
|
86
|
+
...TS_RESOLUTION_EXTS.map((ext) => path.join(resolvedBase, 'index' + ext)),
|
|
87
|
+
];
|
|
88
|
+
for (const candidate of candidates) {
|
|
89
|
+
if (existsSync(candidate) && statSync(candidate).isFile()) {
|
|
90
|
+
return {
|
|
91
|
+
url: pathToFileURL(candidate).href,
|
|
92
|
+
shortCircuit: true,
|
|
93
|
+
format: 'module',
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return nextResolve(specifier, context);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
export function load(url, context, nextLoad) {
|
|
103
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
if (!TS_EXT.test(url)) {
|
|
105
|
+
return nextLoad(url, context);
|
|
106
|
+
}
|
|
107
|
+
const filePath = fileURLToPath(url);
|
|
108
|
+
const source = readFileSync(filePath, 'utf8');
|
|
109
|
+
const isTsx = url.endsWith('.tsx');
|
|
110
|
+
const { code } = transformSync(source, {
|
|
111
|
+
loader: isTsx ? 'tsx' : 'ts',
|
|
112
|
+
format: 'esm',
|
|
113
|
+
target: 'es2022',
|
|
114
|
+
sourcefile: filePath,
|
|
115
|
+
sourcemap: 'inline',
|
|
116
|
+
tsconfigRaw,
|
|
117
|
+
// Keep `import x from './data.json' with { type: 'json' }` syntax in
|
|
118
|
+
// the output — Node 22+ requires the attribute on JSON imports and
|
|
119
|
+
// esbuild strips it by default when downleveling below esnext.
|
|
120
|
+
supported: { 'import-attributes': true },
|
|
121
|
+
});
|
|
122
|
+
return {
|
|
123
|
+
format: 'module',
|
|
124
|
+
source: code,
|
|
125
|
+
shortCircuit: true,
|
|
126
|
+
};
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=ts-loader.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-loader.mjs","sourceRoot":"","sources":["../../../src/loaders/ts-loader.mts"],"names":[],"mappings":";;;;;;;;;;AAAA,uEAAuE;AACvE,kEAAkE;AAClE,oEAAoE;AACpE,sEAAsE;AACtE,mEAAmE;AACnE,oEAAoE;AACpE,wEAAwE;AACxE,+DAA+D;AAC/D,OAAO,EAAC,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,UAAU,CAAC;AACtD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AAEtC,wEAAwE;AACxE,qEAAqE;AACrE,qCAAqC;AACrC,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,eAAe,CAAC,CAAC;AACnE,IAAI,eAAe,GAAQ,EAAC,eAAe,EAAE,EAAE,EAAC,CAAC;AACjD,IAAI,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;IACjC,IAAI,CAAC;QACH,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC;QACrE,eAAe,CAAC,eAAe,GAAG,MAAA,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AE,QAAQ;yBACjB,CAAC;oBACJ,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;CAAA;AAED,MAAM,UAAgB,IAAI,CACxB,GAAW,EACX,OAAY,EACZ,QAAqD;;QAErD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACtB,OAAO,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAChC,CAAC;QACD,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC9C,MAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACnC,MAAM,EAAC,IAAI,EAAC,GAAG,aAAa,CAAC,MAAM,EAAE;YACnC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;YAC5B,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,QAAQ;YAChB,UAAU,EAAE,QAAQ;YACpB,SAAS,EAAE,QAAQ;YACnB,WAAW;YACX,qEAAqE;YACrE,mEAAmE;YACnE,+DAA+D;YAC/D,SAAS,EAAE,EAAC,mBAAmB,EAAE,IAAI,EAAC;SACvC,CAAC,CAAC;QACH,OAAO;YACL,MAAM,EAAE,QAAQ;YAChB,MAAM,EAAE,IAAI;YACZ,YAAY,EAAE,IAAI;SACnB,CAAC;IACJ,CAAC;CAAA"}
|
package/lib/esm/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@_linked/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Command line tools for the @_linked/* packages and apps",
|
|
5
5
|
"typesVersions": {
|
|
6
6
|
"*": {
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
"cssnano": "^7.0.7",
|
|
81
81
|
"depcheck": "^1.4.7",
|
|
82
82
|
"env-cmd": "^10.1.0",
|
|
83
|
+
"esbuild": "^0.28.0",
|
|
83
84
|
"find-nearest-package-json": "^2.0.1",
|
|
84
85
|
"fs-extra": "^11.2.0",
|
|
85
86
|
"glob": "^10.3.12",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@_linked/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Command line tools for the @_linked/* packages and apps",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|
|
@@ -100,6 +100,7 @@
|
|
|
100
100
|
"cssnano": "^7.0.7",
|
|
101
101
|
"depcheck": "^1.4.7",
|
|
102
102
|
"env-cmd": "^10.1.0",
|
|
103
|
+
"esbuild": "^0.28.0",
|
|
103
104
|
"find-nearest-package-json": "^2.0.1",
|
|
104
105
|
"fs-extra": "^11.2.0",
|
|
105
106
|
"glob": "^10.3.12",
|