@absolutejs/absolute 0.19.0-beta.971 → 0.19.0-beta.973
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/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +8 -2
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +8 -2
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +874 -779
- package/dist/build.js.map +7 -6
- package/dist/index.js +916 -821
- package/dist/index.js.map +7 -6
- package/dist/src/angular/loadGlobalProviders.d.ts +0 -4
- package/dist/src/build/emitAngularProvidersFiles.d.ts +8 -4
- package/dist/src/build/parseAngularConfigImports.d.ts +9 -0
- package/dist/src/build/runAngularHandlerScan.d.ts +1 -8
- package/dist/src/utils/loadConfig.d.ts +1 -1
- package/dist/types/build.d.ts +11 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12016,7 +12016,7 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
|
|
|
12016
12016
|
}
|
|
12017
12017
|
return lines.join(`
|
|
12018
12018
|
`);
|
|
12019
|
-
}, ROUTER_FEATURES_DEFAULT, renderFile = (call, outputPath, basePath, pageRoutes,
|
|
12019
|
+
}, ROUTER_FEATURES_DEFAULT, renderFile = (call, outputPath, basePath, pageRoutes, providersImport) => {
|
|
12020
12020
|
const sections = [];
|
|
12021
12021
|
sections.push("/* AUTOGENERATED by AbsoluteJS \u2014 see `scanAngularHandlerCalls`. */", "/* eslint-disable */");
|
|
12022
12022
|
const groups = groupImports(call.providerImports);
|
|
@@ -12025,12 +12025,12 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
|
|
|
12025
12025
|
sections.push(renderImportGroup(group, outputPath));
|
|
12026
12026
|
}
|
|
12027
12027
|
}
|
|
12028
|
-
if (
|
|
12028
|
+
if (providersImport) {
|
|
12029
12029
|
const outputDir = dirname13(outputPath);
|
|
12030
|
-
const rel = relative10(outputDir,
|
|
12031
|
-
const
|
|
12032
|
-
const
|
|
12033
|
-
sections.push(`import {
|
|
12030
|
+
const rel = relative10(outputDir, providersImport.absolutePath).replace(/\\/g, "/");
|
|
12031
|
+
const specifier = rel.startsWith(".") ? rel : `./${rel}`;
|
|
12032
|
+
const importClause = providersImport.importedName === providersImport.bindingName ? `{ ${providersImport.bindingName} as __globalProviders }` : `{ ${providersImport.importedName} as __globalProviders }`;
|
|
12033
|
+
sections.push(`import ${importClause} from "${specifier}";`);
|
|
12034
12034
|
}
|
|
12035
12035
|
if (basePath !== null) {
|
|
12036
12036
|
sections.push(`import { APP_BASE_HREF } from "@angular/common";`, `const __basePathProvider = { provide: APP_BASE_HREF, useValue: ${JSON.stringify(basePath)} };`);
|
|
@@ -12041,7 +12041,7 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
|
|
|
12041
12041
|
}
|
|
12042
12042
|
const userProvidersExpr = call.providersExpr ?? "[]";
|
|
12043
12043
|
const fragments = [];
|
|
12044
|
-
if (
|
|
12044
|
+
if (providersImport)
|
|
12045
12045
|
fragments.push("...__globalProviders");
|
|
12046
12046
|
if (call.providersExpr !== null)
|
|
12047
12047
|
fragments.push(`...(${userProvidersExpr})`);
|
|
@@ -12074,7 +12074,7 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
|
|
|
12074
12074
|
const outputPath = join24(outputDir, `${call.manifestKey}.providers.ts`);
|
|
12075
12075
|
const basePath = deriveBasePath(call.mountPath);
|
|
12076
12076
|
const pageRoute = pageRoutesByKey.get(call.manifestKey);
|
|
12077
|
-
const content = renderFile(call, outputPath, basePath, pageRoute, options.providersImport
|
|
12077
|
+
const content = renderFile(call, outputPath, basePath, pageRoute, options.providersImport ?? null);
|
|
12078
12078
|
writeFileSync8(outputPath, content, "utf-8");
|
|
12079
12079
|
emitted.push({
|
|
12080
12080
|
basePath,
|
|
@@ -12084,11 +12084,6 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
|
|
|
12084
12084
|
});
|
|
12085
12085
|
}
|
|
12086
12086
|
return emitted;
|
|
12087
|
-
}, resolveProvidersImport = (projectRoot, providersImport) => {
|
|
12088
|
-
if (providersImport.startsWith(".")) {
|
|
12089
|
-
return join24(projectRoot, providersImport);
|
|
12090
|
-
}
|
|
12091
|
-
return providersImport;
|
|
12092
12087
|
}, getProvidersOutputDir = (projectRoot) => join24(getFrameworkGeneratedDir("angular", projectRoot), "providers");
|
|
12093
12088
|
var init_emitAngularProvidersFiles = __esm(() => {
|
|
12094
12089
|
init_generatedDir();
|
|
@@ -12147,14 +12142,115 @@ var init_emitAngularRouteMounts = __esm(() => {
|
|
|
12147
12142
|
init_generatedDir();
|
|
12148
12143
|
});
|
|
12149
12144
|
|
|
12150
|
-
// src/build/
|
|
12151
|
-
import {
|
|
12152
|
-
import { dirname as dirname14, isAbsolute as isAbsolute3, join as join26
|
|
12145
|
+
// src/build/parseAngularConfigImports.ts
|
|
12146
|
+
import { existsSync as existsSync20, readFileSync as readFileSync15 } from "fs";
|
|
12147
|
+
import { dirname as dirname14, isAbsolute as isAbsolute3, join as join26 } from "path";
|
|
12153
12148
|
import ts7 from "typescript";
|
|
12149
|
+
var findDefineConfigCall = (sf) => {
|
|
12150
|
+
let result = null;
|
|
12151
|
+
const visit = (node) => {
|
|
12152
|
+
if (result)
|
|
12153
|
+
return;
|
|
12154
|
+
if (ts7.isCallExpression(node) && ts7.isIdentifier(node.expression) && node.expression.text === "defineConfig") {
|
|
12155
|
+
const [arg] = node.arguments;
|
|
12156
|
+
if (arg && ts7.isObjectLiteralExpression(arg)) {
|
|
12157
|
+
result = arg;
|
|
12158
|
+
return;
|
|
12159
|
+
}
|
|
12160
|
+
}
|
|
12161
|
+
ts7.forEachChild(node, visit);
|
|
12162
|
+
};
|
|
12163
|
+
ts7.forEachChild(sf, visit);
|
|
12164
|
+
return result;
|
|
12165
|
+
}, findPropertyInitializer = (object, name) => {
|
|
12166
|
+
for (const prop of object.properties) {
|
|
12167
|
+
if (!ts7.isPropertyAssignment(prop))
|
|
12168
|
+
continue;
|
|
12169
|
+
if (!prop.name)
|
|
12170
|
+
continue;
|
|
12171
|
+
const key = ts7.isIdentifier(prop.name) ? prop.name.text : ts7.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
12172
|
+
if (key === name)
|
|
12173
|
+
return prop.initializer;
|
|
12174
|
+
}
|
|
12175
|
+
return null;
|
|
12176
|
+
}, findImportForBinding = (sf, binding) => {
|
|
12177
|
+
for (const statement of sf.statements) {
|
|
12178
|
+
if (!ts7.isImportDeclaration(statement))
|
|
12179
|
+
continue;
|
|
12180
|
+
if (!ts7.isStringLiteral(statement.moduleSpecifier))
|
|
12181
|
+
continue;
|
|
12182
|
+
if (statement.importClause?.isTypeOnly)
|
|
12183
|
+
continue;
|
|
12184
|
+
const named = statement.importClause?.namedBindings;
|
|
12185
|
+
if (!named || !ts7.isNamedImports(named))
|
|
12186
|
+
continue;
|
|
12187
|
+
for (const element of named.elements) {
|
|
12188
|
+
if (element.isTypeOnly)
|
|
12189
|
+
continue;
|
|
12190
|
+
if (element.name.text === binding) {
|
|
12191
|
+
return {
|
|
12192
|
+
importedName: element.propertyName?.text ?? element.name.text,
|
|
12193
|
+
source: statement.moduleSpecifier.text
|
|
12194
|
+
};
|
|
12195
|
+
}
|
|
12196
|
+
}
|
|
12197
|
+
}
|
|
12198
|
+
return null;
|
|
12199
|
+
}, resolveConfigPath = (projectRoot) => {
|
|
12200
|
+
const candidates = [
|
|
12201
|
+
join26(projectRoot, "absolute.config.ts"),
|
|
12202
|
+
join26(projectRoot, "absolute.config.mts"),
|
|
12203
|
+
join26(projectRoot, "absolute.config.js"),
|
|
12204
|
+
join26(projectRoot, "absolute.config.mjs")
|
|
12205
|
+
];
|
|
12206
|
+
for (const candidate of candidates) {
|
|
12207
|
+
if (existsSync20(candidate))
|
|
12208
|
+
return candidate;
|
|
12209
|
+
}
|
|
12210
|
+
return null;
|
|
12211
|
+
}, parseAngularProvidersImport = (projectRoot) => {
|
|
12212
|
+
const configPath2 = resolveConfigPath(projectRoot);
|
|
12213
|
+
if (!configPath2)
|
|
12214
|
+
return null;
|
|
12215
|
+
const source = readFileSync15(configPath2, "utf-8");
|
|
12216
|
+
if (!source.includes("angular"))
|
|
12217
|
+
return null;
|
|
12218
|
+
if (!source.includes("providers"))
|
|
12219
|
+
return null;
|
|
12220
|
+
const sf = ts7.createSourceFile(configPath2, source, ts7.ScriptTarget.Latest, true, ts7.ScriptKind.TS);
|
|
12221
|
+
const configObject = findDefineConfigCall(sf);
|
|
12222
|
+
if (!configObject)
|
|
12223
|
+
return null;
|
|
12224
|
+
const angularField = findPropertyInitializer(configObject, "angular");
|
|
12225
|
+
if (!angularField || !ts7.isObjectLiteralExpression(angularField))
|
|
12226
|
+
return null;
|
|
12227
|
+
const providersField = findPropertyInitializer(angularField, "providers");
|
|
12228
|
+
if (!providersField)
|
|
12229
|
+
return null;
|
|
12230
|
+
if (!ts7.isIdentifier(providersField))
|
|
12231
|
+
return null;
|
|
12232
|
+
const binding = providersField.text;
|
|
12233
|
+
const importInfo = findImportForBinding(sf, binding);
|
|
12234
|
+
if (!importInfo)
|
|
12235
|
+
return null;
|
|
12236
|
+
const configDir2 = dirname14(configPath2);
|
|
12237
|
+
const absolutePath = importInfo.source.startsWith(".") ? join26(configDir2, importInfo.source).replace(/\.[cm]?[tj]sx?$/, "") : isAbsolute3(importInfo.source) ? importInfo.source.replace(/\.[cm]?[tj]sx?$/, "") : importInfo.source;
|
|
12238
|
+
return {
|
|
12239
|
+
absolutePath,
|
|
12240
|
+
bindingName: binding,
|
|
12241
|
+
importedName: importInfo.importedName
|
|
12242
|
+
};
|
|
12243
|
+
};
|
|
12244
|
+
var init_parseAngularConfigImports = () => {};
|
|
12245
|
+
|
|
12246
|
+
// src/build/scanAngularHandlerCalls.ts
|
|
12247
|
+
import { readdirSync as readdirSync3, readFileSync as readFileSync16 } from "fs";
|
|
12248
|
+
import { dirname as dirname15, isAbsolute as isAbsolute4, join as join27, resolve as resolve22 } from "path";
|
|
12249
|
+
import ts8 from "typescript";
|
|
12154
12250
|
var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (filePath) => {
|
|
12155
12251
|
if (filePath.endsWith(".tsx"))
|
|
12156
|
-
return
|
|
12157
|
-
return
|
|
12252
|
+
return ts8.ScriptKind.TSX;
|
|
12253
|
+
return ts8.ScriptKind.TS;
|
|
12158
12254
|
}, hasSourceExtension3 = (filePath) => {
|
|
12159
12255
|
const idx = filePath.lastIndexOf(".");
|
|
12160
12256
|
if (idx === -1)
|
|
@@ -12182,16 +12278,16 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
12182
12278
|
continue;
|
|
12183
12279
|
if (entry.name.startsWith("."))
|
|
12184
12280
|
continue;
|
|
12185
|
-
stack.push(
|
|
12281
|
+
stack.push(join27(dir, entry.name));
|
|
12186
12282
|
} else if (entry.isFile() && hasSourceExtension3(entry.name)) {
|
|
12187
|
-
out.push(
|
|
12283
|
+
out.push(join27(dir, entry.name));
|
|
12188
12284
|
}
|
|
12189
12285
|
}
|
|
12190
12286
|
}
|
|
12191
12287
|
return out;
|
|
12192
12288
|
}, fileMayContainAngularHandler = (source) => source.includes("handleAngularPageRequest"), collectFileImports = (sf, filePath) => {
|
|
12193
12289
|
const map = new Map;
|
|
12194
|
-
const fileDir =
|
|
12290
|
+
const fileDir = dirname15(filePath);
|
|
12195
12291
|
const recordSpec = (localName, spec) => {
|
|
12196
12292
|
map.set(localName, spec);
|
|
12197
12293
|
};
|
|
@@ -12199,15 +12295,15 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
12199
12295
|
if (specifier.startsWith(".")) {
|
|
12200
12296
|
return resolve22(fileDir, specifier);
|
|
12201
12297
|
}
|
|
12202
|
-
if (
|
|
12298
|
+
if (isAbsolute4(specifier)) {
|
|
12203
12299
|
return specifier;
|
|
12204
12300
|
}
|
|
12205
12301
|
return null;
|
|
12206
12302
|
};
|
|
12207
12303
|
for (const statement of sf.statements) {
|
|
12208
|
-
if (!
|
|
12304
|
+
if (!ts8.isImportDeclaration(statement))
|
|
12209
12305
|
continue;
|
|
12210
|
-
if (!
|
|
12306
|
+
if (!ts8.isStringLiteral(statement.moduleSpecifier))
|
|
12211
12307
|
continue;
|
|
12212
12308
|
if (statement.importClause?.isTypeOnly)
|
|
12213
12309
|
continue;
|
|
@@ -12228,7 +12324,7 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
12228
12324
|
const bindings = clause.namedBindings;
|
|
12229
12325
|
if (!bindings)
|
|
12230
12326
|
continue;
|
|
12231
|
-
if (
|
|
12327
|
+
if (ts8.isNamespaceImport(bindings)) {
|
|
12232
12328
|
recordSpec(bindings.name.text, {
|
|
12233
12329
|
importedName: "*",
|
|
12234
12330
|
isDefault: false,
|
|
@@ -12256,38 +12352,38 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
12256
12352
|
}, collectExpressionIdentifiers = (expr) => {
|
|
12257
12353
|
const out = new Set;
|
|
12258
12354
|
const visit = (node) => {
|
|
12259
|
-
if (
|
|
12355
|
+
if (ts8.isIdentifier(node)) {
|
|
12260
12356
|
out.add(node.text);
|
|
12261
12357
|
return;
|
|
12262
12358
|
}
|
|
12263
|
-
if (
|
|
12359
|
+
if (ts8.isPropertyAccessExpression(node)) {
|
|
12264
12360
|
visit(node.expression);
|
|
12265
12361
|
return;
|
|
12266
12362
|
}
|
|
12267
|
-
|
|
12363
|
+
ts8.forEachChild(node, visit);
|
|
12268
12364
|
};
|
|
12269
12365
|
visit(expr);
|
|
12270
12366
|
return out;
|
|
12271
12367
|
}, extractManifestKey = (pagePathValue) => {
|
|
12272
|
-
if (!
|
|
12368
|
+
if (!ts8.isCallExpression(pagePathValue))
|
|
12273
12369
|
return null;
|
|
12274
12370
|
const callee = pagePathValue.expression;
|
|
12275
|
-
if (!
|
|
12371
|
+
if (!ts8.isIdentifier(callee) || callee.text !== "asset")
|
|
12276
12372
|
return null;
|
|
12277
12373
|
const [, second] = pagePathValue.arguments;
|
|
12278
12374
|
if (!second)
|
|
12279
12375
|
return null;
|
|
12280
|
-
if (!
|
|
12376
|
+
if (!ts8.isStringLiteral(second))
|
|
12281
12377
|
return null;
|
|
12282
12378
|
return second.text;
|
|
12283
12379
|
}, findEnclosingMountPath = (node) => {
|
|
12284
12380
|
let cursor = node.parent;
|
|
12285
12381
|
while (cursor) {
|
|
12286
|
-
if (
|
|
12382
|
+
if (ts8.isCallExpression(cursor)) {
|
|
12287
12383
|
const callee = cursor.expression;
|
|
12288
|
-
if (
|
|
12384
|
+
if (ts8.isPropertyAccessExpression(callee) && ts8.isIdentifier(callee.name) && ELYSIA_ROUTE_METHODS2.has(callee.name.text)) {
|
|
12289
12385
|
const firstArg = cursor.arguments[0];
|
|
12290
|
-
if (firstArg &&
|
|
12386
|
+
if (firstArg && ts8.isStringLiteral(firstArg) && firstArg.text.startsWith("/")) {
|
|
12291
12387
|
return firstArg.text;
|
|
12292
12388
|
}
|
|
12293
12389
|
}
|
|
@@ -12298,37 +12394,37 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
12298
12394
|
}, extractCallsFromFile = (filePath, out) => {
|
|
12299
12395
|
let source;
|
|
12300
12396
|
try {
|
|
12301
|
-
source =
|
|
12397
|
+
source = readFileSync16(filePath, "utf-8");
|
|
12302
12398
|
} catch {
|
|
12303
12399
|
return;
|
|
12304
12400
|
}
|
|
12305
12401
|
if (!fileMayContainAngularHandler(source))
|
|
12306
12402
|
return;
|
|
12307
|
-
const sf =
|
|
12403
|
+
const sf = ts8.createSourceFile(filePath, source, ts8.ScriptTarget.Latest, true, getScriptKind2(filePath));
|
|
12308
12404
|
const imports = collectFileImports(sf, filePath);
|
|
12309
12405
|
const visit = (node) => {
|
|
12310
|
-
if (
|
|
12406
|
+
if (ts8.isCallExpression(node) && ts8.isIdentifier(node.expression) && node.expression.text === "handleAngularPageRequest") {
|
|
12311
12407
|
const [arg] = node.arguments;
|
|
12312
|
-
if (arg &&
|
|
12408
|
+
if (arg && ts8.isObjectLiteralExpression(arg)) {
|
|
12313
12409
|
let manifestKey = null;
|
|
12314
12410
|
let providersExpr = null;
|
|
12315
12411
|
for (const prop of arg.properties) {
|
|
12316
|
-
if (
|
|
12412
|
+
if (ts8.isPropertyAssignment(prop)) {
|
|
12317
12413
|
if (!prop.name)
|
|
12318
12414
|
continue;
|
|
12319
|
-
const name =
|
|
12415
|
+
const name = ts8.isIdentifier(prop.name) ? prop.name.text : ts8.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
12320
12416
|
if (name === "pagePath") {
|
|
12321
12417
|
manifestKey = extractManifestKey(prop.initializer);
|
|
12322
12418
|
} else if (name === "providers") {
|
|
12323
12419
|
providersExpr = prop.initializer;
|
|
12324
12420
|
}
|
|
12325
|
-
} else if (
|
|
12421
|
+
} else if (ts8.isSpreadAssignment(prop)) {
|
|
12326
12422
|
if (manifestKey)
|
|
12327
12423
|
continue;
|
|
12328
12424
|
const spreadExpr = prop.expression;
|
|
12329
|
-
if (
|
|
12425
|
+
if (ts8.isCallExpression(spreadExpr) && spreadExpr.arguments.length > 0) {
|
|
12330
12426
|
const [firstArg] = spreadExpr.arguments;
|
|
12331
|
-
if (firstArg &&
|
|
12427
|
+
if (firstArg && ts8.isStringLiteral(firstArg)) {
|
|
12332
12428
|
manifestKey = firstArg.text;
|
|
12333
12429
|
}
|
|
12334
12430
|
}
|
|
@@ -12356,9 +12452,9 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
12356
12452
|
}
|
|
12357
12453
|
}
|
|
12358
12454
|
}
|
|
12359
|
-
|
|
12455
|
+
ts8.forEachChild(node, visit);
|
|
12360
12456
|
};
|
|
12361
|
-
|
|
12457
|
+
ts8.forEachChild(sf, visit);
|
|
12362
12458
|
}, scanAngularHandlerCalls = (projectRoot) => {
|
|
12363
12459
|
const files = collectSourceFiles2(projectRoot);
|
|
12364
12460
|
const collected = [];
|
|
@@ -12398,10 +12494,11 @@ var exports_runAngularHandlerScan = {};
|
|
|
12398
12494
|
__export(exports_runAngularHandlerScan, {
|
|
12399
12495
|
runAngularHandlerScan: () => runAngularHandlerScan
|
|
12400
12496
|
});
|
|
12401
|
-
var runAngularHandlerScan = (projectRoot, angularDirectory
|
|
12497
|
+
var runAngularHandlerScan = (projectRoot, angularDirectory) => {
|
|
12402
12498
|
const calls = scanAngularHandlerCalls(projectRoot);
|
|
12403
12499
|
const pageRoutes = scanAngularPageRoutes(angularDirectory);
|
|
12404
|
-
const
|
|
12500
|
+
const providersImport = parseAngularProvidersImport(projectRoot);
|
|
12501
|
+
const providersFiles = emitAngularProvidersFiles(projectRoot, calls, pageRoutes, { providersImport });
|
|
12405
12502
|
emitAngularRouteMounts(projectRoot, calls);
|
|
12406
12503
|
return {
|
|
12407
12504
|
calls,
|
|
@@ -12413,6 +12510,7 @@ var runAngularHandlerScan = (projectRoot, angularDirectory, options = {}) => {
|
|
|
12413
12510
|
var init_runAngularHandlerScan = __esm(() => {
|
|
12414
12511
|
init_emitAngularProvidersFiles();
|
|
12415
12512
|
init_emitAngularRouteMounts();
|
|
12513
|
+
init_parseAngularConfigImports();
|
|
12416
12514
|
init_scanAngularHandlerCalls();
|
|
12417
12515
|
init_scanAngularPageRoutes();
|
|
12418
12516
|
});
|
|
@@ -12479,11 +12577,11 @@ __export(exports_compileSvelte, {
|
|
|
12479
12577
|
compileSvelte: () => compileSvelte,
|
|
12480
12578
|
clearSvelteCompilerCache: () => clearSvelteCompilerCache
|
|
12481
12579
|
});
|
|
12482
|
-
import { existsSync as
|
|
12580
|
+
import { existsSync as existsSync21 } from "fs";
|
|
12483
12581
|
import { mkdir as mkdir4, stat as stat2 } from "fs/promises";
|
|
12484
12582
|
import {
|
|
12485
|
-
dirname as
|
|
12486
|
-
join as
|
|
12583
|
+
dirname as dirname16,
|
|
12584
|
+
join as join28,
|
|
12487
12585
|
basename as basename7,
|
|
12488
12586
|
extname as extname5,
|
|
12489
12587
|
resolve as resolve23,
|
|
@@ -12495,11 +12593,11 @@ var {write: write2, file: file2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
|
12495
12593
|
var resolveDevClientDir2 = () => {
|
|
12496
12594
|
const projectRoot = process.cwd();
|
|
12497
12595
|
const fromSource = resolve23(import.meta.dir, "../dev/client");
|
|
12498
|
-
if (
|
|
12596
|
+
if (existsSync21(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
12499
12597
|
return fromSource;
|
|
12500
12598
|
}
|
|
12501
12599
|
const fromNodeModules = resolve23(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
12502
|
-
if (
|
|
12600
|
+
if (existsSync21(fromNodeModules))
|
|
12503
12601
|
return fromNodeModules;
|
|
12504
12602
|
return resolve23(import.meta.dir, "./dev/client");
|
|
12505
12603
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
@@ -12531,7 +12629,7 @@ var resolveDevClientDir2 = () => {
|
|
|
12531
12629
|
}, resolveRelativeModule2 = async (spec, from) => {
|
|
12532
12630
|
if (!spec.startsWith("."))
|
|
12533
12631
|
return null;
|
|
12534
|
-
const basePath = resolve23(
|
|
12632
|
+
const basePath = resolve23(dirname16(from), spec);
|
|
12535
12633
|
const candidates = [
|
|
12536
12634
|
basePath,
|
|
12537
12635
|
`${basePath}.ts`,
|
|
@@ -12542,14 +12640,14 @@ var resolveDevClientDir2 = () => {
|
|
|
12542
12640
|
`${basePath}.svelte`,
|
|
12543
12641
|
`${basePath}.svelte.ts`,
|
|
12544
12642
|
`${basePath}.svelte.js`,
|
|
12545
|
-
|
|
12546
|
-
|
|
12547
|
-
|
|
12548
|
-
|
|
12549
|
-
|
|
12550
|
-
|
|
12551
|
-
|
|
12552
|
-
|
|
12643
|
+
join28(basePath, "index.ts"),
|
|
12644
|
+
join28(basePath, "index.js"),
|
|
12645
|
+
join28(basePath, "index.mjs"),
|
|
12646
|
+
join28(basePath, "index.cjs"),
|
|
12647
|
+
join28(basePath, "index.json"),
|
|
12648
|
+
join28(basePath, "index.svelte"),
|
|
12649
|
+
join28(basePath, "index.svelte.ts"),
|
|
12650
|
+
join28(basePath, "index.svelte.js")
|
|
12553
12651
|
];
|
|
12554
12652
|
const checks = await Promise.all(candidates.map(exists));
|
|
12555
12653
|
return candidates.find((_2, index) => checks[index]) ?? null;
|
|
@@ -12558,7 +12656,7 @@ var resolveDevClientDir2 = () => {
|
|
|
12558
12656
|
const resolved = resolvePackageImport(spec);
|
|
12559
12657
|
return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
|
|
12560
12658
|
}
|
|
12561
|
-
const basePath = resolve23(
|
|
12659
|
+
const basePath = resolve23(dirname16(from), spec);
|
|
12562
12660
|
const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
|
|
12563
12661
|
if (!explicit) {
|
|
12564
12662
|
const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
|
|
@@ -12588,9 +12686,9 @@ var resolveDevClientDir2 = () => {
|
|
|
12588
12686
|
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev2 = false, stylePreprocessors) => {
|
|
12589
12687
|
const { compile, compileModule, preprocess } = await import("svelte/compiler");
|
|
12590
12688
|
const generatedDir = getFrameworkGeneratedDir("svelte");
|
|
12591
|
-
const clientDir =
|
|
12592
|
-
const indexDir =
|
|
12593
|
-
const serverDir =
|
|
12689
|
+
const clientDir = join28(generatedDir, "client");
|
|
12690
|
+
const indexDir = join28(generatedDir, "indexes");
|
|
12691
|
+
const serverDir = join28(generatedDir, "server");
|
|
12594
12692
|
await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir4(dir, { recursive: true })));
|
|
12595
12693
|
const dev = env2.NODE_ENV !== "production";
|
|
12596
12694
|
const build2 = async (src) => {
|
|
@@ -12602,7 +12700,7 @@ var resolveDevClientDir2 = () => {
|
|
|
12602
12700
|
const contentHash = Bun.hash(raw).toString(BASE_36_RADIX);
|
|
12603
12701
|
const prevHash = sourceHashCache.get(src);
|
|
12604
12702
|
const persistent = persistentCache.get(src);
|
|
12605
|
-
if (prevHash === contentHash && persistent &&
|
|
12703
|
+
if (prevHash === contentHash && persistent && existsSync21(persistent.ssr) && existsSync21(persistent.client)) {
|
|
12606
12704
|
cache.set(src, persistent);
|
|
12607
12705
|
return persistent;
|
|
12608
12706
|
}
|
|
@@ -12618,8 +12716,8 @@ var resolveDevClientDir2 = () => {
|
|
|
12618
12716
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
|
|
12619
12717
|
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedServer) : preprocessedServer;
|
|
12620
12718
|
const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedClient) : preprocessedClient;
|
|
12621
|
-
const rawRel =
|
|
12622
|
-
const relDir = rawRel.startsWith("..") ? `_ext/${relative11(process.cwd(),
|
|
12719
|
+
const rawRel = dirname16(relative11(svelteRoot, src)).replace(/\\/g, "/");
|
|
12720
|
+
const relDir = rawRel.startsWith("..") ? `_ext/${relative11(process.cwd(), dirname16(src)).replace(/\\/g, "/")}` : rawRel;
|
|
12623
12721
|
const baseName = basename7(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
12624
12722
|
const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
12625
12723
|
const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
|
|
@@ -12628,8 +12726,8 @@ var resolveDevClientDir2 = () => {
|
|
|
12628
12726
|
const childBuilt = await Promise.all(childSources.map((child) => build2(child)));
|
|
12629
12727
|
const hasAwaitSlotFromChildren = childBuilt.some((child) => child.hasAwaitSlot);
|
|
12630
12728
|
const externalRewrites = new Map;
|
|
12631
|
-
const ssrOutputDir =
|
|
12632
|
-
const clientOutputDir =
|
|
12729
|
+
const ssrOutputDir = dirname16(join28(serverDir, relDir, `${baseName}.js`));
|
|
12730
|
+
const clientOutputDir = dirname16(join28(clientDir, relDir, `${baseName}.js`));
|
|
12633
12731
|
for (let idx = 0;idx < importPaths.length; idx++) {
|
|
12634
12732
|
const rawSpec = importPaths[idx];
|
|
12635
12733
|
if (!rawSpec)
|
|
@@ -12694,11 +12792,11 @@ var resolveDevClientDir2 = () => {
|
|
|
12694
12792
|
code += islandMetadataExports;
|
|
12695
12793
|
return { code, map: compiledJs.map };
|
|
12696
12794
|
};
|
|
12697
|
-
const ssrPath =
|
|
12698
|
-
const clientPath =
|
|
12795
|
+
const ssrPath = join28(serverDir, relDir, `${baseName}.js`);
|
|
12796
|
+
const clientPath = join28(clientDir, relDir, `${baseName}.js`);
|
|
12699
12797
|
await Promise.all([
|
|
12700
|
-
mkdir4(
|
|
12701
|
-
mkdir4(
|
|
12798
|
+
mkdir4(dirname16(ssrPath), { recursive: true }),
|
|
12799
|
+
mkdir4(dirname16(clientPath), { recursive: true })
|
|
12702
12800
|
]);
|
|
12703
12801
|
const inlineMap = (map) => map ? `
|
|
12704
12802
|
//# sourceMappingURL=data:application/json;base64,${Buffer.from(JSON.stringify(map)).toString("base64")}
|
|
@@ -12731,10 +12829,10 @@ var resolveDevClientDir2 = () => {
|
|
|
12731
12829
|
};
|
|
12732
12830
|
const roots = await Promise.all(entryPoints.map(build2));
|
|
12733
12831
|
await Promise.all(roots.map(async ({ client: client2, hasAwaitSlot }) => {
|
|
12734
|
-
const relClientDir =
|
|
12832
|
+
const relClientDir = dirname16(relative11(clientDir, client2));
|
|
12735
12833
|
const name = basename7(client2, extname5(client2));
|
|
12736
|
-
const indexPath =
|
|
12737
|
-
const importRaw = relative11(
|
|
12834
|
+
const indexPath = join28(indexDir, relClientDir, `${name}.js`);
|
|
12835
|
+
const importRaw = relative11(dirname16(indexPath), client2).split(sep2).join("/");
|
|
12738
12836
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
12739
12837
|
const hmrImports = isDev2 ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
12740
12838
|
import "${hmrClientPath3}";
|
|
@@ -12805,14 +12903,14 @@ if (typeof window !== "undefined") {
|
|
|
12805
12903
|
setTimeout(releaseStreamingSlots, 0);
|
|
12806
12904
|
}
|
|
12807
12905
|
}`;
|
|
12808
|
-
await mkdir4(
|
|
12906
|
+
await mkdir4(dirname16(indexPath), { recursive: true });
|
|
12809
12907
|
return write2(indexPath, bootstrap);
|
|
12810
12908
|
}));
|
|
12811
12909
|
return {
|
|
12812
12910
|
svelteClientPaths: roots.map(({ client: client2 }) => client2),
|
|
12813
12911
|
svelteIndexPaths: roots.map(({ client: client2 }) => {
|
|
12814
|
-
const rel =
|
|
12815
|
-
return
|
|
12912
|
+
const rel = dirname16(relative11(clientDir, client2));
|
|
12913
|
+
return join28(indexDir, rel, basename7(client2));
|
|
12816
12914
|
}),
|
|
12817
12915
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
12818
12916
|
};
|
|
@@ -12827,7 +12925,7 @@ var init_compileSvelte = __esm(() => {
|
|
|
12827
12925
|
init_lowerAwaitSlotSyntax();
|
|
12828
12926
|
init_renderToReadableStream();
|
|
12829
12927
|
devClientDir2 = resolveDevClientDir2();
|
|
12830
|
-
hmrClientPath3 =
|
|
12928
|
+
hmrClientPath3 = join28(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
|
|
12831
12929
|
persistentCache = new Map;
|
|
12832
12930
|
sourceHashCache = new Map;
|
|
12833
12931
|
transpiler3 = new Transpiler2({ loader: "ts", target: "browser" });
|
|
@@ -12842,7 +12940,7 @@ __export(exports_chainInlineSourcemaps, {
|
|
|
12842
12940
|
chainBundleInlineSourcemap: () => chainBundleInlineSourcemap,
|
|
12843
12941
|
buildLineRemap: () => buildLineRemap
|
|
12844
12942
|
});
|
|
12845
|
-
import { readFileSync as
|
|
12943
|
+
import { readFileSync as readFileSync17, writeFileSync as writeFileSync10 } from "fs";
|
|
12846
12944
|
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", BASE64_TO_INT, decodeVlq = (str, startPos) => {
|
|
12847
12945
|
let result = 0;
|
|
12848
12946
|
let shift = 0;
|
|
@@ -13133,7 +13231,7 @@ var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567
|
|
|
13133
13231
|
version: 3
|
|
13134
13232
|
};
|
|
13135
13233
|
}, chainBundleInlineSourcemap = (bundleFilePath) => {
|
|
13136
|
-
const text =
|
|
13234
|
+
const text = readFileSync17(bundleFilePath, "utf-8");
|
|
13137
13235
|
const outerMap = extractInlineMap(text);
|
|
13138
13236
|
if (!outerMap)
|
|
13139
13237
|
return;
|
|
@@ -13219,13 +13317,13 @@ __export(exports_compileVue, {
|
|
|
13219
13317
|
compileVue: () => compileVue,
|
|
13220
13318
|
clearVueHmrCaches: () => clearVueHmrCaches
|
|
13221
13319
|
});
|
|
13222
|
-
import { existsSync as
|
|
13320
|
+
import { existsSync as existsSync22 } from "fs";
|
|
13223
13321
|
import { mkdir as mkdir5 } from "fs/promises";
|
|
13224
13322
|
import {
|
|
13225
13323
|
basename as basename8,
|
|
13226
|
-
dirname as
|
|
13227
|
-
isAbsolute as
|
|
13228
|
-
join as
|
|
13324
|
+
dirname as dirname17,
|
|
13325
|
+
isAbsolute as isAbsolute5,
|
|
13326
|
+
join as join29,
|
|
13229
13327
|
relative as relative12,
|
|
13230
13328
|
resolve as resolve24
|
|
13231
13329
|
} from "path";
|
|
@@ -13233,11 +13331,11 @@ var {file: file3, write: write3, Transpiler: Transpiler3 } = globalThis.Bun;
|
|
|
13233
13331
|
var resolveDevClientDir3 = () => {
|
|
13234
13332
|
const projectRoot = process.cwd();
|
|
13235
13333
|
const fromSource = resolve24(import.meta.dir, "../dev/client");
|
|
13236
|
-
if (
|
|
13334
|
+
if (existsSync22(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
13237
13335
|
return fromSource;
|
|
13238
13336
|
}
|
|
13239
13337
|
const fromNodeModules = resolve24(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
13240
|
-
if (
|
|
13338
|
+
if (existsSync22(fromNodeModules))
|
|
13241
13339
|
return fromNodeModules;
|
|
13242
13340
|
return resolve24(import.meta.dir, "./dev/client");
|
|
13243
13341
|
}, devClientDir3, hmrClientPath4, transpiler4, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
@@ -13321,7 +13419,7 @@ var resolveDevClientDir3 = () => {
|
|
|
13321
13419
|
const contentHash = Bun.hash(sourceContent).toString(BASE_36_RADIX);
|
|
13322
13420
|
const prevHash = vueSourceHashCache.get(sourceFilePath);
|
|
13323
13421
|
const persistent = persistentBuildCache.get(sourceFilePath);
|
|
13324
|
-
if (prevHash === contentHash && persistent &&
|
|
13422
|
+
if (prevHash === contentHash && persistent && existsSync22(persistent.clientPath) && existsSync22(persistent.serverPath)) {
|
|
13325
13423
|
cacheMap.set(sourceFilePath, persistent);
|
|
13326
13424
|
return persistent;
|
|
13327
13425
|
}
|
|
@@ -13349,12 +13447,12 @@ var resolveDevClientDir3 = () => {
|
|
|
13349
13447
|
const childComponentPaths = importPaths.filter((path) => path.startsWith(".") && path.endsWith(".vue"));
|
|
13350
13448
|
const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
|
|
13351
13449
|
const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue") && !isStylePath(path));
|
|
13352
|
-
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") ||
|
|
13450
|
+
const stylePathsImported = importPaths.filter((path) => (path.startsWith(".") || isAbsolute5(path)) && isStylePath(path)).map((path) => isAbsolute5(path) ? path : resolve24(dirname17(sourceFilePath), path));
|
|
13353
13451
|
for (const stylePath of stylePathsImported) {
|
|
13354
13452
|
addStyleImporter(sourceFilePath, stylePath);
|
|
13355
13453
|
}
|
|
13356
13454
|
const childBuildResults = await Promise.all([
|
|
13357
|
-
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve24(
|
|
13455
|
+
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve24(dirname17(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
|
|
13358
13456
|
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
|
|
13359
13457
|
]);
|
|
13360
13458
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
@@ -13364,7 +13462,7 @@ var resolveDevClientDir3 = () => {
|
|
|
13364
13462
|
sourceMap: true
|
|
13365
13463
|
}) : { bindings: {}, content: "export default {};", map: undefined };
|
|
13366
13464
|
const strippedScript = stripExports2(compiledScript.content);
|
|
13367
|
-
const sourceDir =
|
|
13465
|
+
const sourceDir = dirname17(sourceFilePath);
|
|
13368
13466
|
const transpiledScript = transpiler4.transformSync(strippedScript).replace(/(['"])(\.{1,2}\/[^'"]+)(['"])/g, (_2, quoteStart, relativeImport, quoteEnd) => `${quoteStart}${toJs(relativeImport, sourceDir)}${quoteEnd}`);
|
|
13369
13467
|
const packageImportRewrites = new Map;
|
|
13370
13468
|
for (const [bareImport, absolutePath] of packageComponentPaths) {
|
|
@@ -13403,8 +13501,8 @@ var resolveDevClientDir3 = () => {
|
|
|
13403
13501
|
];
|
|
13404
13502
|
let cssOutputPaths = [];
|
|
13405
13503
|
if (isEntryPoint && allCss.length) {
|
|
13406
|
-
const cssOutputFile =
|
|
13407
|
-
await mkdir5(
|
|
13504
|
+
const cssOutputFile = join29(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
|
|
13505
|
+
await mkdir5(dirname17(cssOutputFile), { recursive: true });
|
|
13408
13506
|
await write3(cssOutputFile, allCss.join(`
|
|
13409
13507
|
`));
|
|
13410
13508
|
cssOutputPaths = [cssOutputFile];
|
|
@@ -13434,9 +13532,9 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13434
13532
|
};
|
|
13435
13533
|
const clientCode = assembleModule(generateRenderFunction(false), "render", true) + islandMetadataExports;
|
|
13436
13534
|
const serverCode = assembleModule(generateRenderFunction(true), "ssrRender", false) + islandMetadataExports;
|
|
13437
|
-
const clientOutputPath =
|
|
13438
|
-
const serverOutputPath =
|
|
13439
|
-
const relDir =
|
|
13535
|
+
const clientOutputPath = join29(outputDirs.client, `${relativeWithoutExtension}.js`);
|
|
13536
|
+
const serverOutputPath = join29(outputDirs.server, `${relativeWithoutExtension}.js`);
|
|
13537
|
+
const relDir = dirname17(relativeFilePath);
|
|
13440
13538
|
const relDepth = relDir === "." ? 0 : relDir.split("/").length;
|
|
13441
13539
|
const adjustImports = (code) => code.replace(/(from\s+['"])(\.\.\/(?:\.\.\/)*)/g, (_2, prefix, dots) => {
|
|
13442
13540
|
const upCount = dots.split("/").length - 1;
|
|
@@ -13448,15 +13546,15 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13448
13546
|
let result2 = code;
|
|
13449
13547
|
for (const [bareImport, paths] of packageImportRewrites) {
|
|
13450
13548
|
const targetPath = mode === "server" ? paths.server : paths.client;
|
|
13451
|
-
let rel = relative12(
|
|
13549
|
+
let rel = relative12(dirname17(outputPath), targetPath).replace(/\\/g, "/");
|
|
13452
13550
|
if (!rel.startsWith("."))
|
|
13453
13551
|
rel = `./${rel}`;
|
|
13454
13552
|
result2 = result2.replaceAll(bareImport, rel);
|
|
13455
13553
|
}
|
|
13456
13554
|
return result2;
|
|
13457
13555
|
};
|
|
13458
|
-
await mkdir5(
|
|
13459
|
-
await mkdir5(
|
|
13556
|
+
await mkdir5(dirname17(clientOutputPath), { recursive: true });
|
|
13557
|
+
await mkdir5(dirname17(serverOutputPath), { recursive: true });
|
|
13460
13558
|
const clientFinal = rewritePackageImports(adjustImports(clientCode), clientOutputPath, "client");
|
|
13461
13559
|
const serverFinal = rewritePackageImports(adjustImports(serverCode), serverOutputPath, "server");
|
|
13462
13560
|
const inlineSourceMapFor = (finalContent) => {
|
|
@@ -13478,7 +13576,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13478
13576
|
hmrId,
|
|
13479
13577
|
serverPath: serverOutputPath,
|
|
13480
13578
|
tsHelperPaths: [
|
|
13481
|
-
...helperModulePaths.map((helper) => resolve24(
|
|
13579
|
+
...helperModulePaths.map((helper) => resolve24(dirname17(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
|
|
13482
13580
|
...childBuildResults.flatMap((child) => child.tsHelperPaths)
|
|
13483
13581
|
]
|
|
13484
13582
|
};
|
|
@@ -13488,10 +13586,10 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13488
13586
|
}, compileVue = async (entryPoints, vueRootDir, isDev2 = false, stylePreprocessors) => {
|
|
13489
13587
|
const compiler = await import("@vue/compiler-sfc");
|
|
13490
13588
|
const generatedDir = getFrameworkGeneratedDir("vue");
|
|
13491
|
-
const clientOutputDir =
|
|
13492
|
-
const indexOutputDir =
|
|
13493
|
-
const serverOutputDir =
|
|
13494
|
-
const cssOutputDir =
|
|
13589
|
+
const clientOutputDir = join29(generatedDir, "client");
|
|
13590
|
+
const indexOutputDir = join29(generatedDir, "indexes");
|
|
13591
|
+
const serverOutputDir = join29(generatedDir, "server");
|
|
13592
|
+
const cssOutputDir = join29(generatedDir, "compiled");
|
|
13495
13593
|
await Promise.all([
|
|
13496
13594
|
mkdir5(clientOutputDir, { recursive: true }),
|
|
13497
13595
|
mkdir5(indexOutputDir, { recursive: true }),
|
|
@@ -13508,16 +13606,16 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13508
13606
|
}, buildCache, true, vueRootDir, compiler, stylePreprocessors);
|
|
13509
13607
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
13510
13608
|
const entryBaseName = basename8(entryPath, ".vue");
|
|
13511
|
-
const indexOutputFile =
|
|
13512
|
-
const clientOutputFile =
|
|
13513
|
-
await mkdir5(
|
|
13609
|
+
const indexOutputFile = join29(indexOutputDir, `${entryBaseName}.js`);
|
|
13610
|
+
const clientOutputFile = join29(clientOutputDir, relative12(vueRootDir, entryPath).replace(/\\/g, "/").replace(/\.vue$/, ".js"));
|
|
13611
|
+
await mkdir5(dirname17(indexOutputFile), { recursive: true });
|
|
13514
13612
|
const vueHmrImports = isDev2 ? [
|
|
13515
13613
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
13516
13614
|
`import "${hmrClientPath4}";`
|
|
13517
13615
|
] : [];
|
|
13518
13616
|
await write3(indexOutputFile, [
|
|
13519
13617
|
...vueHmrImports,
|
|
13520
|
-
`import Comp, * as PageModule from "${relative12(
|
|
13618
|
+
`import Comp, * as PageModule from "${relative12(dirname17(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
13521
13619
|
'import { createSSRApp, createApp } from "vue";',
|
|
13522
13620
|
"",
|
|
13523
13621
|
"// HMR State Preservation: Check for preserved state from HMR",
|
|
@@ -13662,10 +13760,10 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13662
13760
|
const sourceCode = await file3(tsPath).text();
|
|
13663
13761
|
const transpiledCode = transpiler4.transformSync(sourceCode);
|
|
13664
13762
|
const relativeJsPath = relative12(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
13665
|
-
const outClientPath =
|
|
13666
|
-
const outServerPath =
|
|
13667
|
-
await mkdir5(
|
|
13668
|
-
await mkdir5(
|
|
13763
|
+
const outClientPath = join29(clientOutputDir, relativeJsPath);
|
|
13764
|
+
const outServerPath = join29(serverOutputDir, relativeJsPath);
|
|
13765
|
+
await mkdir5(dirname17(outClientPath), { recursive: true });
|
|
13766
|
+
await mkdir5(dirname17(outServerPath), { recursive: true });
|
|
13669
13767
|
await write3(outClientPath, transpiledCode);
|
|
13670
13768
|
await write3(outServerPath, transpiledCode);
|
|
13671
13769
|
}));
|
|
@@ -13686,7 +13784,7 @@ var init_compileVue = __esm(() => {
|
|
|
13686
13784
|
init_vueAutoRouterTransform();
|
|
13687
13785
|
init_stylePreprocessor();
|
|
13688
13786
|
devClientDir3 = resolveDevClientDir3();
|
|
13689
|
-
hmrClientPath4 =
|
|
13787
|
+
hmrClientPath4 = join29(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
|
|
13690
13788
|
transpiler4 = new Transpiler3({ loader: "ts", target: "browser" });
|
|
13691
13789
|
scriptCache = new Map;
|
|
13692
13790
|
scriptSetupCache = new Map;
|
|
@@ -14167,17 +14265,17 @@ __export(exports_compileAngular, {
|
|
|
14167
14265
|
compileAngularFile: () => compileAngularFile,
|
|
14168
14266
|
compileAngular: () => compileAngular
|
|
14169
14267
|
});
|
|
14170
|
-
import { existsSync as
|
|
14171
|
-
import { join as
|
|
14268
|
+
import { existsSync as existsSync23, readFileSync as readFileSync18, promises as fs5 } from "fs";
|
|
14269
|
+
import { join as join30, basename as basename9, sep as sep3, dirname as dirname18, resolve as resolve25, relative as relative13 } from "path";
|
|
14172
14270
|
var {Glob: Glob6 } = globalThis.Bun;
|
|
14173
|
-
import
|
|
14271
|
+
import ts9 from "typescript";
|
|
14174
14272
|
var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
14175
14273
|
const tracePhase = globalThis.__absoluteBuildTracePhase;
|
|
14176
14274
|
return tracePhase ? tracePhase(`compile/angular/${name}`, fn2, metadata2) : await fn2();
|
|
14177
14275
|
}, readTsconfigPathAliases = () => {
|
|
14178
14276
|
try {
|
|
14179
14277
|
const configPath2 = resolve25(process.cwd(), "tsconfig.json");
|
|
14180
|
-
const config =
|
|
14278
|
+
const config = ts9.readConfigFile(configPath2, ts9.sys.readFile).config;
|
|
14181
14279
|
const compilerOptions = config?.compilerOptions ?? {};
|
|
14182
14280
|
const baseUrl = resolve25(process.cwd(), compilerOptions.baseUrl ?? ".");
|
|
14183
14281
|
const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
|
|
@@ -14211,12 +14309,12 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14211
14309
|
`${candidate}.tsx`,
|
|
14212
14310
|
`${candidate}.js`,
|
|
14213
14311
|
`${candidate}.jsx`,
|
|
14214
|
-
|
|
14215
|
-
|
|
14216
|
-
|
|
14217
|
-
|
|
14312
|
+
join30(candidate, "index.ts"),
|
|
14313
|
+
join30(candidate, "index.tsx"),
|
|
14314
|
+
join30(candidate, "index.js"),
|
|
14315
|
+
join30(candidate, "index.jsx")
|
|
14218
14316
|
];
|
|
14219
|
-
return candidates.find((file4) =>
|
|
14317
|
+
return candidates.find((file4) => existsSync23(file4));
|
|
14220
14318
|
}, createLegacyAngularAnimationUsageResolver = (rootDir) => {
|
|
14221
14319
|
const baseDir = resolve25(rootDir);
|
|
14222
14320
|
const tsconfigAliases = readTsconfigPathAliases();
|
|
@@ -14286,7 +14384,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14286
14384
|
if (scan.usesLegacyAnimations)
|
|
14287
14385
|
return true;
|
|
14288
14386
|
for (const specifier of scan.imports) {
|
|
14289
|
-
const importedPath = resolveLocalImport(specifier,
|
|
14387
|
+
const importedPath = resolveLocalImport(specifier, dirname18(resolved));
|
|
14290
14388
|
if (importedPath && await visit(importedPath, visited)) {
|
|
14291
14389
|
return true;
|
|
14292
14390
|
}
|
|
@@ -14297,16 +14395,16 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14297
14395
|
}, resolveDevClientDir4 = () => {
|
|
14298
14396
|
const projectRoot = process.cwd();
|
|
14299
14397
|
const fromSource = resolve25(import.meta.dir, "../dev/client");
|
|
14300
|
-
if (
|
|
14398
|
+
if (existsSync23(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
14301
14399
|
return fromSource;
|
|
14302
14400
|
}
|
|
14303
14401
|
const fromNodeModules = resolve25(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
14304
|
-
if (
|
|
14402
|
+
if (existsSync23(fromNodeModules))
|
|
14305
14403
|
return fromNodeModules;
|
|
14306
14404
|
return resolve25(import.meta.dir, "./dev/client");
|
|
14307
14405
|
}, devClientDir4, hmrClientPath5, formatDiagnosticMessage = (diagnostic) => {
|
|
14308
14406
|
try {
|
|
14309
|
-
return
|
|
14407
|
+
return ts9.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
14310
14408
|
`);
|
|
14311
14409
|
} catch {
|
|
14312
14410
|
return String(diagnostic.messageText || "Unknown error");
|
|
@@ -14314,7 +14412,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14314
14412
|
}, throwOnCompilationErrors = (diagnostics) => {
|
|
14315
14413
|
if (!diagnostics?.length)
|
|
14316
14414
|
return;
|
|
14317
|
-
const errors = diagnostics.filter((diag) => diag.category ===
|
|
14415
|
+
const errors = diagnostics.filter((diag) => diag.category === ts9.DiagnosticCategory.Error);
|
|
14318
14416
|
if (!errors.length)
|
|
14319
14417
|
return;
|
|
14320
14418
|
const fullMessage = errors.map(formatDiagnosticMessage).join(`
|
|
@@ -14345,51 +14443,51 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14345
14443
|
return `${path.replace(/\.ts$/, ".js")}${query}`;
|
|
14346
14444
|
if (hasJsLikeExtension(path))
|
|
14347
14445
|
return `${path}${query}`;
|
|
14348
|
-
const importerDir =
|
|
14446
|
+
const importerDir = dirname18(importerOutputPath);
|
|
14349
14447
|
const fileCandidate = resolve25(importerDir, `${path}.js`);
|
|
14350
|
-
if (outputFiles?.has(fileCandidate) ||
|
|
14448
|
+
if (outputFiles?.has(fileCandidate) || existsSync23(fileCandidate)) {
|
|
14351
14449
|
return `${path}.js${query}`;
|
|
14352
14450
|
}
|
|
14353
14451
|
const indexCandidate = resolve25(importerDir, path, "index.js");
|
|
14354
|
-
if (outputFiles?.has(indexCandidate) ||
|
|
14452
|
+
if (outputFiles?.has(indexCandidate) || existsSync23(indexCandidate)) {
|
|
14355
14453
|
return `${path}/index.js${query}`;
|
|
14356
14454
|
}
|
|
14357
14455
|
return `${path}.js${query}`;
|
|
14358
14456
|
}, isRelativeModuleSpecifier = (specifier) => specifier.startsWith("./") || specifier.startsWith("../"), extractLocalImportSpecifiers = (source, fileName) => {
|
|
14359
|
-
const sourceFile =
|
|
14457
|
+
const sourceFile = ts9.createSourceFile(fileName, source, ts9.ScriptTarget.Latest, true, ts9.ScriptKind.TS);
|
|
14360
14458
|
const specifiers = [];
|
|
14361
14459
|
const addSpecifier = (node) => {
|
|
14362
|
-
if (!node || !
|
|
14460
|
+
if (!node || !ts9.isStringLiteralLike(node))
|
|
14363
14461
|
return;
|
|
14364
14462
|
const specifier = node.text;
|
|
14365
14463
|
if (isRelativeModuleSpecifier(specifier))
|
|
14366
14464
|
specifiers.push(specifier);
|
|
14367
14465
|
};
|
|
14368
14466
|
const visit = (node) => {
|
|
14369
|
-
if (
|
|
14467
|
+
if (ts9.isImportDeclaration(node) || ts9.isExportDeclaration(node)) {
|
|
14370
14468
|
addSpecifier(node.moduleSpecifier);
|
|
14371
|
-
} else if (
|
|
14469
|
+
} else if (ts9.isCallExpression(node) && node.expression.kind === ts9.SyntaxKind.ImportKeyword) {
|
|
14372
14470
|
addSpecifier(node.arguments[0]);
|
|
14373
14471
|
}
|
|
14374
|
-
|
|
14472
|
+
ts9.forEachChild(node, visit);
|
|
14375
14473
|
};
|
|
14376
14474
|
visit(sourceFile);
|
|
14377
14475
|
return specifiers;
|
|
14378
14476
|
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
14379
14477
|
if (!isRelativeModuleSpecifier(specifier))
|
|
14380
14478
|
return null;
|
|
14381
|
-
const basePath = resolve25(
|
|
14479
|
+
const basePath = resolve25(dirname18(fromFile), specifier);
|
|
14382
14480
|
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
14383
14481
|
`${basePath}.ts`,
|
|
14384
14482
|
`${basePath}.tsx`,
|
|
14385
14483
|
`${basePath}.mts`,
|
|
14386
14484
|
`${basePath}.cts`,
|
|
14387
|
-
|
|
14388
|
-
|
|
14389
|
-
|
|
14390
|
-
|
|
14485
|
+
join30(basePath, "index.ts"),
|
|
14486
|
+
join30(basePath, "index.tsx"),
|
|
14487
|
+
join30(basePath, "index.mts"),
|
|
14488
|
+
join30(basePath, "index.cts")
|
|
14391
14489
|
];
|
|
14392
|
-
return candidates.map((candidate) => resolve25(candidate)).find((candidate) =>
|
|
14490
|
+
return candidates.map((candidate) => resolve25(candidate)).find((candidate) => existsSync23(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
14393
14491
|
}, readFileForAotTransform = async (fileName, readFile6) => {
|
|
14394
14492
|
const hostSource = readFile6?.(fileName);
|
|
14395
14493
|
if (typeof hostSource === "string")
|
|
@@ -14413,15 +14511,15 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14413
14511
|
const paths = [];
|
|
14414
14512
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14415
14513
|
if (templateUrlMatch?.[1])
|
|
14416
|
-
paths.push(
|
|
14514
|
+
paths.push(join30(fileDir, templateUrlMatch[1]));
|
|
14417
14515
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14418
14516
|
if (styleUrlMatch?.[1])
|
|
14419
|
-
paths.push(
|
|
14517
|
+
paths.push(join30(fileDir, styleUrlMatch[1]));
|
|
14420
14518
|
const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
14421
14519
|
const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
|
|
14422
14520
|
if (urlMatches) {
|
|
14423
14521
|
for (const urlMatch of urlMatches) {
|
|
14424
|
-
paths.push(
|
|
14522
|
+
paths.push(join30(fileDir, urlMatch.replace(/['"]/g, "")));
|
|
14425
14523
|
}
|
|
14426
14524
|
}
|
|
14427
14525
|
return paths.map((path) => resolve25(path));
|
|
@@ -14436,13 +14534,13 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14436
14534
|
return null;
|
|
14437
14535
|
}
|
|
14438
14536
|
}, writeResourceCacheFile = async (cachePath, source) => {
|
|
14439
|
-
await fs5.mkdir(
|
|
14537
|
+
await fs5.mkdir(dirname18(cachePath), { recursive: true });
|
|
14440
14538
|
await fs5.writeFile(cachePath, JSON.stringify({
|
|
14441
14539
|
source,
|
|
14442
14540
|
version: 1
|
|
14443
14541
|
}), "utf-8");
|
|
14444
14542
|
}, resolveResourceTransformCachePath = async (filePath, source, stylePreprocessors) => {
|
|
14445
|
-
const resourcePaths = collectAngularResourcePaths(source,
|
|
14543
|
+
const resourcePaths = collectAngularResourcePaths(source, dirname18(filePath));
|
|
14446
14544
|
const resourceContents = await Promise.all(resourcePaths.map(async (resourcePath) => {
|
|
14447
14545
|
const content = await fs5.readFile(resourcePath, "utf-8");
|
|
14448
14546
|
return `${resourcePath}\x00${content}`;
|
|
@@ -14455,7 +14553,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14455
14553
|
safeStableStringify(stylePreprocessors ?? null)
|
|
14456
14554
|
].join("\x00");
|
|
14457
14555
|
const cacheKey2 = Bun.hash(cacheInput).toString(BASE_36_RADIX);
|
|
14458
|
-
return
|
|
14556
|
+
return join30(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
|
|
14459
14557
|
}, precomputeAotResourceTransforms = async (inputPaths, readFile6, stylePreprocessors) => {
|
|
14460
14558
|
const transformedSources = new Map;
|
|
14461
14559
|
const visited = new Set;
|
|
@@ -14470,7 +14568,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14470
14568
|
if (visited.has(resolvedPath))
|
|
14471
14569
|
return;
|
|
14472
14570
|
visited.add(resolvedPath);
|
|
14473
|
-
if (!
|
|
14571
|
+
if (!existsSync23(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
14474
14572
|
return;
|
|
14475
14573
|
stats.filesVisited += 1;
|
|
14476
14574
|
const source = await readFileForAotTransform(resolvedPath, readFile6);
|
|
@@ -14482,7 +14580,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14482
14580
|
transformedSource = cached.source;
|
|
14483
14581
|
} else {
|
|
14484
14582
|
stats.cacheMisses += 1;
|
|
14485
|
-
const transformed = await inlineResources(source,
|
|
14583
|
+
const transformed = await inlineResources(source, dirname18(resolvedPath), stylePreprocessors);
|
|
14486
14584
|
transformedSource = transformed.source;
|
|
14487
14585
|
await writeResourceCacheFile(cachePath, transformedSource);
|
|
14488
14586
|
}
|
|
@@ -14501,17 +14599,17 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14501
14599
|
return { stats, transformedSources };
|
|
14502
14600
|
}, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
|
|
14503
14601
|
const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
|
|
14504
|
-
const outputPath = resolve25(
|
|
14602
|
+
const outputPath = resolve25(join30(outDir, relative13(process.cwd(), resolve25(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
14505
14603
|
return [
|
|
14506
14604
|
outputPath,
|
|
14507
|
-
buildIslandMetadataExports(
|
|
14605
|
+
buildIslandMetadataExports(readFileSync18(inputPath, "utf-8"))
|
|
14508
14606
|
];
|
|
14509
14607
|
})), { entries: inputPaths.length });
|
|
14510
14608
|
await traceAngularPhase("aot/preload-compiler", () => import("@angular/compiler"));
|
|
14511
14609
|
const { readConfiguration, performCompilation, EmitFlags } = await traceAngularPhase("aot/import-compiler-cli", () => import("@angular/compiler-cli"));
|
|
14512
14610
|
const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
|
|
14513
14611
|
const tsPath = __require.resolve("typescript");
|
|
14514
|
-
const tsRootDir =
|
|
14612
|
+
const tsRootDir = dirname18(tsPath);
|
|
14515
14613
|
return tsRootDir.endsWith("lib") ? tsRootDir : resolve25(tsRootDir, "lib");
|
|
14516
14614
|
});
|
|
14517
14615
|
const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
|
|
@@ -14519,25 +14617,25 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14519
14617
|
emitDecoratorMetadata: true,
|
|
14520
14618
|
esModuleInterop: true,
|
|
14521
14619
|
experimentalDecorators: true,
|
|
14522
|
-
module:
|
|
14523
|
-
moduleResolution:
|
|
14524
|
-
newLine:
|
|
14620
|
+
module: ts9.ModuleKind.ESNext,
|
|
14621
|
+
moduleResolution: ts9.ModuleResolutionKind.Bundler,
|
|
14622
|
+
newLine: ts9.NewLineKind.LineFeed,
|
|
14525
14623
|
noLib: false,
|
|
14526
14624
|
outDir,
|
|
14527
14625
|
skipLibCheck: true,
|
|
14528
|
-
target:
|
|
14626
|
+
target: ts9.ScriptTarget.ES2022,
|
|
14529
14627
|
...config.options
|
|
14530
14628
|
};
|
|
14531
|
-
options.target =
|
|
14629
|
+
options.target = ts9.ScriptTarget.ES2022;
|
|
14532
14630
|
options.experimentalDecorators = true;
|
|
14533
14631
|
options.emitDecoratorMetadata = true;
|
|
14534
|
-
options.newLine =
|
|
14632
|
+
options.newLine = ts9.NewLineKind.LineFeed;
|
|
14535
14633
|
options.outDir = outDir;
|
|
14536
14634
|
options.noEmit = false;
|
|
14537
14635
|
options.incremental = false;
|
|
14538
14636
|
options.tsBuildInfoFile = undefined;
|
|
14539
14637
|
options.rootDir = process.cwd();
|
|
14540
|
-
const host = await traceAngularPhase("aot/create-compiler-host", () =>
|
|
14638
|
+
const host = await traceAngularPhase("aot/create-compiler-host", () => ts9.createCompilerHost(options));
|
|
14541
14639
|
const originalGetDefaultLibLocation = host.getDefaultLibLocation;
|
|
14542
14640
|
host.getDefaultLibLocation = () => tsLibDir || (originalGetDefaultLibLocation ? originalGetDefaultLibLocation() : "");
|
|
14543
14641
|
const originalGetDefaultLibFileName = host.getDefaultLibFileName;
|
|
@@ -14548,7 +14646,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14548
14646
|
const originalGetSourceFile = host.getSourceFile;
|
|
14549
14647
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
14550
14648
|
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
14551
|
-
const resolvedPath =
|
|
14649
|
+
const resolvedPath = join30(tsLibDir, fileName);
|
|
14552
14650
|
return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
|
|
14553
14651
|
}
|
|
14554
14652
|
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
@@ -14583,7 +14681,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14583
14681
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
14584
14682
|
const source = transformedSources.get(resolve25(fileName));
|
|
14585
14683
|
if (source) {
|
|
14586
|
-
return
|
|
14684
|
+
return ts9.createSourceFile(fileName, source, languageVersion, true);
|
|
14587
14685
|
}
|
|
14588
14686
|
return originalGetSourceFileForCompile?.call(host, fileName, languageVersion, onError);
|
|
14589
14687
|
};
|
|
@@ -14603,7 +14701,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14603
14701
|
const entries = await traceAngularPhase("aot/postprocess-emitted-js", () => {
|
|
14604
14702
|
const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
|
|
14605
14703
|
content,
|
|
14606
|
-
target:
|
|
14704
|
+
target: join30(outDir, fileName)
|
|
14607
14705
|
}));
|
|
14608
14706
|
const outputFiles = new Set(rawEntries.map(({ target }) => resolve25(target)));
|
|
14609
14707
|
return rawEntries.map(({ content, target }) => {
|
|
@@ -14625,7 +14723,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14625
14723
|
});
|
|
14626
14724
|
});
|
|
14627
14725
|
await traceAngularPhase("aot/write-output", () => Promise.all(entries.map(async ({ target, content }) => {
|
|
14628
|
-
await fs5.mkdir(
|
|
14726
|
+
await fs5.mkdir(dirname18(target), { recursive: true });
|
|
14629
14727
|
await fs5.writeFile(target, content, "utf-8");
|
|
14630
14728
|
})), { outputs: entries.length });
|
|
14631
14729
|
return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
|
|
@@ -14644,7 +14742,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14644
14742
|
return null;
|
|
14645
14743
|
}, resolveAngularDeferImportSpecifier = () => {
|
|
14646
14744
|
const sourceEntry = resolve25(import.meta.dir, "../angular/components/index.ts");
|
|
14647
|
-
if (
|
|
14745
|
+
if (existsSync23(sourceEntry)) {
|
|
14648
14746
|
return sourceEntry.replace(/\\/g, "/");
|
|
14649
14747
|
}
|
|
14650
14748
|
return "@absolutejs/absolute/angular/components";
|
|
@@ -14772,7 +14870,7 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
14772
14870
|
${fields}
|
|
14773
14871
|
`);
|
|
14774
14872
|
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
14775
|
-
if (!
|
|
14873
|
+
if (!existsSync23(filePath)) {
|
|
14776
14874
|
throw new Error(`Unable to inline Angular style resource: file not found at ${filePath}`);
|
|
14777
14875
|
}
|
|
14778
14876
|
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
@@ -14780,8 +14878,8 @@ ${fields}
|
|
|
14780
14878
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
14781
14879
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14782
14880
|
if (templateUrlMatch?.[1]) {
|
|
14783
|
-
const templatePath =
|
|
14784
|
-
if (!
|
|
14881
|
+
const templatePath = join30(fileDir, templateUrlMatch[1]);
|
|
14882
|
+
if (!existsSync23(templatePath)) {
|
|
14785
14883
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
14786
14884
|
}
|
|
14787
14885
|
const templateRaw2 = await fs5.readFile(templatePath, "utf-8");
|
|
@@ -14811,11 +14909,11 @@ ${fields}
|
|
|
14811
14909
|
}, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
|
|
14812
14910
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14813
14911
|
if (templateUrlMatch?.[1]) {
|
|
14814
|
-
const templatePath =
|
|
14815
|
-
if (!
|
|
14912
|
+
const templatePath = join30(fileDir, templateUrlMatch[1]);
|
|
14913
|
+
if (!existsSync23(templatePath)) {
|
|
14816
14914
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
14817
14915
|
}
|
|
14818
|
-
const templateRaw2 =
|
|
14916
|
+
const templateRaw2 = readFileSync18(templatePath, "utf-8");
|
|
14819
14917
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
14820
14918
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
14821
14919
|
const replacedSource2 = source.slice(0, templateUrlMatch.index) + `template: \`${escaped2}\`` + source.slice(templateUrlMatch.index + templateUrlMatch[0].length);
|
|
@@ -14848,7 +14946,7 @@ ${fields}
|
|
|
14848
14946
|
return source;
|
|
14849
14947
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
14850
14948
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
14851
|
-
return readAndEscapeFile(
|
|
14949
|
+
return readAndEscapeFile(join30(fileDir, styleUrl), stylePreprocessors);
|
|
14852
14950
|
});
|
|
14853
14951
|
const results = await Promise.all(stylePromises);
|
|
14854
14952
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
@@ -14859,7 +14957,7 @@ ${fields}
|
|
|
14859
14957
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14860
14958
|
if (!styleUrlMatch?.[1])
|
|
14861
14959
|
return source;
|
|
14862
|
-
const escaped = await readAndEscapeFile(
|
|
14960
|
+
const escaped = await readAndEscapeFile(join30(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
14863
14961
|
if (!escaped)
|
|
14864
14962
|
return source;
|
|
14865
14963
|
return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
|
|
@@ -14895,12 +14993,12 @@ ${fields}
|
|
|
14895
14993
|
`${candidate}.js`,
|
|
14896
14994
|
`${candidate}.jsx`,
|
|
14897
14995
|
`${candidate}.json`,
|
|
14898
|
-
|
|
14899
|
-
|
|
14900
|
-
|
|
14901
|
-
|
|
14996
|
+
join30(candidate, "index.ts"),
|
|
14997
|
+
join30(candidate, "index.tsx"),
|
|
14998
|
+
join30(candidate, "index.js"),
|
|
14999
|
+
join30(candidate, "index.jsx")
|
|
14902
15000
|
];
|
|
14903
|
-
return candidates.find((file4) =>
|
|
15001
|
+
return candidates.find((file4) => existsSync23(file4));
|
|
14904
15002
|
};
|
|
14905
15003
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
14906
15004
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
@@ -14922,10 +15020,10 @@ ${fields}
|
|
|
14922
15020
|
}
|
|
14923
15021
|
};
|
|
14924
15022
|
const toOutputPath = (sourcePath) => {
|
|
14925
|
-
const inputDir =
|
|
15023
|
+
const inputDir = dirname18(sourcePath);
|
|
14926
15024
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
14927
15025
|
const fileBase = basename9(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
14928
|
-
return
|
|
15026
|
+
return join30(outDir, relativeDir, fileBase);
|
|
14929
15027
|
};
|
|
14930
15028
|
const withCacheBuster = (specifier) => {
|
|
14931
15029
|
if (!cacheBuster)
|
|
@@ -14972,11 +15070,11 @@ ${fields}
|
|
|
14972
15070
|
if (visited.has(resolved))
|
|
14973
15071
|
return;
|
|
14974
15072
|
visited.add(resolved);
|
|
14975
|
-
if (resolved.endsWith(".json") &&
|
|
14976
|
-
const inputDir2 =
|
|
15073
|
+
if (resolved.endsWith(".json") && existsSync23(resolved)) {
|
|
15074
|
+
const inputDir2 = dirname18(resolved);
|
|
14977
15075
|
const relativeDir2 = inputDir2.startsWith(baseDir) ? inputDir2.substring(baseDir.length + 1) : inputDir2;
|
|
14978
|
-
const targetDir2 =
|
|
14979
|
-
const targetPath2 =
|
|
15076
|
+
const targetDir2 = join30(outDir, relativeDir2);
|
|
15077
|
+
const targetPath2 = join30(targetDir2, basename9(resolved));
|
|
14980
15078
|
await fs5.mkdir(targetDir2, { recursive: true });
|
|
14981
15079
|
await fs5.copyFile(resolved, targetPath2);
|
|
14982
15080
|
allOutputs.push(targetPath2);
|
|
@@ -14985,15 +15083,15 @@ ${fields}
|
|
|
14985
15083
|
let actualPath = resolved;
|
|
14986
15084
|
if (!actualPath.endsWith(".ts"))
|
|
14987
15085
|
actualPath += ".ts";
|
|
14988
|
-
if (!
|
|
15086
|
+
if (!existsSync23(actualPath))
|
|
14989
15087
|
return;
|
|
14990
15088
|
let sourceCode = await fs5.readFile(actualPath, "utf-8");
|
|
14991
|
-
const inlined = await inlineResources(sourceCode,
|
|
14992
|
-
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source,
|
|
14993
|
-
const inputDir =
|
|
15089
|
+
const inlined = await inlineResources(sourceCode, dirname18(actualPath), stylePreprocessors);
|
|
15090
|
+
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname18(actualPath)).source;
|
|
15091
|
+
const inputDir = dirname18(actualPath);
|
|
14994
15092
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
14995
15093
|
const fileBase = basename9(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
14996
|
-
const targetDir =
|
|
15094
|
+
const targetDir = join30(outDir, relativeDir);
|
|
14997
15095
|
const targetPath = toOutputPath(actualPath);
|
|
14998
15096
|
const localImports = [];
|
|
14999
15097
|
const importRewrites = new Map;
|
|
@@ -15023,7 +15121,7 @@ ${fields}
|
|
|
15023
15121
|
const isEntry = resolve25(actualPath) === resolve25(entryPath);
|
|
15024
15122
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
15025
15123
|
const cacheKey2 = actualPath;
|
|
15026
|
-
const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey2) !== contentHash || !
|
|
15124
|
+
const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey2) !== contentHash || !existsSync23(targetPath);
|
|
15027
15125
|
if (shouldWriteFile) {
|
|
15028
15126
|
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath, importRewrites);
|
|
15029
15127
|
await fs5.mkdir(targetDir, { recursive: true });
|
|
@@ -15035,7 +15133,7 @@ ${fields}
|
|
|
15035
15133
|
};
|
|
15036
15134
|
await transpileFile(inputPath);
|
|
15037
15135
|
const entryOutputPath = toOutputPath(entryPath);
|
|
15038
|
-
if (
|
|
15136
|
+
if (existsSync23(entryOutputPath)) {
|
|
15039
15137
|
const entryOutput = await fs5.readFile(entryOutputPath, "utf-8");
|
|
15040
15138
|
const withoutLegacyFlag = entryOutput.replace(/\nexport const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;\n?/g, `
|
|
15041
15139
|
`);
|
|
@@ -15054,24 +15152,24 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
15054
15152
|
return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
|
|
15055
15153
|
}
|
|
15056
15154
|
const compiledRoot = compiledParent;
|
|
15057
|
-
const indexesDir =
|
|
15155
|
+
const indexesDir = join30(compiledParent, "indexes");
|
|
15058
15156
|
await traceAngularPhase("setup/create-indexes-dir", () => fs5.mkdir(indexesDir, { recursive: true }));
|
|
15059
15157
|
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve25(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
|
|
15060
15158
|
if (!hmr) {
|
|
15061
15159
|
await traceAngularPhase("aot/copy-json-resources", async () => {
|
|
15062
15160
|
const cwd = process.cwd();
|
|
15063
15161
|
const angularSrcDir = resolve25(outRoot);
|
|
15064
|
-
if (!
|
|
15162
|
+
if (!existsSync23(angularSrcDir))
|
|
15065
15163
|
return;
|
|
15066
15164
|
const jsonGlob = new Glob6("**/*.json");
|
|
15067
15165
|
for (const rel of jsonGlob.scanSync({
|
|
15068
15166
|
absolute: false,
|
|
15069
15167
|
cwd: angularSrcDir
|
|
15070
15168
|
})) {
|
|
15071
|
-
const sourcePath =
|
|
15169
|
+
const sourcePath = join30(angularSrcDir, rel);
|
|
15072
15170
|
const cwdRel = relative13(cwd, sourcePath);
|
|
15073
|
-
const targetPath =
|
|
15074
|
-
await fs5.mkdir(
|
|
15171
|
+
const targetPath = join30(compiledRoot, cwdRel);
|
|
15172
|
+
await fs5.mkdir(dirname18(targetPath), { recursive: true });
|
|
15075
15173
|
await fs5.copyFile(sourcePath, targetPath);
|
|
15076
15174
|
}
|
|
15077
15175
|
});
|
|
@@ -15087,24 +15185,24 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
15087
15185
|
const fileBase = basename9(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
15088
15186
|
const jsName = `${fileBase}.js`;
|
|
15089
15187
|
const compiledFallbackPaths = [
|
|
15090
|
-
|
|
15091
|
-
|
|
15092
|
-
|
|
15188
|
+
join30(compiledRoot, relativeEntry),
|
|
15189
|
+
join30(compiledRoot, "pages", jsName),
|
|
15190
|
+
join30(compiledRoot, jsName)
|
|
15093
15191
|
].map((file4) => resolve25(file4));
|
|
15094
15192
|
const resolveRawServerFile = (candidatePaths) => {
|
|
15095
15193
|
const normalizedCandidates = [
|
|
15096
15194
|
...candidatePaths.map((file4) => resolve25(file4)),
|
|
15097
15195
|
...compiledFallbackPaths
|
|
15098
15196
|
];
|
|
15099
|
-
let candidate = normalizedCandidates.find((file4) =>
|
|
15197
|
+
let candidate = normalizedCandidates.find((file4) => existsSync23(file4) && file4.endsWith(`${sep3}${relativeEntry}`));
|
|
15100
15198
|
if (!candidate) {
|
|
15101
|
-
candidate = normalizedCandidates.find((file4) =>
|
|
15199
|
+
candidate = normalizedCandidates.find((file4) => existsSync23(file4) && file4.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
15102
15200
|
}
|
|
15103
15201
|
if (!candidate) {
|
|
15104
|
-
candidate = normalizedCandidates.find((file4) =>
|
|
15202
|
+
candidate = normalizedCandidates.find((file4) => existsSync23(file4) && file4.endsWith(`${sep3}${jsName}`));
|
|
15105
15203
|
}
|
|
15106
15204
|
if (!candidate) {
|
|
15107
|
-
candidate = normalizedCandidates.find((file4) =>
|
|
15205
|
+
candidate = normalizedCandidates.find((file4) => existsSync23(file4));
|
|
15108
15206
|
}
|
|
15109
15207
|
return candidate;
|
|
15110
15208
|
};
|
|
@@ -15112,11 +15210,11 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
15112
15210
|
if (!rawServerFile) {
|
|
15113
15211
|
rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-fallback", () => resolveRawServerFile([]), { entry: resolvedEntry });
|
|
15114
15212
|
}
|
|
15115
|
-
if (rawServerFile && !
|
|
15213
|
+
if (rawServerFile && !existsSync23(rawServerFile)) {
|
|
15116
15214
|
outputs = hmr ? await compileEntry() : aotOutputs;
|
|
15117
15215
|
rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-retry", () => resolveRawServerFile(outputs), { entry: resolvedEntry });
|
|
15118
15216
|
}
|
|
15119
|
-
if (!rawServerFile || !
|
|
15217
|
+
if (!rawServerFile || !existsSync23(rawServerFile)) {
|
|
15120
15218
|
throw new Error(`Compiled output not found for ${entry}. Looking for: ${jsName}. Available: ${[
|
|
15121
15219
|
...outputs,
|
|
15122
15220
|
...compiledFallbackPaths
|
|
@@ -15137,8 +15235,8 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
15137
15235
|
const usesLegacyAnimations = await traceAngularPhase("wrapper/detect-legacy-animations", () => usesLegacyAngularAnimations(resolvedEntry), { entry: resolvedEntry });
|
|
15138
15236
|
const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
|
|
15139
15237
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
15140
|
-
const clientFile =
|
|
15141
|
-
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash &&
|
|
15238
|
+
const clientFile = join30(indexesDir, jsName);
|
|
15239
|
+
if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync23(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
|
|
15142
15240
|
return {
|
|
15143
15241
|
clientPath: clientFile,
|
|
15144
15242
|
indexUnchanged: true,
|
|
@@ -15166,8 +15264,8 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
15166
15264
|
const relativePath = relative13(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
15167
15265
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
15168
15266
|
const manifestKeyForProviders = toPascal(fileBase);
|
|
15169
|
-
const providersFilePath =
|
|
15170
|
-
const hasGeneratedProviders =
|
|
15267
|
+
const providersFilePath = join30(compiledParent, "providers", `${manifestKeyForProviders}.providers.ts`);
|
|
15268
|
+
const hasGeneratedProviders = existsSync23(providersFilePath);
|
|
15171
15269
|
const providersImportPath = hasGeneratedProviders ? (() => {
|
|
15172
15270
|
const rel = relative13(indexesDir, providersFilePath.replace(/\.ts$/, "")).replace(/\\/g, "/");
|
|
15173
15271
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
@@ -15373,24 +15471,24 @@ var init_compileAngular = __esm(() => {
|
|
|
15373
15471
|
init_stylePreprocessor();
|
|
15374
15472
|
init_generatedDir();
|
|
15375
15473
|
devClientDir4 = resolveDevClientDir4();
|
|
15376
|
-
hmrClientPath5 =
|
|
15474
|
+
hmrClientPath5 = join30(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
|
|
15377
15475
|
jitContentCache = new Map;
|
|
15378
15476
|
wrapperOutputCache = new Map;
|
|
15379
15477
|
});
|
|
15380
15478
|
|
|
15381
15479
|
// src/dev/angular/hmrImportGenerator.ts
|
|
15382
|
-
import
|
|
15480
|
+
import ts10 from "typescript";
|
|
15383
15481
|
var createHmrImportGenerator = (namespaceMap) => ({
|
|
15384
15482
|
addImport(request) {
|
|
15385
15483
|
const ns = namespaceMap.get(request.exportModuleSpecifier);
|
|
15386
15484
|
if (!ns) {
|
|
15387
15485
|
throw new Error(`HMR import generator has no namespace mapping for ${request.exportModuleSpecifier}. ` + `Add it to namespaceDependencies before calling compileHmrUpdateCallback.`);
|
|
15388
15486
|
}
|
|
15389
|
-
const namespaceId =
|
|
15487
|
+
const namespaceId = ts10.factory.createIdentifier(ns);
|
|
15390
15488
|
if (request.exportSymbolName === null) {
|
|
15391
15489
|
return namespaceId;
|
|
15392
15490
|
}
|
|
15393
|
-
return
|
|
15491
|
+
return ts10.factory.createPropertyAccessExpression(namespaceId, ts10.factory.createIdentifier(request.exportSymbolName));
|
|
15394
15492
|
}
|
|
15395
15493
|
});
|
|
15396
15494
|
var init_hmrImportGenerator = () => {};
|
|
@@ -15763,13 +15861,13 @@ var init_translator = __esm(() => {
|
|
|
15763
15861
|
});
|
|
15764
15862
|
|
|
15765
15863
|
// src/dev/angular/vendor/translator/ts_util.ts
|
|
15766
|
-
import
|
|
15864
|
+
import ts11 from "typescript";
|
|
15767
15865
|
function tsNumericExpression(value) {
|
|
15768
15866
|
if (value < 0) {
|
|
15769
|
-
const operand =
|
|
15770
|
-
return
|
|
15867
|
+
const operand = ts11.factory.createNumericLiteral(Math.abs(value));
|
|
15868
|
+
return ts11.factory.createPrefixUnaryExpression(ts11.SyntaxKind.MinusToken, operand);
|
|
15771
15869
|
}
|
|
15772
|
-
return
|
|
15870
|
+
return ts11.factory.createNumericLiteral(value);
|
|
15773
15871
|
}
|
|
15774
15872
|
var init_ts_util = __esm(() => {
|
|
15775
15873
|
/*!
|
|
@@ -15782,142 +15880,142 @@ var init_ts_util = __esm(() => {
|
|
|
15782
15880
|
});
|
|
15783
15881
|
|
|
15784
15882
|
// src/dev/angular/vendor/translator/typescript_ast_factory.ts
|
|
15785
|
-
import
|
|
15883
|
+
import ts12 from "typescript";
|
|
15786
15884
|
|
|
15787
15885
|
class TypeScriptAstFactory {
|
|
15788
15886
|
annotateForClosureCompiler;
|
|
15789
15887
|
externalSourceFiles = new Map;
|
|
15790
15888
|
UNARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
15791
|
-
"+":
|
|
15792
|
-
"-":
|
|
15793
|
-
"!":
|
|
15889
|
+
"+": ts12.SyntaxKind.PlusToken,
|
|
15890
|
+
"-": ts12.SyntaxKind.MinusToken,
|
|
15891
|
+
"!": ts12.SyntaxKind.ExclamationToken
|
|
15794
15892
|
}))();
|
|
15795
15893
|
BINARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
15796
|
-
"&&":
|
|
15797
|
-
">":
|
|
15798
|
-
">=":
|
|
15799
|
-
"&":
|
|
15800
|
-
"|":
|
|
15801
|
-
"/":
|
|
15802
|
-
"==":
|
|
15803
|
-
"===":
|
|
15804
|
-
"<":
|
|
15805
|
-
"<=":
|
|
15806
|
-
"-":
|
|
15807
|
-
"%":
|
|
15808
|
-
"*":
|
|
15809
|
-
"**":
|
|
15810
|
-
"!=":
|
|
15811
|
-
"!==":
|
|
15812
|
-
"||":
|
|
15813
|
-
"+":
|
|
15814
|
-
"??":
|
|
15815
|
-
"=":
|
|
15816
|
-
"+=":
|
|
15817
|
-
"-=":
|
|
15818
|
-
"*=":
|
|
15819
|
-
"/=":
|
|
15820
|
-
"%=":
|
|
15821
|
-
"**=":
|
|
15822
|
-
"&&=":
|
|
15823
|
-
"||=":
|
|
15824
|
-
"??=":
|
|
15825
|
-
in:
|
|
15826
|
-
instanceof:
|
|
15894
|
+
"&&": ts12.SyntaxKind.AmpersandAmpersandToken,
|
|
15895
|
+
">": ts12.SyntaxKind.GreaterThanToken,
|
|
15896
|
+
">=": ts12.SyntaxKind.GreaterThanEqualsToken,
|
|
15897
|
+
"&": ts12.SyntaxKind.AmpersandToken,
|
|
15898
|
+
"|": ts12.SyntaxKind.BarToken,
|
|
15899
|
+
"/": ts12.SyntaxKind.SlashToken,
|
|
15900
|
+
"==": ts12.SyntaxKind.EqualsEqualsToken,
|
|
15901
|
+
"===": ts12.SyntaxKind.EqualsEqualsEqualsToken,
|
|
15902
|
+
"<": ts12.SyntaxKind.LessThanToken,
|
|
15903
|
+
"<=": ts12.SyntaxKind.LessThanEqualsToken,
|
|
15904
|
+
"-": ts12.SyntaxKind.MinusToken,
|
|
15905
|
+
"%": ts12.SyntaxKind.PercentToken,
|
|
15906
|
+
"*": ts12.SyntaxKind.AsteriskToken,
|
|
15907
|
+
"**": ts12.SyntaxKind.AsteriskAsteriskToken,
|
|
15908
|
+
"!=": ts12.SyntaxKind.ExclamationEqualsToken,
|
|
15909
|
+
"!==": ts12.SyntaxKind.ExclamationEqualsEqualsToken,
|
|
15910
|
+
"||": ts12.SyntaxKind.BarBarToken,
|
|
15911
|
+
"+": ts12.SyntaxKind.PlusToken,
|
|
15912
|
+
"??": ts12.SyntaxKind.QuestionQuestionToken,
|
|
15913
|
+
"=": ts12.SyntaxKind.EqualsToken,
|
|
15914
|
+
"+=": ts12.SyntaxKind.PlusEqualsToken,
|
|
15915
|
+
"-=": ts12.SyntaxKind.MinusEqualsToken,
|
|
15916
|
+
"*=": ts12.SyntaxKind.AsteriskEqualsToken,
|
|
15917
|
+
"/=": ts12.SyntaxKind.SlashEqualsToken,
|
|
15918
|
+
"%=": ts12.SyntaxKind.PercentEqualsToken,
|
|
15919
|
+
"**=": ts12.SyntaxKind.AsteriskAsteriskEqualsToken,
|
|
15920
|
+
"&&=": ts12.SyntaxKind.AmpersandAmpersandEqualsToken,
|
|
15921
|
+
"||=": ts12.SyntaxKind.BarBarEqualsToken,
|
|
15922
|
+
"??=": ts12.SyntaxKind.QuestionQuestionEqualsToken,
|
|
15923
|
+
in: ts12.SyntaxKind.InKeyword,
|
|
15924
|
+
instanceof: ts12.SyntaxKind.InstanceOfKeyword
|
|
15827
15925
|
}))();
|
|
15828
15926
|
VAR_TYPES = /* @__PURE__ */ (() => ({
|
|
15829
|
-
const:
|
|
15830
|
-
let:
|
|
15831
|
-
var:
|
|
15927
|
+
const: ts12.NodeFlags.Const,
|
|
15928
|
+
let: ts12.NodeFlags.Let,
|
|
15929
|
+
var: ts12.NodeFlags.None
|
|
15832
15930
|
}))();
|
|
15833
15931
|
constructor(annotateForClosureCompiler) {
|
|
15834
15932
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
15835
15933
|
}
|
|
15836
15934
|
attachComments = attachComments;
|
|
15837
|
-
createArrayLiteral =
|
|
15935
|
+
createArrayLiteral = ts12.factory.createArrayLiteralExpression;
|
|
15838
15936
|
createAssignment(target, operator, value) {
|
|
15839
|
-
return
|
|
15937
|
+
return ts12.factory.createBinaryExpression(target, this.BINARY_OPERATORS[operator], value);
|
|
15840
15938
|
}
|
|
15841
15939
|
createBinaryExpression(leftOperand, operator, rightOperand) {
|
|
15842
|
-
return
|
|
15940
|
+
return ts12.factory.createBinaryExpression(leftOperand, this.BINARY_OPERATORS[operator], rightOperand);
|
|
15843
15941
|
}
|
|
15844
15942
|
createBlock(body) {
|
|
15845
|
-
return
|
|
15943
|
+
return ts12.factory.createBlock(body);
|
|
15846
15944
|
}
|
|
15847
15945
|
createCallExpression(callee, args, pure) {
|
|
15848
|
-
const call =
|
|
15946
|
+
const call = ts12.factory.createCallExpression(callee, undefined, args);
|
|
15849
15947
|
if (pure) {
|
|
15850
|
-
|
|
15948
|
+
ts12.addSyntheticLeadingComment(call, ts12.SyntaxKind.MultiLineCommentTrivia, this.annotateForClosureCompiler ? "* @pureOrBreakMyCode " /* CLOSURE */ : "@__PURE__" /* TERSER */, false);
|
|
15851
15949
|
}
|
|
15852
15950
|
return call;
|
|
15853
15951
|
}
|
|
15854
15952
|
createConditional(condition, whenTrue, whenFalse) {
|
|
15855
|
-
return
|
|
15953
|
+
return ts12.factory.createConditionalExpression(condition, undefined, whenTrue, undefined, whenFalse);
|
|
15856
15954
|
}
|
|
15857
|
-
createElementAccess =
|
|
15858
|
-
createExpressionStatement =
|
|
15955
|
+
createElementAccess = ts12.factory.createElementAccessExpression;
|
|
15956
|
+
createExpressionStatement = ts12.factory.createExpressionStatement;
|
|
15859
15957
|
createDynamicImport(url) {
|
|
15860
|
-
return
|
|
15861
|
-
typeof url === "string" ?
|
|
15958
|
+
return ts12.factory.createCallExpression(ts12.factory.createToken(ts12.SyntaxKind.ImportKeyword), undefined, [
|
|
15959
|
+
typeof url === "string" ? ts12.factory.createStringLiteral(url) : url
|
|
15862
15960
|
]);
|
|
15863
15961
|
}
|
|
15864
15962
|
createFunctionDeclaration(functionName, parameters, body) {
|
|
15865
|
-
if (!
|
|
15866
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
15963
|
+
if (!ts12.isBlock(body)) {
|
|
15964
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts12.SyntaxKind[body.kind]}.`);
|
|
15867
15965
|
}
|
|
15868
|
-
return
|
|
15966
|
+
return ts12.factory.createFunctionDeclaration(undefined, undefined, functionName, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
15869
15967
|
}
|
|
15870
15968
|
createFunctionExpression(functionName, parameters, body) {
|
|
15871
|
-
if (!
|
|
15872
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
15969
|
+
if (!ts12.isBlock(body)) {
|
|
15970
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts12.SyntaxKind[body.kind]}.`);
|
|
15873
15971
|
}
|
|
15874
|
-
return
|
|
15972
|
+
return ts12.factory.createFunctionExpression(undefined, undefined, functionName ?? undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
15875
15973
|
}
|
|
15876
15974
|
createArrowFunctionExpression(parameters, body) {
|
|
15877
|
-
if (
|
|
15878
|
-
throw new Error(`Invalid syntax, expected a block, but got ${
|
|
15975
|
+
if (ts12.isStatement(body) && !ts12.isBlock(body)) {
|
|
15976
|
+
throw new Error(`Invalid syntax, expected a block, but got ${ts12.SyntaxKind[body.kind]}.`);
|
|
15879
15977
|
}
|
|
15880
|
-
return
|
|
15978
|
+
return ts12.factory.createArrowFunction(undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, undefined, body);
|
|
15881
15979
|
}
|
|
15882
15980
|
createParameter(param) {
|
|
15883
|
-
return
|
|
15981
|
+
return ts12.factory.createParameterDeclaration(undefined, undefined, param.name, undefined, param.type ?? undefined);
|
|
15884
15982
|
}
|
|
15885
|
-
createIdentifier =
|
|
15983
|
+
createIdentifier = ts12.factory.createIdentifier;
|
|
15886
15984
|
createIfStatement(condition, thenStatement, elseStatement) {
|
|
15887
|
-
return
|
|
15985
|
+
return ts12.factory.createIfStatement(condition, thenStatement, elseStatement ?? undefined);
|
|
15888
15986
|
}
|
|
15889
15987
|
createLiteral(value) {
|
|
15890
15988
|
if (value === undefined) {
|
|
15891
|
-
return
|
|
15989
|
+
return ts12.factory.createIdentifier("undefined");
|
|
15892
15990
|
} else if (value === null) {
|
|
15893
|
-
return
|
|
15991
|
+
return ts12.factory.createNull();
|
|
15894
15992
|
} else if (typeof value === "boolean") {
|
|
15895
|
-
return value ?
|
|
15993
|
+
return value ? ts12.factory.createTrue() : ts12.factory.createFalse();
|
|
15896
15994
|
} else if (typeof value === "number") {
|
|
15897
15995
|
return tsNumericExpression(value);
|
|
15898
15996
|
} else {
|
|
15899
|
-
return
|
|
15997
|
+
return ts12.factory.createStringLiteral(value);
|
|
15900
15998
|
}
|
|
15901
15999
|
}
|
|
15902
16000
|
createNewExpression(expression, args) {
|
|
15903
|
-
return
|
|
16001
|
+
return ts12.factory.createNewExpression(expression, undefined, args);
|
|
15904
16002
|
}
|
|
15905
16003
|
createObjectLiteral(properties) {
|
|
15906
|
-
return
|
|
16004
|
+
return ts12.factory.createObjectLiteralExpression(properties.map((prop) => {
|
|
15907
16005
|
if (prop.kind === "spread") {
|
|
15908
|
-
return
|
|
16006
|
+
return ts12.factory.createSpreadAssignment(prop.expression);
|
|
15909
16007
|
}
|
|
15910
|
-
return
|
|
16008
|
+
return ts12.factory.createPropertyAssignment(prop.quoted ? ts12.factory.createStringLiteral(prop.propertyName) : ts12.factory.createIdentifier(prop.propertyName), prop.value);
|
|
15911
16009
|
}));
|
|
15912
16010
|
}
|
|
15913
|
-
createParenthesizedExpression =
|
|
15914
|
-
createPropertyAccess =
|
|
15915
|
-
createSpreadElement =
|
|
16011
|
+
createParenthesizedExpression = ts12.factory.createParenthesizedExpression;
|
|
16012
|
+
createPropertyAccess = ts12.factory.createPropertyAccessExpression;
|
|
16013
|
+
createSpreadElement = ts12.factory.createSpreadElement;
|
|
15916
16014
|
createReturnStatement(expression) {
|
|
15917
|
-
return
|
|
16015
|
+
return ts12.factory.createReturnStatement(expression ?? undefined);
|
|
15918
16016
|
}
|
|
15919
16017
|
createTaggedTemplate(tag, template) {
|
|
15920
|
-
return
|
|
16018
|
+
return ts12.factory.createTaggedTemplateExpression(tag, undefined, this.createTemplateLiteral(template));
|
|
15921
16019
|
}
|
|
15922
16020
|
createTemplateLiteral(template) {
|
|
15923
16021
|
let templateLiteral;
|
|
@@ -15927,7 +16025,7 @@ class TypeScriptAstFactory {
|
|
|
15927
16025
|
throw new Error("createTemplateLiteral: template has no elements");
|
|
15928
16026
|
}
|
|
15929
16027
|
if (length === 1) {
|
|
15930
|
-
templateLiteral =
|
|
16028
|
+
templateLiteral = ts12.factory.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
|
|
15931
16029
|
} else {
|
|
15932
16030
|
const spans = [];
|
|
15933
16031
|
for (let i = 1;i < length - 1; i++) {
|
|
@@ -15941,7 +16039,7 @@ class TypeScriptAstFactory {
|
|
|
15941
16039
|
if (range !== null) {
|
|
15942
16040
|
this.setSourceMapRange(middle, range);
|
|
15943
16041
|
}
|
|
15944
|
-
spans.push(
|
|
16042
|
+
spans.push(ts12.factory.createTemplateSpan(expression, middle));
|
|
15945
16043
|
}
|
|
15946
16044
|
const resolvedExpression = template.expressions[length - 2];
|
|
15947
16045
|
const templatePart = template.elements[length - 1];
|
|
@@ -15952,27 +16050,27 @@ class TypeScriptAstFactory {
|
|
|
15952
16050
|
if (templatePart.range !== null) {
|
|
15953
16051
|
this.setSourceMapRange(templateTail, templatePart.range);
|
|
15954
16052
|
}
|
|
15955
|
-
spans.push(
|
|
15956
|
-
templateLiteral =
|
|
16053
|
+
spans.push(ts12.factory.createTemplateSpan(resolvedExpression, templateTail));
|
|
16054
|
+
templateLiteral = ts12.factory.createTemplateExpression(ts12.factory.createTemplateHead(head.cooked, head.raw), spans);
|
|
15957
16055
|
}
|
|
15958
16056
|
if (head.range !== null) {
|
|
15959
16057
|
this.setSourceMapRange(templateLiteral, head.range);
|
|
15960
16058
|
}
|
|
15961
16059
|
return templateLiteral;
|
|
15962
16060
|
}
|
|
15963
|
-
createThrowStatement =
|
|
15964
|
-
createTypeOfExpression =
|
|
15965
|
-
createVoidExpression =
|
|
16061
|
+
createThrowStatement = ts12.factory.createThrowStatement;
|
|
16062
|
+
createTypeOfExpression = ts12.factory.createTypeOfExpression;
|
|
16063
|
+
createVoidExpression = ts12.factory.createVoidExpression;
|
|
15966
16064
|
createUnaryExpression(operator, operand) {
|
|
15967
|
-
return
|
|
16065
|
+
return ts12.factory.createPrefixUnaryExpression(this.UNARY_OPERATORS[operator], operand);
|
|
15968
16066
|
}
|
|
15969
16067
|
createVariableDeclaration(variableName, initializer, variableType, type) {
|
|
15970
|
-
return
|
|
15971
|
-
|
|
16068
|
+
return ts12.factory.createVariableStatement(undefined, ts12.factory.createVariableDeclarationList([
|
|
16069
|
+
ts12.factory.createVariableDeclaration(variableName, undefined, type ?? undefined, initializer ?? undefined)
|
|
15972
16070
|
], this.VAR_TYPES[variableType]));
|
|
15973
16071
|
}
|
|
15974
16072
|
createRegularExpressionLiteral(body, flags) {
|
|
15975
|
-
return
|
|
16073
|
+
return ts12.factory.createRegularExpressionLiteral(`/${body}/${flags ?? ""}`);
|
|
15976
16074
|
}
|
|
15977
16075
|
setSourceMapRange(node, sourceMapRange) {
|
|
15978
16076
|
if (sourceMapRange === null) {
|
|
@@ -15980,10 +16078,10 @@ class TypeScriptAstFactory {
|
|
|
15980
16078
|
}
|
|
15981
16079
|
const url = sourceMapRange.url;
|
|
15982
16080
|
if (!this.externalSourceFiles.has(url)) {
|
|
15983
|
-
this.externalSourceFiles.set(url,
|
|
16081
|
+
this.externalSourceFiles.set(url, ts12.createSourceMapSource(url, sourceMapRange.content, (pos) => pos));
|
|
15984
16082
|
}
|
|
15985
16083
|
const source = this.externalSourceFiles.get(url);
|
|
15986
|
-
|
|
16084
|
+
ts12.setSourceMapRange(node, {
|
|
15987
16085
|
pos: sourceMapRange.start.offset,
|
|
15988
16086
|
end: sourceMapRange.end.offset,
|
|
15989
16087
|
source
|
|
@@ -15993,77 +16091,77 @@ class TypeScriptAstFactory {
|
|
|
15993
16091
|
createBuiltInType(type) {
|
|
15994
16092
|
switch (type) {
|
|
15995
16093
|
case "any":
|
|
15996
|
-
return
|
|
16094
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.AnyKeyword);
|
|
15997
16095
|
case "boolean":
|
|
15998
|
-
return
|
|
16096
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.BooleanKeyword);
|
|
15999
16097
|
case "number":
|
|
16000
|
-
return
|
|
16098
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.NumberKeyword);
|
|
16001
16099
|
case "string":
|
|
16002
|
-
return
|
|
16100
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.StringKeyword);
|
|
16003
16101
|
case "function":
|
|
16004
|
-
return
|
|
16102
|
+
return ts12.factory.createTypeReferenceNode(ts12.factory.createIdentifier("Function"));
|
|
16005
16103
|
case "never":
|
|
16006
|
-
return
|
|
16104
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.NeverKeyword);
|
|
16007
16105
|
case "unknown":
|
|
16008
|
-
return
|
|
16106
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.UnknownKeyword);
|
|
16009
16107
|
}
|
|
16010
16108
|
}
|
|
16011
16109
|
createExpressionType(expression, typeParams) {
|
|
16012
16110
|
const typeName = getEntityTypeFromExpression(expression);
|
|
16013
|
-
return
|
|
16111
|
+
return ts12.factory.createTypeReferenceNode(typeName, typeParams ?? undefined);
|
|
16014
16112
|
}
|
|
16015
16113
|
createArrayType(elementType) {
|
|
16016
|
-
return
|
|
16114
|
+
return ts12.factory.createArrayTypeNode(elementType);
|
|
16017
16115
|
}
|
|
16018
16116
|
createMapType(valueType) {
|
|
16019
|
-
return
|
|
16020
|
-
|
|
16021
|
-
|
|
16117
|
+
return ts12.factory.createTypeLiteralNode([
|
|
16118
|
+
ts12.factory.createIndexSignature(undefined, [
|
|
16119
|
+
ts12.factory.createParameterDeclaration(undefined, undefined, "key", undefined, ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.StringKeyword))
|
|
16022
16120
|
], valueType)
|
|
16023
16121
|
]);
|
|
16024
16122
|
}
|
|
16025
16123
|
transplantType(type) {
|
|
16026
|
-
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" &&
|
|
16124
|
+
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" && ts12.isTypeNode(type)) {
|
|
16027
16125
|
return type;
|
|
16028
16126
|
}
|
|
16029
16127
|
throw new Error("Attempting to transplant a type node from a non-TypeScript AST: " + type);
|
|
16030
16128
|
}
|
|
16031
16129
|
}
|
|
16032
16130
|
function createTemplateMiddle(cooked, raw) {
|
|
16033
|
-
const node =
|
|
16034
|
-
node.kind =
|
|
16131
|
+
const node = ts12.factory.createTemplateHead(cooked, raw);
|
|
16132
|
+
node.kind = ts12.SyntaxKind.TemplateMiddle;
|
|
16035
16133
|
return node;
|
|
16036
16134
|
}
|
|
16037
16135
|
function createTemplateTail(cooked, raw) {
|
|
16038
|
-
const node =
|
|
16039
|
-
node.kind =
|
|
16136
|
+
const node = ts12.factory.createTemplateHead(cooked, raw);
|
|
16137
|
+
node.kind = ts12.SyntaxKind.TemplateTail;
|
|
16040
16138
|
return node;
|
|
16041
16139
|
}
|
|
16042
16140
|
function attachComments(statement, leadingComments) {
|
|
16043
16141
|
for (const comment of leadingComments) {
|
|
16044
|
-
const commentKind = comment.multiline ?
|
|
16142
|
+
const commentKind = comment.multiline ? ts12.SyntaxKind.MultiLineCommentTrivia : ts12.SyntaxKind.SingleLineCommentTrivia;
|
|
16045
16143
|
if (comment.multiline) {
|
|
16046
|
-
|
|
16144
|
+
ts12.addSyntheticLeadingComment(statement, commentKind, comment.toString(), comment.trailingNewline);
|
|
16047
16145
|
} else {
|
|
16048
16146
|
for (const line of comment.toString().split(`
|
|
16049
16147
|
`)) {
|
|
16050
|
-
|
|
16148
|
+
ts12.addSyntheticLeadingComment(statement, commentKind, line, comment.trailingNewline);
|
|
16051
16149
|
}
|
|
16052
16150
|
}
|
|
16053
16151
|
}
|
|
16054
16152
|
}
|
|
16055
16153
|
function getEntityTypeFromExpression(expression) {
|
|
16056
|
-
if (
|
|
16154
|
+
if (ts12.isIdentifier(expression)) {
|
|
16057
16155
|
return expression;
|
|
16058
16156
|
}
|
|
16059
|
-
if (
|
|
16157
|
+
if (ts12.isPropertyAccessExpression(expression)) {
|
|
16060
16158
|
const left = getEntityTypeFromExpression(expression.expression);
|
|
16061
|
-
if (!
|
|
16159
|
+
if (!ts12.isIdentifier(expression.name)) {
|
|
16062
16160
|
throw new Error(`Unsupported property access for type reference: ${expression.name.text}`);
|
|
16063
16161
|
}
|
|
16064
|
-
return
|
|
16162
|
+
return ts12.factory.createQualifiedName(left, expression.name);
|
|
16065
16163
|
}
|
|
16066
|
-
throw new Error(`Unsupported expression for type reference: ${
|
|
16164
|
+
throw new Error(`Unsupported expression for type reference: ${ts12.SyntaxKind[expression.kind]}`);
|
|
16067
16165
|
}
|
|
16068
16166
|
var init_typescript_ast_factory = __esm(() => {
|
|
16069
16167
|
init_ts_util();
|
|
@@ -16096,9 +16194,9 @@ __export(exports_fastHmrCompiler, {
|
|
|
16096
16194
|
primeComponentFingerprint: () => primeComponentFingerprint,
|
|
16097
16195
|
invalidateFingerprintCache: () => invalidateFingerprintCache
|
|
16098
16196
|
});
|
|
16099
|
-
import { existsSync as
|
|
16100
|
-
import { dirname as
|
|
16101
|
-
import
|
|
16197
|
+
import { existsSync as existsSync24, readFileSync as readFileSync19, statSync as statSync2 } from "fs";
|
|
16198
|
+
import { dirname as dirname19, extname as extname6, relative as relative14, resolve as resolve26 } from "path";
|
|
16199
|
+
import ts13 from "typescript";
|
|
16102
16200
|
var fail = (reason, detail, location) => ({
|
|
16103
16201
|
ok: false,
|
|
16104
16202
|
reason,
|
|
@@ -16182,23 +16280,23 @@ var fail = (reason, detail, location) => ({
|
|
|
16182
16280
|
}
|
|
16183
16281
|
let sourceFile;
|
|
16184
16282
|
try {
|
|
16185
|
-
sourceFile =
|
|
16283
|
+
sourceFile = ts13.createSourceFile(componentFilePath, source, ts13.ScriptTarget.Latest, true, ts13.ScriptKind.TS);
|
|
16186
16284
|
} catch {
|
|
16187
16285
|
return;
|
|
16188
16286
|
}
|
|
16189
16287
|
for (const stmt of sourceFile.statements) {
|
|
16190
|
-
if (!
|
|
16288
|
+
if (!ts13.isClassDeclaration(stmt))
|
|
16191
16289
|
continue;
|
|
16192
16290
|
const className = stmt.name?.text;
|
|
16193
16291
|
if (!className)
|
|
16194
16292
|
continue;
|
|
16195
|
-
const decorators =
|
|
16293
|
+
const decorators = ts13.getDecorators(stmt) ?? [];
|
|
16196
16294
|
const decoratorName = (() => {
|
|
16197
16295
|
for (const d2 of decorators) {
|
|
16198
|
-
if (!
|
|
16296
|
+
if (!ts13.isCallExpression(d2.expression))
|
|
16199
16297
|
continue;
|
|
16200
16298
|
const expr = d2.expression.expression;
|
|
16201
|
-
if (!
|
|
16299
|
+
if (!ts13.isIdentifier(expr))
|
|
16202
16300
|
continue;
|
|
16203
16301
|
if (expr.text === "Component" || expr.text === "Directive" || expr.text === "Pipe" || expr.text === "Injectable") {
|
|
16204
16302
|
return expr.text;
|
|
@@ -16212,20 +16310,20 @@ var fail = (reason, detail, location) => ({
|
|
|
16212
16310
|
const id = encodeURIComponent(`${projectRel}@${className}`);
|
|
16213
16311
|
if (decoratorName === "Component") {
|
|
16214
16312
|
const componentDecorator = decorators.find((d2) => {
|
|
16215
|
-
if (!
|
|
16313
|
+
if (!ts13.isCallExpression(d2.expression))
|
|
16216
16314
|
return false;
|
|
16217
16315
|
const expr = d2.expression.expression;
|
|
16218
|
-
return
|
|
16316
|
+
return ts13.isIdentifier(expr) && expr.text === "Component";
|
|
16219
16317
|
});
|
|
16220
16318
|
if (!componentDecorator)
|
|
16221
16319
|
continue;
|
|
16222
16320
|
const decoratorCall = componentDecorator.expression;
|
|
16223
16321
|
const args = decoratorCall.arguments[0];
|
|
16224
|
-
if (!args || !
|
|
16322
|
+
if (!args || !ts13.isObjectLiteralExpression(args))
|
|
16225
16323
|
continue;
|
|
16226
16324
|
const decoratorMeta = readDecoratorMeta(args);
|
|
16227
16325
|
const { inputs, outputs } = extractInputsAndOutputs(stmt, null);
|
|
16228
|
-
const componentDir =
|
|
16326
|
+
const componentDir = dirname19(componentFilePath);
|
|
16229
16327
|
const fingerprint = extractFingerprint(stmt, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
16230
16328
|
fingerprintCache.set(id, fingerprint);
|
|
16231
16329
|
} else {
|
|
@@ -16255,11 +16353,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16255
16353
|
return false;
|
|
16256
16354
|
return true;
|
|
16257
16355
|
}, ENTITY_DECORATOR_NAMES, findEntityDecorator = (cls) => {
|
|
16258
|
-
for (const dec of
|
|
16356
|
+
for (const dec of ts13.getDecorators(cls) ?? []) {
|
|
16259
16357
|
const expr = dec.expression;
|
|
16260
|
-
if (!
|
|
16358
|
+
if (!ts13.isCallExpression(expr))
|
|
16261
16359
|
continue;
|
|
16262
|
-
if (!
|
|
16360
|
+
if (!ts13.isIdentifier(expr.expression))
|
|
16263
16361
|
continue;
|
|
16264
16362
|
if (ENTITY_DECORATOR_NAMES.has(expr.expression.text))
|
|
16265
16363
|
return dec;
|
|
@@ -16277,18 +16375,18 @@ var fail = (reason, detail, location) => ({
|
|
|
16277
16375
|
}
|
|
16278
16376
|
const ctorParamTypes = [];
|
|
16279
16377
|
for (const member of cls.members) {
|
|
16280
|
-
if (!
|
|
16378
|
+
if (!ts13.isConstructorDeclaration(member))
|
|
16281
16379
|
continue;
|
|
16282
16380
|
for (const param of member.parameters) {
|
|
16283
16381
|
const typeText = param.type ? param.type.getText() : "";
|
|
16284
|
-
const decorators =
|
|
16382
|
+
const decorators = ts13.getDecorators(param) ?? [];
|
|
16285
16383
|
const decoratorSig = decorators.length === 0 ? "" : decorators.map((d2) => {
|
|
16286
16384
|
const e = d2.expression;
|
|
16287
|
-
if (
|
|
16385
|
+
if (ts13.isCallExpression(e) && ts13.isIdentifier(e.expression)) {
|
|
16288
16386
|
const args = e.arguments.map((a) => a.getText()).join(",");
|
|
16289
16387
|
return `@${e.expression.text}(${args})`;
|
|
16290
16388
|
}
|
|
16291
|
-
if (
|
|
16389
|
+
if (ts13.isIdentifier(e))
|
|
16292
16390
|
return `@${e.text}`;
|
|
16293
16391
|
return "@<unknown>";
|
|
16294
16392
|
}).join("");
|
|
@@ -16310,23 +16408,23 @@ var fail = (reason, detail, location) => ({
|
|
|
16310
16408
|
const walk = (node) => {
|
|
16311
16409
|
if (found)
|
|
16312
16410
|
return;
|
|
16313
|
-
if (
|
|
16411
|
+
if (ts13.isClassDeclaration(node) && node.name?.text === className) {
|
|
16314
16412
|
found = node;
|
|
16315
16413
|
return;
|
|
16316
16414
|
}
|
|
16317
|
-
|
|
16415
|
+
ts13.forEachChild(node, walk);
|
|
16318
16416
|
};
|
|
16319
16417
|
walk(sourceFile);
|
|
16320
16418
|
return found;
|
|
16321
16419
|
}, getClassDecorators = (cls) => {
|
|
16322
|
-
const modifiers =
|
|
16420
|
+
const modifiers = ts13.getDecorators(cls) ?? [];
|
|
16323
16421
|
return [...modifiers];
|
|
16324
16422
|
}, findComponentDecorator = (cls) => {
|
|
16325
16423
|
for (const decorator of getClassDecorators(cls)) {
|
|
16326
16424
|
const expr = decorator.expression;
|
|
16327
|
-
if (
|
|
16425
|
+
if (ts13.isCallExpression(expr)) {
|
|
16328
16426
|
const fn2 = expr.expression;
|
|
16329
|
-
if (
|
|
16427
|
+
if (ts13.isIdentifier(fn2) && fn2.text === "Component") {
|
|
16330
16428
|
return decorator;
|
|
16331
16429
|
}
|
|
16332
16430
|
}
|
|
@@ -16334,15 +16432,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16334
16432
|
return null;
|
|
16335
16433
|
}, getDecoratorArgsObject = (decorator) => {
|
|
16336
16434
|
const call = decorator.expression;
|
|
16337
|
-
if (!
|
|
16435
|
+
if (!ts13.isCallExpression(call))
|
|
16338
16436
|
return null;
|
|
16339
16437
|
const arg = call.arguments[0];
|
|
16340
|
-
if (!arg || !
|
|
16438
|
+
if (!arg || !ts13.isObjectLiteralExpression(arg))
|
|
16341
16439
|
return null;
|
|
16342
16440
|
return arg;
|
|
16343
16441
|
}, getProperty = (obj, name) => {
|
|
16344
16442
|
for (const prop of obj.properties) {
|
|
16345
|
-
if (
|
|
16443
|
+
if (ts13.isPropertyAssignment(prop) && (ts13.isIdentifier(prop.name) && prop.name.text === name || ts13.isStringLiteral(prop.name) && prop.name.text === name)) {
|
|
16346
16444
|
return prop.initializer;
|
|
16347
16445
|
}
|
|
16348
16446
|
}
|
|
@@ -16351,7 +16449,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16351
16449
|
const expr = getProperty(obj, name);
|
|
16352
16450
|
if (!expr)
|
|
16353
16451
|
return null;
|
|
16354
|
-
if (
|
|
16452
|
+
if (ts13.isStringLiteral(expr) || ts13.isNoSubstitutionTemplateLiteral(expr)) {
|
|
16355
16453
|
return expr.text;
|
|
16356
16454
|
}
|
|
16357
16455
|
return null;
|
|
@@ -16359,22 +16457,22 @@ var fail = (reason, detail, location) => ({
|
|
|
16359
16457
|
const expr = getProperty(obj, name);
|
|
16360
16458
|
if (!expr)
|
|
16361
16459
|
return null;
|
|
16362
|
-
if (expr.kind ===
|
|
16460
|
+
if (expr.kind === ts13.SyntaxKind.TrueKeyword)
|
|
16363
16461
|
return true;
|
|
16364
|
-
if (expr.kind ===
|
|
16462
|
+
if (expr.kind === ts13.SyntaxKind.FalseKeyword)
|
|
16365
16463
|
return false;
|
|
16366
16464
|
return null;
|
|
16367
16465
|
}, isAngularDecoratorIdentifier = (name) => name === "Component" || name === "Directive" || name === "Pipe" || name === "Injectable", classHasAngularDecorator = (cls) => {
|
|
16368
|
-
for (const dec of
|
|
16466
|
+
for (const dec of ts13.getDecorators(cls) ?? []) {
|
|
16369
16467
|
const expr = dec.expression;
|
|
16370
|
-
if (
|
|
16468
|
+
if (ts13.isCallExpression(expr) && ts13.isIdentifier(expr.expression) && isAngularDecoratorIdentifier(expr.expression.text)) {
|
|
16371
16469
|
return true;
|
|
16372
16470
|
}
|
|
16373
16471
|
}
|
|
16374
16472
|
return false;
|
|
16375
16473
|
}, findClassInSourceFile = (sf, className) => {
|
|
16376
16474
|
for (const stmt of sf.statements) {
|
|
16377
|
-
if (
|
|
16475
|
+
if (ts13.isClassDeclaration(stmt) && stmt.name?.text === className) {
|
|
16378
16476
|
return stmt;
|
|
16379
16477
|
}
|
|
16380
16478
|
}
|
|
@@ -16384,15 +16482,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16384
16482
|
if (sameFile)
|
|
16385
16483
|
return classHasAngularDecorator(sameFile);
|
|
16386
16484
|
for (const stmt of sourceFile.statements) {
|
|
16387
|
-
if (!
|
|
16485
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
16388
16486
|
continue;
|
|
16389
|
-
if (!
|
|
16487
|
+
if (!ts13.isStringLiteral(stmt.moduleSpecifier))
|
|
16390
16488
|
continue;
|
|
16391
16489
|
const clause = stmt.importClause;
|
|
16392
16490
|
if (!clause || clause.isTypeOnly)
|
|
16393
16491
|
continue;
|
|
16394
16492
|
const named = clause.namedBindings;
|
|
16395
|
-
if (!named || !
|
|
16493
|
+
if (!named || !ts13.isNamedImports(named))
|
|
16396
16494
|
continue;
|
|
16397
16495
|
const found = named.elements.find((el) => el.name.text === parentClassName);
|
|
16398
16496
|
if (!found)
|
|
@@ -16409,15 +16507,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16409
16507
|
`${base}/index.tsx`
|
|
16410
16508
|
];
|
|
16411
16509
|
for (const candidate of candidates) {
|
|
16412
|
-
if (!
|
|
16510
|
+
if (!existsSync24(candidate))
|
|
16413
16511
|
continue;
|
|
16414
16512
|
let content;
|
|
16415
16513
|
try {
|
|
16416
|
-
content =
|
|
16514
|
+
content = readFileSync19(candidate, "utf-8");
|
|
16417
16515
|
} catch {
|
|
16418
16516
|
continue;
|
|
16419
16517
|
}
|
|
16420
|
-
const parentSf =
|
|
16518
|
+
const parentSf = ts13.createSourceFile(candidate, content, ts13.ScriptTarget.Latest, true);
|
|
16421
16519
|
const parentCls = findClassInSourceFile(parentSf, parentClassName);
|
|
16422
16520
|
if (!parentCls)
|
|
16423
16521
|
continue;
|
|
@@ -16429,11 +16527,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16429
16527
|
}, inheritsDecoratedClass = (cls, sourceFile, componentDir, projectRoot) => {
|
|
16430
16528
|
const heritage = cls.heritageClauses ?? [];
|
|
16431
16529
|
for (const clause of heritage) {
|
|
16432
|
-
if (clause.token !==
|
|
16530
|
+
if (clause.token !== ts13.SyntaxKind.ExtendsKeyword)
|
|
16433
16531
|
continue;
|
|
16434
16532
|
for (const typeNode of clause.types) {
|
|
16435
16533
|
const expr = typeNode.expression;
|
|
16436
|
-
if (!
|
|
16534
|
+
if (!ts13.isIdentifier(expr)) {
|
|
16437
16535
|
return true;
|
|
16438
16536
|
}
|
|
16439
16537
|
if (parentHasAngularDecoratorAcrossFiles(expr.text, sourceFile, componentDir, projectRoot)) {
|
|
@@ -16444,18 +16542,18 @@ var fail = (reason, detail, location) => ({
|
|
|
16444
16542
|
return false;
|
|
16445
16543
|
}, CONTROL_CREATE_METHOD_NAME = "\u0275ngControlCreate", extractControlCreate = (cls) => {
|
|
16446
16544
|
for (const member of cls.members) {
|
|
16447
|
-
if (!
|
|
16545
|
+
if (!ts13.isMethodDeclaration(member))
|
|
16448
16546
|
continue;
|
|
16449
|
-
if (member.modifiers?.some((m) => m.kind ===
|
|
16547
|
+
if (member.modifiers?.some((m) => m.kind === ts13.SyntaxKind.StaticKeyword))
|
|
16450
16548
|
continue;
|
|
16451
16549
|
const name = member.name;
|
|
16452
16550
|
if (name === undefined)
|
|
16453
16551
|
continue;
|
|
16454
|
-
const nameText =
|
|
16552
|
+
const nameText = ts13.isIdentifier(name) ? name.text : name.getText();
|
|
16455
16553
|
if (nameText !== CONTROL_CREATE_METHOD_NAME)
|
|
16456
16554
|
continue;
|
|
16457
16555
|
const firstParam = member.parameters[0];
|
|
16458
|
-
if (firstParam === undefined || firstParam.type === undefined || !
|
|
16556
|
+
if (firstParam === undefined || firstParam.type === undefined || !ts13.isTypeReferenceNode(firstParam.type)) {
|
|
16459
16557
|
return { passThroughInput: null };
|
|
16460
16558
|
}
|
|
16461
16559
|
const typeArgs = firstParam.type.typeArguments;
|
|
@@ -16463,16 +16561,16 @@ var fail = (reason, detail, location) => ({
|
|
|
16463
16561
|
return { passThroughInput: null };
|
|
16464
16562
|
}
|
|
16465
16563
|
const arg = typeArgs[0];
|
|
16466
|
-
if (arg === undefined || !
|
|
16564
|
+
if (arg === undefined || !ts13.isLiteralTypeNode(arg) || !ts13.isStringLiteral(arg.literal)) {
|
|
16467
16565
|
return { passThroughInput: null };
|
|
16468
16566
|
}
|
|
16469
16567
|
return { passThroughInput: arg.literal.text };
|
|
16470
16568
|
}
|
|
16471
16569
|
return null;
|
|
16472
16570
|
}, resolveEnumPropertyAccess = (expr, enumName, values) => {
|
|
16473
|
-
if (!
|
|
16571
|
+
if (!ts13.isPropertyAccessExpression(expr))
|
|
16474
16572
|
return null;
|
|
16475
|
-
if (!
|
|
16573
|
+
if (!ts13.isIdentifier(expr.expression))
|
|
16476
16574
|
return null;
|
|
16477
16575
|
if (expr.expression.text !== enumName)
|
|
16478
16576
|
return null;
|
|
@@ -16491,21 +16589,21 @@ var fail = (reason, detail, location) => ({
|
|
|
16491
16589
|
const hostExpr = getProperty(args, "host");
|
|
16492
16590
|
const schemasExpr = getProperty(args, "schemas");
|
|
16493
16591
|
const styleUrls = [];
|
|
16494
|
-
if (styleUrlsExpr &&
|
|
16592
|
+
if (styleUrlsExpr && ts13.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
16495
16593
|
for (const el of styleUrlsExpr.elements) {
|
|
16496
|
-
if (
|
|
16594
|
+
if (ts13.isStringLiteral(el))
|
|
16497
16595
|
styleUrls.push(el.text);
|
|
16498
16596
|
}
|
|
16499
16597
|
}
|
|
16500
16598
|
const styles = [];
|
|
16501
16599
|
if (stylesExpr) {
|
|
16502
|
-
if (
|
|
16600
|
+
if (ts13.isArrayLiteralExpression(stylesExpr)) {
|
|
16503
16601
|
for (const el of stylesExpr.elements) {
|
|
16504
|
-
if (
|
|
16602
|
+
if (ts13.isStringLiteral(el) || ts13.isNoSubstitutionTemplateLiteral(el)) {
|
|
16505
16603
|
styles.push(el.text);
|
|
16506
16604
|
}
|
|
16507
16605
|
}
|
|
16508
|
-
} else if (
|
|
16606
|
+
} else if (ts13.isStringLiteral(stylesExpr) || ts13.isNoSubstitutionTemplateLiteral(stylesExpr)) {
|
|
16509
16607
|
styles.push(stylesExpr.text);
|
|
16510
16608
|
}
|
|
16511
16609
|
}
|
|
@@ -16518,15 +16616,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16518
16616
|
encapsulation,
|
|
16519
16617
|
hasProviders: getProperty(args, "providers") !== null,
|
|
16520
16618
|
hasViewProviders: getProperty(args, "viewProviders") !== null,
|
|
16521
|
-
importsExpr: importsExpr &&
|
|
16522
|
-
hostDirectivesExpr: hostDirectivesExpr &&
|
|
16523
|
-
animationsExpr: animationsExpr &&
|
|
16524
|
-
providersExpr: providersExpr &&
|
|
16525
|
-
viewProvidersExpr: viewProvidersExpr &&
|
|
16526
|
-
inputsArrayExpr: inputsArrayExpr &&
|
|
16527
|
-
outputsArrayExpr: outputsArrayExpr &&
|
|
16528
|
-
hostExpr: hostExpr &&
|
|
16529
|
-
schemasExpr: schemasExpr &&
|
|
16619
|
+
importsExpr: importsExpr && ts13.isArrayLiteralExpression(importsExpr) ? importsExpr : null,
|
|
16620
|
+
hostDirectivesExpr: hostDirectivesExpr && ts13.isArrayLiteralExpression(hostDirectivesExpr) ? hostDirectivesExpr : null,
|
|
16621
|
+
animationsExpr: animationsExpr && ts13.isArrayLiteralExpression(animationsExpr) ? animationsExpr : null,
|
|
16622
|
+
providersExpr: providersExpr && ts13.isArrayLiteralExpression(providersExpr) ? providersExpr : null,
|
|
16623
|
+
viewProvidersExpr: viewProvidersExpr && ts13.isArrayLiteralExpression(viewProvidersExpr) ? viewProvidersExpr : null,
|
|
16624
|
+
inputsArrayExpr: inputsArrayExpr && ts13.isArrayLiteralExpression(inputsArrayExpr) ? inputsArrayExpr : null,
|
|
16625
|
+
outputsArrayExpr: outputsArrayExpr && ts13.isArrayLiteralExpression(outputsArrayExpr) ? outputsArrayExpr : null,
|
|
16626
|
+
hostExpr: hostExpr && ts13.isObjectLiteralExpression(hostExpr) ? hostExpr : null,
|
|
16627
|
+
schemasExpr: schemasExpr && ts13.isArrayLiteralExpression(schemasExpr) ? schemasExpr : null,
|
|
16530
16628
|
preserveWhitespaces: getBooleanProperty(args, "preserveWhitespaces") ?? projectDefaults.preserveWhitespaces ?? false,
|
|
16531
16629
|
selector: getStringProperty(args, "selector"),
|
|
16532
16630
|
standalone: getBooleanProperty(args, "standalone") ?? true,
|
|
@@ -16537,13 +16635,13 @@ var fail = (reason, detail, location) => ({
|
|
|
16537
16635
|
templateUrl: getStringProperty(args, "templateUrl")
|
|
16538
16636
|
};
|
|
16539
16637
|
}, extractDecoratorInput = (prop, compiler) => {
|
|
16540
|
-
const decorators =
|
|
16638
|
+
const decorators = ts13.getDecorators(prop) ?? [];
|
|
16541
16639
|
for (const decorator of decorators) {
|
|
16542
16640
|
const expr = decorator.expression;
|
|
16543
|
-
if (!
|
|
16641
|
+
if (!ts13.isCallExpression(expr))
|
|
16544
16642
|
continue;
|
|
16545
16643
|
const fn2 = expr.expression;
|
|
16546
|
-
if (!
|
|
16644
|
+
if (!ts13.isIdentifier(fn2) || fn2.text !== "Input")
|
|
16547
16645
|
continue;
|
|
16548
16646
|
const classPropertyName = prop.name.getText();
|
|
16549
16647
|
let bindingPropertyName = classPropertyName;
|
|
@@ -16551,9 +16649,9 @@ var fail = (reason, detail, location) => ({
|
|
|
16551
16649
|
let transformFunction = null;
|
|
16552
16650
|
const arg = expr.arguments[0];
|
|
16553
16651
|
if (arg) {
|
|
16554
|
-
if (
|
|
16652
|
+
if (ts13.isStringLiteral(arg)) {
|
|
16555
16653
|
bindingPropertyName = arg.text;
|
|
16556
|
-
} else if (
|
|
16654
|
+
} else if (ts13.isObjectLiteralExpression(arg)) {
|
|
16557
16655
|
const aliasNode = getStringProperty(arg, "alias");
|
|
16558
16656
|
if (aliasNode !== null)
|
|
16559
16657
|
bindingPropertyName = aliasNode;
|
|
@@ -16577,11 +16675,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16577
16675
|
}
|
|
16578
16676
|
return null;
|
|
16579
16677
|
}, isInputSignalCall = (init) => {
|
|
16580
|
-
if (
|
|
16678
|
+
if (ts13.isCallExpression(init)) {
|
|
16581
16679
|
const fn2 = init.expression;
|
|
16582
|
-
if (
|
|
16680
|
+
if (ts13.isIdentifier(fn2) && fn2.text === "input")
|
|
16583
16681
|
return true;
|
|
16584
|
-
if (
|
|
16682
|
+
if (ts13.isPropertyAccessExpression(fn2) && ts13.isIdentifier(fn2.expression) && fn2.expression.text === "input") {
|
|
16585
16683
|
return true;
|
|
16586
16684
|
}
|
|
16587
16685
|
}
|
|
@@ -16592,13 +16690,13 @@ var fail = (reason, detail, location) => ({
|
|
|
16592
16690
|
const classPropertyName = prop.name.getText();
|
|
16593
16691
|
const call = prop.initializer;
|
|
16594
16692
|
let required = false;
|
|
16595
|
-
if (
|
|
16693
|
+
if (ts13.isPropertyAccessExpression(call.expression) && ts13.isIdentifier(call.expression.name) && call.expression.name.text === "required") {
|
|
16596
16694
|
required = true;
|
|
16597
16695
|
}
|
|
16598
16696
|
let bindingPropertyName = classPropertyName;
|
|
16599
16697
|
let transformFunction = null;
|
|
16600
16698
|
const optsArg = call.arguments[required ? 0 : 1];
|
|
16601
|
-
if (optsArg &&
|
|
16699
|
+
if (optsArg && ts13.isObjectLiteralExpression(optsArg)) {
|
|
16602
16700
|
const aliasNode = getStringProperty(optsArg, "alias");
|
|
16603
16701
|
if (aliasNode !== null)
|
|
16604
16702
|
bindingPropertyName = aliasNode;
|
|
@@ -16618,28 +16716,28 @@ var fail = (reason, detail, location) => ({
|
|
|
16618
16716
|
}
|
|
16619
16717
|
};
|
|
16620
16718
|
}, extractDecoratorOutput = (prop) => {
|
|
16621
|
-
const decorators =
|
|
16719
|
+
const decorators = ts13.getDecorators(prop) ?? [];
|
|
16622
16720
|
for (const decorator of decorators) {
|
|
16623
16721
|
const expr = decorator.expression;
|
|
16624
|
-
if (!
|
|
16722
|
+
if (!ts13.isCallExpression(expr))
|
|
16625
16723
|
continue;
|
|
16626
16724
|
const fn2 = expr.expression;
|
|
16627
|
-
if (!
|
|
16725
|
+
if (!ts13.isIdentifier(fn2) || fn2.text !== "Output")
|
|
16628
16726
|
continue;
|
|
16629
16727
|
const classPropertyName = prop.name.getText();
|
|
16630
16728
|
let bindingName = classPropertyName;
|
|
16631
16729
|
const arg = expr.arguments[0];
|
|
16632
|
-
if (arg &&
|
|
16730
|
+
if (arg && ts13.isStringLiteral(arg))
|
|
16633
16731
|
bindingName = arg.text;
|
|
16634
16732
|
return { classPropertyName, bindingName };
|
|
16635
16733
|
}
|
|
16636
16734
|
return null;
|
|
16637
16735
|
}, isOutputSignalCall = (init) => {
|
|
16638
|
-
if (
|
|
16736
|
+
if (ts13.isCallExpression(init)) {
|
|
16639
16737
|
const fn2 = init.expression;
|
|
16640
|
-
if (
|
|
16738
|
+
if (ts13.isIdentifier(fn2) && fn2.text === "output")
|
|
16641
16739
|
return true;
|
|
16642
|
-
if (
|
|
16740
|
+
if (ts13.isPropertyAccessExpression(fn2) && ts13.isIdentifier(fn2.expression) && fn2.expression.text === "output") {
|
|
16643
16741
|
return true;
|
|
16644
16742
|
}
|
|
16645
16743
|
}
|
|
@@ -16651,7 +16749,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16651
16749
|
const call = prop.initializer;
|
|
16652
16750
|
let bindingName = classPropertyName;
|
|
16653
16751
|
const optsArg = call.arguments[0];
|
|
16654
|
-
if (optsArg &&
|
|
16752
|
+
if (optsArg && ts13.isObjectLiteralExpression(optsArg)) {
|
|
16655
16753
|
const aliasNode = getStringProperty(optsArg, "alias");
|
|
16656
16754
|
if (aliasNode !== null)
|
|
16657
16755
|
bindingName = aliasNode;
|
|
@@ -16663,7 +16761,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16663
16761
|
let hasDecoratorIO = false;
|
|
16664
16762
|
let hasSignalIO = false;
|
|
16665
16763
|
for (const member of cls.members) {
|
|
16666
|
-
if (!
|
|
16764
|
+
if (!ts13.isPropertyDeclaration(member))
|
|
16667
16765
|
continue;
|
|
16668
16766
|
const decoratorIn = extractDecoratorInput(member, compiler);
|
|
16669
16767
|
if (decoratorIn) {
|
|
@@ -16697,21 +16795,21 @@ var fail = (reason, detail, location) => ({
|
|
|
16697
16795
|
specialAttributes: {}
|
|
16698
16796
|
}), parseHostObjectInto = (host, args, hostExprNode, compiler) => {
|
|
16699
16797
|
const hostNode = getProperty(args, "host");
|
|
16700
|
-
if (!hostNode || !
|
|
16798
|
+
if (!hostNode || !ts13.isObjectLiteralExpression(hostNode)) {
|
|
16701
16799
|
if (!hostExprNode)
|
|
16702
16800
|
return;
|
|
16703
16801
|
}
|
|
16704
|
-
const obj = hostNode &&
|
|
16802
|
+
const obj = hostNode && ts13.isObjectLiteralExpression(hostNode) ? hostNode : hostExprNode;
|
|
16705
16803
|
if (!obj)
|
|
16706
16804
|
return;
|
|
16707
16805
|
for (const prop of obj.properties) {
|
|
16708
|
-
if (!
|
|
16806
|
+
if (!ts13.isPropertyAssignment(prop))
|
|
16709
16807
|
continue;
|
|
16710
16808
|
const keyNode = prop.name;
|
|
16711
16809
|
let key;
|
|
16712
|
-
if (
|
|
16810
|
+
if (ts13.isStringLiteral(keyNode) || ts13.isNoSubstitutionTemplateLiteral(keyNode)) {
|
|
16713
16811
|
key = keyNode.text;
|
|
16714
|
-
} else if (
|
|
16812
|
+
} else if (ts13.isIdentifier(keyNode)) {
|
|
16715
16813
|
key = keyNode.text;
|
|
16716
16814
|
} else {
|
|
16717
16815
|
continue;
|
|
@@ -16728,36 +16826,36 @@ var fail = (reason, detail, location) => ({
|
|
|
16728
16826
|
}
|
|
16729
16827
|
}, mergeMemberHostDecorators = (host, cls) => {
|
|
16730
16828
|
for (const member of cls.members) {
|
|
16731
|
-
if (!
|
|
16829
|
+
if (!ts13.canHaveDecorators(member))
|
|
16732
16830
|
continue;
|
|
16733
|
-
const decorators =
|
|
16831
|
+
const decorators = ts13.getDecorators(member) ?? [];
|
|
16734
16832
|
for (const dec of decorators) {
|
|
16735
16833
|
const expr = dec.expression;
|
|
16736
|
-
if (!
|
|
16834
|
+
if (!ts13.isCallExpression(expr))
|
|
16737
16835
|
continue;
|
|
16738
16836
|
const fn2 = expr.expression;
|
|
16739
|
-
if (!
|
|
16837
|
+
if (!ts13.isIdentifier(fn2))
|
|
16740
16838
|
continue;
|
|
16741
16839
|
if (fn2.text === "HostBinding") {
|
|
16742
|
-
if (!
|
|
16840
|
+
if (!ts13.isPropertyDeclaration(member) && !ts13.isGetAccessor(member))
|
|
16743
16841
|
continue;
|
|
16744
16842
|
const propertyName = member.name.text;
|
|
16745
16843
|
const target = expr.arguments[0];
|
|
16746
|
-
const key = target &&
|
|
16844
|
+
const key = target && ts13.isStringLiteral(target) ? target.text : propertyName;
|
|
16747
16845
|
host.properties[key] = propertyName;
|
|
16748
16846
|
} else if (fn2.text === "HostListener") {
|
|
16749
|
-
if (!
|
|
16847
|
+
if (!ts13.isMethodDeclaration(member))
|
|
16750
16848
|
continue;
|
|
16751
16849
|
const methodName = member.name.text;
|
|
16752
16850
|
const eventArg = expr.arguments[0];
|
|
16753
|
-
if (!eventArg || !
|
|
16851
|
+
if (!eventArg || !ts13.isStringLiteral(eventArg))
|
|
16754
16852
|
continue;
|
|
16755
16853
|
const event = eventArg.text;
|
|
16756
16854
|
const argsArg = expr.arguments[1];
|
|
16757
16855
|
let argsList = [];
|
|
16758
|
-
if (argsArg &&
|
|
16856
|
+
if (argsArg && ts13.isArrayLiteralExpression(argsArg)) {
|
|
16759
16857
|
for (const el of argsArg.elements) {
|
|
16760
|
-
if (
|
|
16858
|
+
if (ts13.isStringLiteral(el))
|
|
16761
16859
|
argsList.push(el.text);
|
|
16762
16860
|
}
|
|
16763
16861
|
}
|
|
@@ -16770,14 +16868,14 @@ var fail = (reason, detail, location) => ({
|
|
|
16770
16868
|
let descendants = true;
|
|
16771
16869
|
let emitDistinctChangesOnly = true;
|
|
16772
16870
|
const opts = args[1];
|
|
16773
|
-
if (opts &&
|
|
16871
|
+
if (opts && ts13.isObjectLiteralExpression(opts)) {
|
|
16774
16872
|
static_ = getBooleanProperty(opts, "static") ?? false;
|
|
16775
16873
|
descendants = getBooleanProperty(opts, "descendants") ?? true;
|
|
16776
16874
|
emitDistinctChangesOnly = getBooleanProperty(opts, "emitDistinctChangesOnly") ?? true;
|
|
16777
16875
|
}
|
|
16778
16876
|
return { static_, descendants, emitDistinctChangesOnly };
|
|
16779
16877
|
}, queryPredicateFromArg = (arg, compiler) => {
|
|
16780
|
-
if (
|
|
16878
|
+
if (ts13.isStringLiteral(arg)) {
|
|
16781
16879
|
return arg.text.split(",").map((s2) => s2.trim()).filter(Boolean);
|
|
16782
16880
|
}
|
|
16783
16881
|
return {
|
|
@@ -16788,15 +16886,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16788
16886
|
const contentQueries = [];
|
|
16789
16887
|
const viewQueries = [];
|
|
16790
16888
|
for (const member of cls.members) {
|
|
16791
|
-
if (!
|
|
16889
|
+
if (!ts13.isPropertyDeclaration(member))
|
|
16792
16890
|
continue;
|
|
16793
|
-
const decorators =
|
|
16891
|
+
const decorators = ts13.getDecorators(member) ?? [];
|
|
16794
16892
|
for (const dec of decorators) {
|
|
16795
16893
|
const expr = dec.expression;
|
|
16796
|
-
if (!
|
|
16894
|
+
if (!ts13.isCallExpression(expr))
|
|
16797
16895
|
continue;
|
|
16798
16896
|
const fn2 = expr.expression;
|
|
16799
|
-
if (!
|
|
16897
|
+
if (!ts13.isIdentifier(fn2) || !QUERY_DECORATORS.has(fn2.text))
|
|
16800
16898
|
continue;
|
|
16801
16899
|
const propertyName = member.name.text;
|
|
16802
16900
|
const tokenArg = expr.arguments[0];
|
|
@@ -16808,7 +16906,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16808
16906
|
const { static_, descendants, emitDistinctChangesOnly } = parseQueryDecoratorOptions(expr.arguments);
|
|
16809
16907
|
const opts = expr.arguments[1];
|
|
16810
16908
|
let read = null;
|
|
16811
|
-
if (opts &&
|
|
16909
|
+
if (opts && ts13.isObjectLiteralExpression(opts)) {
|
|
16812
16910
|
const readNode = getProperty(opts, "read");
|
|
16813
16911
|
if (readNode) {
|
|
16814
16912
|
read = new compiler.WrappedNodeExpr(readNode);
|
|
@@ -16836,15 +16934,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16836
16934
|
const contentQueries = [];
|
|
16837
16935
|
const viewQueries = [];
|
|
16838
16936
|
for (const member of cls.members) {
|
|
16839
|
-
if (!
|
|
16937
|
+
if (!ts13.isPropertyDeclaration(member) || !member.initializer)
|
|
16840
16938
|
continue;
|
|
16841
16939
|
let init = member.initializer;
|
|
16842
|
-
if (!
|
|
16940
|
+
if (!ts13.isCallExpression(init))
|
|
16843
16941
|
continue;
|
|
16844
16942
|
let queryName;
|
|
16845
|
-
if (
|
|
16943
|
+
if (ts13.isIdentifier(init.expression)) {
|
|
16846
16944
|
queryName = init.expression.text;
|
|
16847
|
-
} else if (
|
|
16945
|
+
} else if (ts13.isPropertyAccessExpression(init.expression) && ts13.isIdentifier(init.expression.expression) && init.expression.name.text === "required") {
|
|
16848
16946
|
queryName = init.expression.expression.text;
|
|
16849
16947
|
} else {
|
|
16850
16948
|
continue;
|
|
@@ -16862,7 +16960,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16862
16960
|
let descendants = true;
|
|
16863
16961
|
let read = null;
|
|
16864
16962
|
const opts = init.arguments[1];
|
|
16865
|
-
if (opts &&
|
|
16963
|
+
if (opts && ts13.isObjectLiteralExpression(opts)) {
|
|
16866
16964
|
descendants = getBooleanProperty(opts, "descendants") ?? true;
|
|
16867
16965
|
const readNode = getProperty(opts, "read");
|
|
16868
16966
|
if (readNode)
|
|
@@ -16888,13 +16986,13 @@ var fail = (reason, detail, location) => ({
|
|
|
16888
16986
|
const node = getProperty(args, "exportAs");
|
|
16889
16987
|
if (!node)
|
|
16890
16988
|
return null;
|
|
16891
|
-
if (
|
|
16989
|
+
if (ts13.isStringLiteral(node)) {
|
|
16892
16990
|
return node.text.split(",").map((s2) => s2.trim()).filter(Boolean);
|
|
16893
16991
|
}
|
|
16894
|
-
if (
|
|
16992
|
+
if (ts13.isArrayLiteralExpression(node)) {
|
|
16895
16993
|
const out = [];
|
|
16896
16994
|
for (const el of node.elements) {
|
|
16897
|
-
if (
|
|
16995
|
+
if (ts13.isStringLiteral(el))
|
|
16898
16996
|
out.push(el.text);
|
|
16899
16997
|
}
|
|
16900
16998
|
return out.length > 0 ? out : null;
|
|
@@ -16902,11 +17000,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16902
17000
|
return null;
|
|
16903
17001
|
}, extractHostDirectives = (args, compiler) => {
|
|
16904
17002
|
const node = getProperty(args, "hostDirectives");
|
|
16905
|
-
if (!node || !
|
|
17003
|
+
if (!node || !ts13.isArrayLiteralExpression(node))
|
|
16906
17004
|
return null;
|
|
16907
17005
|
const out = [];
|
|
16908
17006
|
for (const el of node.elements) {
|
|
16909
|
-
if (
|
|
17007
|
+
if (ts13.isIdentifier(el)) {
|
|
16910
17008
|
out.push({
|
|
16911
17009
|
directive: {
|
|
16912
17010
|
value: new compiler.WrappedNodeExpr(el),
|
|
@@ -16918,7 +17016,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16918
17016
|
});
|
|
16919
17017
|
continue;
|
|
16920
17018
|
}
|
|
16921
|
-
if (!
|
|
17019
|
+
if (!ts13.isObjectLiteralExpression(el))
|
|
16922
17020
|
continue;
|
|
16923
17021
|
const directiveNode = getProperty(el, "directive");
|
|
16924
17022
|
if (!directiveNode)
|
|
@@ -16926,11 +17024,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16926
17024
|
const inputsNode = getProperty(el, "inputs");
|
|
16927
17025
|
const outputsNode = getProperty(el, "outputs");
|
|
16928
17026
|
const collectMap = (n) => {
|
|
16929
|
-
if (!n || !
|
|
17027
|
+
if (!n || !ts13.isArrayLiteralExpression(n))
|
|
16930
17028
|
return null;
|
|
16931
17029
|
const map = {};
|
|
16932
17030
|
for (const item of n.elements) {
|
|
16933
|
-
if (!
|
|
17031
|
+
if (!ts13.isStringLiteral(item))
|
|
16934
17032
|
continue;
|
|
16935
17033
|
const [name, alias] = item.text.split(":").map((s2) => s2.trim());
|
|
16936
17034
|
if (name)
|
|
@@ -16992,7 +17090,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16992
17090
|
return cached.info;
|
|
16993
17091
|
let source;
|
|
16994
17092
|
try {
|
|
16995
|
-
source =
|
|
17093
|
+
source = readFileSync19(filePath, "utf-8");
|
|
16996
17094
|
} catch {
|
|
16997
17095
|
childComponentInfoCache.set(cacheKey2, {
|
|
16998
17096
|
info: null,
|
|
@@ -17000,10 +17098,10 @@ var fail = (reason, detail, location) => ({
|
|
|
17000
17098
|
});
|
|
17001
17099
|
return null;
|
|
17002
17100
|
}
|
|
17003
|
-
const sf =
|
|
17101
|
+
const sf = ts13.createSourceFile(filePath, source, ts13.ScriptTarget.Latest, true);
|
|
17004
17102
|
let info = null;
|
|
17005
17103
|
for (const stmt of sf.statements) {
|
|
17006
|
-
if (!
|
|
17104
|
+
if (!ts13.isClassDeclaration(stmt))
|
|
17007
17105
|
continue;
|
|
17008
17106
|
if (!stmt.name || stmt.name.text !== className)
|
|
17009
17107
|
continue;
|
|
@@ -17046,7 +17144,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17046
17144
|
return cached.info;
|
|
17047
17145
|
let content;
|
|
17048
17146
|
try {
|
|
17049
|
-
content =
|
|
17147
|
+
content = readFileSync19(dtsPath, "utf-8");
|
|
17050
17148
|
} catch {
|
|
17051
17149
|
childComponentInfoCache.set(cacheKey2, {
|
|
17052
17150
|
info: null,
|
|
@@ -17138,9 +17236,9 @@ var fail = (reason, detail, location) => ({
|
|
|
17138
17236
|
}, buildClassToSpecMap = (sourceFile) => {
|
|
17139
17237
|
const result = new Map;
|
|
17140
17238
|
for (const stmt of sourceFile.statements) {
|
|
17141
|
-
if (!
|
|
17239
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
17142
17240
|
continue;
|
|
17143
|
-
if (!
|
|
17241
|
+
if (!ts13.isStringLiteral(stmt.moduleSpecifier))
|
|
17144
17242
|
continue;
|
|
17145
17243
|
const spec = stmt.moduleSpecifier.text;
|
|
17146
17244
|
const clause = stmt.importClause;
|
|
@@ -17149,7 +17247,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17149
17247
|
if (clause.name)
|
|
17150
17248
|
result.set(clause.name.text, spec);
|
|
17151
17249
|
const named = clause.namedBindings;
|
|
17152
|
-
if (named &&
|
|
17250
|
+
if (named && ts13.isNamedImports(named)) {
|
|
17153
17251
|
for (const el of named.elements) {
|
|
17154
17252
|
if (el.isTypeOnly)
|
|
17155
17253
|
continue;
|
|
@@ -17162,11 +17260,11 @@ var fail = (reason, detail, location) => ({
|
|
|
17162
17260
|
if (visited.has(startDtsPath))
|
|
17163
17261
|
return null;
|
|
17164
17262
|
visited.add(startDtsPath);
|
|
17165
|
-
if (!
|
|
17263
|
+
if (!existsSync24(startDtsPath))
|
|
17166
17264
|
return null;
|
|
17167
17265
|
let content;
|
|
17168
17266
|
try {
|
|
17169
|
-
content =
|
|
17267
|
+
content = readFileSync19(startDtsPath, "utf-8");
|
|
17170
17268
|
} catch {
|
|
17171
17269
|
return null;
|
|
17172
17270
|
}
|
|
@@ -17185,7 +17283,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17185
17283
|
});
|
|
17186
17284
|
if (!names.includes(className))
|
|
17187
17285
|
continue;
|
|
17188
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
17286
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname19(startDtsPath));
|
|
17189
17287
|
if (!nextDts)
|
|
17190
17288
|
continue;
|
|
17191
17289
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -17195,7 +17293,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17195
17293
|
const starReExportRe = /export\s*\*\s*from\s*["']([^"']+)["']/g;
|
|
17196
17294
|
while ((m = starReExportRe.exec(content)) !== null) {
|
|
17197
17295
|
const fromPath = m[1] || "";
|
|
17198
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
17296
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname19(startDtsPath));
|
|
17199
17297
|
if (!nextDts)
|
|
17200
17298
|
continue;
|
|
17201
17299
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -17215,16 +17313,16 @@ var fail = (reason, detail, location) => ({
|
|
|
17215
17313
|
`${base}/index.d.cts`
|
|
17216
17314
|
];
|
|
17217
17315
|
for (const c of candidates) {
|
|
17218
|
-
if (
|
|
17316
|
+
if (existsSync24(c))
|
|
17219
17317
|
return c;
|
|
17220
17318
|
}
|
|
17221
17319
|
return null;
|
|
17222
17320
|
}, findPackageDtsForJs = (jsPath) => {
|
|
17223
17321
|
const sibling = jsPath.replace(/\.[mc]?js$/, ".d.ts");
|
|
17224
|
-
if (
|
|
17322
|
+
if (existsSync24(sibling))
|
|
17225
17323
|
return sibling;
|
|
17226
17324
|
const mirror = jsPath.replace(/\/dist\//, "/dist/src/").replace(/\.[mc]?js$/, ".d.ts");
|
|
17227
|
-
if (
|
|
17325
|
+
if (existsSync24(mirror))
|
|
17228
17326
|
return mirror;
|
|
17229
17327
|
return null;
|
|
17230
17328
|
}, resolveChildComponentInfo = (className, spec, componentDir, projectRoot) => {
|
|
@@ -17237,7 +17335,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17237
17335
|
`${base}/index.tsx`
|
|
17238
17336
|
];
|
|
17239
17337
|
for (const candidate of candidates) {
|
|
17240
|
-
if (!
|
|
17338
|
+
if (!existsSync24(candidate))
|
|
17241
17339
|
continue;
|
|
17242
17340
|
const info = getChildComponentInfoFromTsSource(candidate, className);
|
|
17243
17341
|
if (info)
|
|
@@ -17262,7 +17360,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17262
17360
|
return result;
|
|
17263
17361
|
const classToSpec = buildClassToSpecMap(sourceFile);
|
|
17264
17362
|
for (const el of importsExpr.elements) {
|
|
17265
|
-
if (!
|
|
17363
|
+
if (!ts13.isIdentifier(el))
|
|
17266
17364
|
continue;
|
|
17267
17365
|
const className = el.text;
|
|
17268
17366
|
const spec = classToSpec.get(className);
|
|
@@ -17281,35 +17379,35 @@ var fail = (reason, detail, location) => ({
|
|
|
17281
17379
|
}
|
|
17282
17380
|
return (h2 >>> 0).toString(36);
|
|
17283
17381
|
}, initializerShapeIsStructural = (node) => {
|
|
17284
|
-
if (
|
|
17382
|
+
if (ts13.isArrowFunction(node) || ts13.isFunctionExpression(node) || ts13.isCallExpression(node) || ts13.isNewExpression(node)) {
|
|
17285
17383
|
return true;
|
|
17286
17384
|
}
|
|
17287
|
-
if (
|
|
17385
|
+
if (ts13.isConditionalExpression(node)) {
|
|
17288
17386
|
return initializerShapeIsStructural(node.whenTrue) || initializerShapeIsStructural(node.whenFalse);
|
|
17289
17387
|
}
|
|
17290
|
-
if (
|
|
17388
|
+
if (ts13.isParenthesizedExpression(node)) {
|
|
17291
17389
|
return initializerShapeIsStructural(node.expression);
|
|
17292
17390
|
}
|
|
17293
|
-
if (
|
|
17391
|
+
if (ts13.isAsExpression(node) || ts13.isTypeAssertionExpression(node)) {
|
|
17294
17392
|
return initializerShapeIsStructural(node.expression);
|
|
17295
17393
|
}
|
|
17296
|
-
if (
|
|
17394
|
+
if (ts13.isNonNullExpression(node)) {
|
|
17297
17395
|
return initializerShapeIsStructural(node.expression);
|
|
17298
17396
|
}
|
|
17299
|
-
if (
|
|
17397
|
+
if (ts13.isObjectLiteralExpression(node)) {
|
|
17300
17398
|
for (const prop of node.properties) {
|
|
17301
|
-
if (
|
|
17399
|
+
if (ts13.isPropertyAssignment(prop) && initializerShapeIsStructural(prop.initializer)) {
|
|
17302
17400
|
return true;
|
|
17303
17401
|
}
|
|
17304
|
-
if (
|
|
17402
|
+
if (ts13.isShorthandPropertyAssignment(prop))
|
|
17305
17403
|
continue;
|
|
17306
|
-
if (
|
|
17404
|
+
if (ts13.isSpreadAssignment(prop) && initializerShapeIsStructural(prop.expression)) {
|
|
17307
17405
|
return true;
|
|
17308
17406
|
}
|
|
17309
17407
|
}
|
|
17310
17408
|
return false;
|
|
17311
17409
|
}
|
|
17312
|
-
if (
|
|
17410
|
+
if (ts13.isArrayLiteralExpression(node)) {
|
|
17313
17411
|
for (const el of node.elements) {
|
|
17314
17412
|
if (initializerShapeIsStructural(el))
|
|
17315
17413
|
return true;
|
|
@@ -17320,7 +17418,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17320
17418
|
}, extractArrowFieldSig = (cls) => {
|
|
17321
17419
|
const entries = [];
|
|
17322
17420
|
for (const member of cls.members) {
|
|
17323
|
-
if (!
|
|
17421
|
+
if (!ts13.isPropertyDeclaration(member))
|
|
17324
17422
|
continue;
|
|
17325
17423
|
const init = member.initializer;
|
|
17326
17424
|
if (!init)
|
|
@@ -17330,12 +17428,12 @@ var fail = (reason, detail, location) => ({
|
|
|
17330
17428
|
const name = member.name.getText();
|
|
17331
17429
|
let bodyText;
|
|
17332
17430
|
try {
|
|
17333
|
-
const printer =
|
|
17334
|
-
newLine:
|
|
17431
|
+
const printer = ts13.createPrinter({
|
|
17432
|
+
newLine: ts13.NewLineKind.LineFeed,
|
|
17335
17433
|
omitTrailingSemicolon: true,
|
|
17336
17434
|
removeComments: true
|
|
17337
17435
|
});
|
|
17338
|
-
bodyText = printer.printNode(
|
|
17436
|
+
bodyText = printer.printNode(ts13.EmitHint.Unspecified, init, cls.getSourceFile());
|
|
17339
17437
|
} catch {
|
|
17340
17438
|
bodyText = init.getText();
|
|
17341
17439
|
}
|
|
@@ -17346,9 +17444,9 @@ var fail = (reason, detail, location) => ({
|
|
|
17346
17444
|
}, INPUT_OUTPUT_DECORATORS, extractMemberDecoratorSig = (cls) => {
|
|
17347
17445
|
const entries = [];
|
|
17348
17446
|
for (const member of cls.members) {
|
|
17349
|
-
if (!
|
|
17447
|
+
if (!ts13.canHaveDecorators(member))
|
|
17350
17448
|
continue;
|
|
17351
|
-
const decorators =
|
|
17449
|
+
const decorators = ts13.getDecorators(member) ?? [];
|
|
17352
17450
|
if (decorators.length === 0)
|
|
17353
17451
|
continue;
|
|
17354
17452
|
const memberName = member.name?.getText() ?? "<anon>";
|
|
@@ -17356,14 +17454,14 @@ var fail = (reason, detail, location) => ({
|
|
|
17356
17454
|
const expr = decorator.expression;
|
|
17357
17455
|
let decName = "<unknown>";
|
|
17358
17456
|
let argText = "";
|
|
17359
|
-
if (
|
|
17360
|
-
if (
|
|
17457
|
+
if (ts13.isCallExpression(expr)) {
|
|
17458
|
+
if (ts13.isIdentifier(expr.expression)) {
|
|
17361
17459
|
decName = expr.expression.text;
|
|
17362
17460
|
}
|
|
17363
17461
|
if (expr.arguments.length > 0) {
|
|
17364
17462
|
argText = expr.arguments.map((a) => a.getText()).join(",");
|
|
17365
17463
|
}
|
|
17366
|
-
} else if (
|
|
17464
|
+
} else if (ts13.isIdentifier(expr)) {
|
|
17367
17465
|
decName = expr.text;
|
|
17368
17466
|
}
|
|
17369
17467
|
if (INPUT_OUTPUT_DECORATORS.has(decName))
|
|
@@ -17384,22 +17482,22 @@ var fail = (reason, detail, location) => ({
|
|
|
17384
17482
|
return cached.hasProviders;
|
|
17385
17483
|
let source;
|
|
17386
17484
|
try {
|
|
17387
|
-
source =
|
|
17485
|
+
source = readFileSync19(filePath, "utf8");
|
|
17388
17486
|
} catch {
|
|
17389
17487
|
return true;
|
|
17390
17488
|
}
|
|
17391
|
-
const sf =
|
|
17489
|
+
const sf = ts13.createSourceFile(filePath, source, ts13.ScriptTarget.ES2022, true, ts13.ScriptKind.TS);
|
|
17392
17490
|
let hasProviders = false;
|
|
17393
17491
|
const visit = (node) => {
|
|
17394
17492
|
if (hasProviders)
|
|
17395
17493
|
return;
|
|
17396
|
-
if (
|
|
17397
|
-
for (const decorator of
|
|
17494
|
+
if (ts13.isClassDeclaration(node)) {
|
|
17495
|
+
for (const decorator of ts13.getDecorators(node) ?? []) {
|
|
17398
17496
|
const expr = decorator.expression;
|
|
17399
|
-
if (!
|
|
17497
|
+
if (!ts13.isCallExpression(expr))
|
|
17400
17498
|
continue;
|
|
17401
17499
|
const arg = expr.arguments[0];
|
|
17402
|
-
if (!arg || !
|
|
17500
|
+
if (!arg || !ts13.isObjectLiteralExpression(arg))
|
|
17403
17501
|
continue;
|
|
17404
17502
|
if (getProperty(arg, "providers") !== null) {
|
|
17405
17503
|
hasProviders = true;
|
|
@@ -17407,7 +17505,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17407
17505
|
}
|
|
17408
17506
|
}
|
|
17409
17507
|
}
|
|
17410
|
-
|
|
17508
|
+
ts13.forEachChild(node, visit);
|
|
17411
17509
|
};
|
|
17412
17510
|
visit(sf);
|
|
17413
17511
|
providerProbeCache.set(filePath, {
|
|
@@ -17417,10 +17515,10 @@ var fail = (reason, detail, location) => ({
|
|
|
17417
17515
|
return hasProviders;
|
|
17418
17516
|
}, TS_EXTENSIONS, resolveImportSource = (identifierName, sourceFile, componentDir) => {
|
|
17419
17517
|
for (const stmt of sourceFile.statements) {
|
|
17420
|
-
if (!
|
|
17518
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
17421
17519
|
continue;
|
|
17422
17520
|
const moduleSpec = stmt.moduleSpecifier;
|
|
17423
|
-
if (!
|
|
17521
|
+
if (!ts13.isStringLiteral(moduleSpec))
|
|
17424
17522
|
continue;
|
|
17425
17523
|
const spec = moduleSpec.text;
|
|
17426
17524
|
if (!spec.startsWith(".") && !spec.startsWith("/"))
|
|
@@ -17434,7 +17532,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17434
17532
|
}
|
|
17435
17533
|
if (importClause.namedBindings) {
|
|
17436
17534
|
const nb = importClause.namedBindings;
|
|
17437
|
-
if (
|
|
17535
|
+
if (ts13.isNamespaceImport(nb)) {
|
|
17438
17536
|
if (nb.name.text === identifierName)
|
|
17439
17537
|
matches = true;
|
|
17440
17538
|
} else {
|
|
@@ -17451,11 +17549,11 @@ var fail = (reason, detail, location) => ({
|
|
|
17451
17549
|
const resolved = resolve26(componentDir, spec);
|
|
17452
17550
|
for (const ext of TS_EXTENSIONS) {
|
|
17453
17551
|
const candidate = resolved + ext;
|
|
17454
|
-
if (
|
|
17552
|
+
if (existsSync24(candidate))
|
|
17455
17553
|
return candidate;
|
|
17456
17554
|
}
|
|
17457
17555
|
const indexCandidate = resolve26(resolved, "index.ts");
|
|
17458
|
-
if (
|
|
17556
|
+
if (existsSync24(indexCandidate))
|
|
17459
17557
|
return indexCandidate;
|
|
17460
17558
|
}
|
|
17461
17559
|
return null;
|
|
@@ -17464,7 +17562,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17464
17562
|
return [];
|
|
17465
17563
|
const sig = [];
|
|
17466
17564
|
for (const entry of importsExpr.elements) {
|
|
17467
|
-
if (
|
|
17565
|
+
if (ts13.isIdentifier(entry)) {
|
|
17468
17566
|
const importPath = resolveImportSource(entry.text, sourceFile, componentDir);
|
|
17469
17567
|
if (importPath) {
|
|
17470
17568
|
if (fileHasModuleProviders(importPath)) {
|
|
@@ -17483,13 +17581,13 @@ var fail = (reason, detail, location) => ({
|
|
|
17483
17581
|
}, extractPropertyFieldNames = (cls) => {
|
|
17484
17582
|
const names = [];
|
|
17485
17583
|
for (const member of cls.members) {
|
|
17486
|
-
if (!
|
|
17584
|
+
if (!ts13.isPropertyDeclaration(member) && !ts13.isMethodDeclaration(member) && !ts13.isGetAccessorDeclaration(member) && !ts13.isSetAccessorDeclaration(member)) {
|
|
17487
17585
|
continue;
|
|
17488
17586
|
}
|
|
17489
17587
|
const name = member.name;
|
|
17490
17588
|
if (name === undefined)
|
|
17491
17589
|
continue;
|
|
17492
|
-
const text =
|
|
17590
|
+
const text = ts13.isIdentifier(name) ? name.text : ts13.isStringLiteral(name) || ts13.isNoSubstitutionTemplateLiteral(name) ? name.text : name.getText();
|
|
17493
17591
|
if (text.length > 0)
|
|
17494
17592
|
names.push(text);
|
|
17495
17593
|
}
|
|
@@ -17497,7 +17595,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17497
17595
|
}, extractTopLevelImports = (sourceFile) => {
|
|
17498
17596
|
const names = new Set;
|
|
17499
17597
|
for (const stmt of sourceFile.statements) {
|
|
17500
|
-
if (!
|
|
17598
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
17501
17599
|
continue;
|
|
17502
17600
|
const clause = stmt.importClause;
|
|
17503
17601
|
if (!clause)
|
|
@@ -17509,9 +17607,9 @@ var fail = (reason, detail, location) => ({
|
|
|
17509
17607
|
const bindings = clause.namedBindings;
|
|
17510
17608
|
if (!bindings)
|
|
17511
17609
|
continue;
|
|
17512
|
-
if (
|
|
17610
|
+
if (ts13.isNamespaceImport(bindings)) {
|
|
17513
17611
|
names.add(bindings.name.text);
|
|
17514
|
-
} else if (
|
|
17612
|
+
} else if (ts13.isNamedImports(bindings)) {
|
|
17515
17613
|
for (const el of bindings.elements) {
|
|
17516
17614
|
if (el.isTypeOnly)
|
|
17517
17615
|
continue;
|
|
@@ -17523,18 +17621,18 @@ var fail = (reason, detail, location) => ({
|
|
|
17523
17621
|
}, extractFingerprint = (cls, className, decoratorMeta, inputs, outputs, sourceFile, componentDir) => {
|
|
17524
17622
|
const ctorParamTypes = [];
|
|
17525
17623
|
for (const member of cls.members) {
|
|
17526
|
-
if (!
|
|
17624
|
+
if (!ts13.isConstructorDeclaration(member))
|
|
17527
17625
|
continue;
|
|
17528
17626
|
for (const param of member.parameters) {
|
|
17529
17627
|
const typeText = param.type ? param.type.getText() : "";
|
|
17530
|
-
const decorators =
|
|
17628
|
+
const decorators = ts13.getDecorators(param) ?? [];
|
|
17531
17629
|
const decoratorSig = decorators.length === 0 ? "" : decorators.map((d2) => {
|
|
17532
17630
|
const expr = d2.expression;
|
|
17533
|
-
if (
|
|
17631
|
+
if (ts13.isCallExpression(expr) && ts13.isIdentifier(expr.expression)) {
|
|
17534
17632
|
const args = expr.arguments.map((a) => a.getText()).join(",");
|
|
17535
17633
|
return `@${expr.expression.text}(${args})`;
|
|
17536
17634
|
}
|
|
17537
|
-
if (
|
|
17635
|
+
if (ts13.isIdentifier(expr)) {
|
|
17538
17636
|
return `@${expr.text}`;
|
|
17539
17637
|
}
|
|
17540
17638
|
return "@<unknown>";
|
|
@@ -17550,12 +17648,12 @@ var fail = (reason, detail, location) => ({
|
|
|
17550
17648
|
const providerImportSig = extractProviderImportSig(decoratorMeta.importsExpr, sourceFile, componentDir);
|
|
17551
17649
|
const topLevelImports = extractTopLevelImports(sourceFile);
|
|
17552
17650
|
const propertyFieldNames = extractPropertyFieldNames(cls);
|
|
17553
|
-
const printer =
|
|
17554
|
-
newLine:
|
|
17651
|
+
const printer = ts13.createPrinter({
|
|
17652
|
+
newLine: ts13.NewLineKind.LineFeed,
|
|
17555
17653
|
omitTrailingSemicolon: true,
|
|
17556
17654
|
removeComments: true
|
|
17557
17655
|
});
|
|
17558
|
-
const canonicalText = (node) => printer.printNode(
|
|
17656
|
+
const canonicalText = (node) => printer.printNode(ts13.EmitHint.Unspecified, node, sourceFile);
|
|
17559
17657
|
const importsArraySig = decoratorMeta.importsExpr ? djb2Hash(canonicalText(decoratorMeta.importsExpr)) : "";
|
|
17560
17658
|
const hostDirectivesSig = decoratorMeta.hostDirectivesExpr ? djb2Hash(canonicalText(decoratorMeta.hostDirectivesExpr)) : "";
|
|
17561
17659
|
const animationsArraySig = decoratorMeta.animationsExpr ? djb2Hash(canonicalText(decoratorMeta.animationsExpr)) : "";
|
|
@@ -17568,13 +17666,13 @@ var fail = (reason, detail, location) => ({
|
|
|
17568
17666
|
const PAGE_EXPORT_NAMES = new Set(["providers", "routes"]);
|
|
17569
17667
|
const pageExportEntries = [];
|
|
17570
17668
|
for (const stmt of sourceFile.statements) {
|
|
17571
|
-
if (!
|
|
17669
|
+
if (!ts13.isVariableStatement(stmt))
|
|
17572
17670
|
continue;
|
|
17573
|
-
const isExported = stmt.modifiers?.some((m) => m.kind ===
|
|
17671
|
+
const isExported = stmt.modifiers?.some((m) => m.kind === ts13.SyntaxKind.ExportKeyword);
|
|
17574
17672
|
if (!isExported)
|
|
17575
17673
|
continue;
|
|
17576
17674
|
for (const decl of stmt.declarationList.declarations) {
|
|
17577
|
-
if (!
|
|
17675
|
+
if (!ts13.isIdentifier(decl.name))
|
|
17578
17676
|
continue;
|
|
17579
17677
|
if (!PAGE_EXPORT_NAMES.has(decl.name.text))
|
|
17580
17678
|
continue;
|
|
@@ -17615,35 +17713,35 @@ var fail = (reason, detail, location) => ({
|
|
|
17615
17713
|
}, buildFreshClassMethodsBlock = (classNode, className) => {
|
|
17616
17714
|
const memberSources = [];
|
|
17617
17715
|
let hasStatic = false;
|
|
17618
|
-
const printer =
|
|
17716
|
+
const printer = ts13.createPrinter({ removeComments: true });
|
|
17619
17717
|
for (const member of classNode.members) {
|
|
17620
|
-
if (
|
|
17621
|
-
const modifiers = (
|
|
17622
|
-
const cleaned =
|
|
17623
|
-
memberSources.push(printer.printNode(
|
|
17718
|
+
if (ts13.isPropertyDeclaration(member)) {
|
|
17719
|
+
const modifiers = (ts13.getModifiers(member) ?? []).filter((m) => m.kind !== ts13.SyntaxKind.PrivateKeyword && m.kind !== ts13.SyntaxKind.PublicKeyword && m.kind !== ts13.SyntaxKind.ProtectedKeyword && m.kind !== ts13.SyntaxKind.ReadonlyKeyword && m.kind !== ts13.SyntaxKind.OverrideKeyword);
|
|
17720
|
+
const cleaned = ts13.factory.createPropertyDeclaration(modifiers, member.name, undefined, undefined, member.initializer);
|
|
17721
|
+
memberSources.push(printer.printNode(ts13.EmitHint.Unspecified, cleaned, classNode.getSourceFile()));
|
|
17624
17722
|
continue;
|
|
17625
17723
|
}
|
|
17626
|
-
if (
|
|
17627
|
-
const cleanedParams = member.parameters.map((param) =>
|
|
17628
|
-
const cleaned =
|
|
17629
|
-
memberSources.push(printer.printNode(
|
|
17724
|
+
if (ts13.isConstructorDeclaration(member)) {
|
|
17725
|
+
const cleanedParams = member.parameters.map((param) => ts13.factory.updateParameterDeclaration(param, (ts13.getModifiers(param) ?? []).filter((m) => m.kind !== ts13.SyntaxKind.PrivateKeyword && m.kind !== ts13.SyntaxKind.PublicKeyword && m.kind !== ts13.SyntaxKind.ProtectedKeyword && m.kind !== ts13.SyntaxKind.ReadonlyKeyword && m.kind !== ts13.SyntaxKind.OverrideKeyword), param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer));
|
|
17726
|
+
const cleaned = ts13.factory.createConstructorDeclaration([], cleanedParams, member.body);
|
|
17727
|
+
memberSources.push(printer.printNode(ts13.EmitHint.Unspecified, cleaned, classNode.getSourceFile()));
|
|
17630
17728
|
continue;
|
|
17631
17729
|
}
|
|
17632
|
-
if (
|
|
17633
|
-
const modifiers =
|
|
17634
|
-
const isStatic = modifiers.some((m) => m.kind ===
|
|
17730
|
+
if (ts13.isMethodDeclaration(member) || ts13.isGetAccessorDeclaration(member) || ts13.isSetAccessorDeclaration(member)) {
|
|
17731
|
+
const modifiers = ts13.getModifiers(member) ?? [];
|
|
17732
|
+
const isStatic = modifiers.some((m) => m.kind === ts13.SyntaxKind.StaticKeyword);
|
|
17635
17733
|
if (isStatic)
|
|
17636
17734
|
hasStatic = true;
|
|
17637
|
-
const cleanedParams = member.parameters.map((param) =>
|
|
17735
|
+
const cleanedParams = member.parameters.map((param) => ts13.factory.updateParameterDeclaration(param, ts13.getModifiers(param) ?? [], param.dotDotDotToken, param.name, param.questionToken, param.type, param.initializer));
|
|
17638
17736
|
let cleaned;
|
|
17639
|
-
if (
|
|
17640
|
-
cleaned =
|
|
17641
|
-
} else if (
|
|
17642
|
-
cleaned =
|
|
17737
|
+
if (ts13.isMethodDeclaration(member)) {
|
|
17738
|
+
cleaned = ts13.factory.createMethodDeclaration(modifiers, member.asteriskToken, member.name, member.questionToken, member.typeParameters, cleanedParams, member.type, member.body);
|
|
17739
|
+
} else if (ts13.isGetAccessorDeclaration(member)) {
|
|
17740
|
+
cleaned = ts13.factory.createGetAccessorDeclaration(modifiers, member.name, cleanedParams, member.type, member.body);
|
|
17643
17741
|
} else {
|
|
17644
|
-
cleaned =
|
|
17742
|
+
cleaned = ts13.factory.createSetAccessorDeclaration(modifiers, member.name, cleanedParams, member.body);
|
|
17645
17743
|
}
|
|
17646
|
-
const printed = printer.printNode(
|
|
17744
|
+
const printed = printer.printNode(ts13.EmitHint.Unspecified, cleaned, classNode.getSourceFile());
|
|
17647
17745
|
memberSources.push(printed);
|
|
17648
17746
|
}
|
|
17649
17747
|
}
|
|
@@ -17655,10 +17753,10 @@ ${memberSources.join(`
|
|
|
17655
17753
|
}`;
|
|
17656
17754
|
let transpiled;
|
|
17657
17755
|
try {
|
|
17658
|
-
transpiled =
|
|
17756
|
+
transpiled = ts13.transpileModule(wrappedSource, {
|
|
17659
17757
|
compilerOptions: {
|
|
17660
|
-
module:
|
|
17661
|
-
target:
|
|
17758
|
+
module: ts13.ModuleKind.ES2022,
|
|
17759
|
+
target: ts13.ScriptTarget.ES2022
|
|
17662
17760
|
},
|
|
17663
17761
|
reportDiagnostics: false
|
|
17664
17762
|
}).outputText;
|
|
@@ -17688,11 +17786,11 @@ ${transpiled}
|
|
|
17688
17786
|
}${staticPatch}`;
|
|
17689
17787
|
}, STYLE_PREPROCESSED_EXT, resolveAndReadStyleResource = (componentDir, url) => {
|
|
17690
17788
|
const abs = resolve26(componentDir, url);
|
|
17691
|
-
if (!
|
|
17789
|
+
if (!existsSync24(abs))
|
|
17692
17790
|
return null;
|
|
17693
17791
|
const ext = extname6(abs).toLowerCase();
|
|
17694
17792
|
if (!STYLE_PREPROCESSED_EXT.has(ext) || ext === ".css") {
|
|
17695
|
-
return
|
|
17793
|
+
return readFileSync19(abs, "utf8");
|
|
17696
17794
|
}
|
|
17697
17795
|
try {
|
|
17698
17796
|
const { compileStyleFileIfNeededSync: compileStyleFileIfNeededSync2 } = (init_stylePreprocessor(), __toCommonJS(exports_stylePreprocessor));
|
|
@@ -17729,10 +17827,10 @@ ${block}
|
|
|
17729
17827
|
return cached;
|
|
17730
17828
|
const tsconfigPath = resolve26(projectRoot, "tsconfig.json");
|
|
17731
17829
|
const opts = {};
|
|
17732
|
-
if (
|
|
17830
|
+
if (existsSync24(tsconfigPath)) {
|
|
17733
17831
|
try {
|
|
17734
|
-
const text =
|
|
17735
|
-
const parsed =
|
|
17832
|
+
const text = readFileSync19(tsconfigPath, "utf8");
|
|
17833
|
+
const parsed = ts13.parseConfigFileTextToJson(tsconfigPath, text);
|
|
17736
17834
|
if (!parsed.error && parsed.config) {
|
|
17737
17835
|
const cfg = parsed.config;
|
|
17738
17836
|
const ang = cfg.angularCompilerOptions ?? {};
|
|
@@ -17756,7 +17854,7 @@ ${block}
|
|
|
17756
17854
|
}, tryFastHmr = async (params) => {
|
|
17757
17855
|
const { componentFilePath, className } = params;
|
|
17758
17856
|
const projectRoot = params.projectRoot ?? process.cwd();
|
|
17759
|
-
if (!
|
|
17857
|
+
if (!existsSync24(componentFilePath)) {
|
|
17760
17858
|
return fail("file-not-found", componentFilePath);
|
|
17761
17859
|
}
|
|
17762
17860
|
let compiler;
|
|
@@ -17765,8 +17863,8 @@ ${block}
|
|
|
17765
17863
|
} catch (err) {
|
|
17766
17864
|
return fail("unexpected-error", `import @angular/compiler: ${err}`);
|
|
17767
17865
|
}
|
|
17768
|
-
const tsSource =
|
|
17769
|
-
const sourceFile =
|
|
17866
|
+
const tsSource = readFileSync19(componentFilePath, "utf8");
|
|
17867
|
+
const sourceFile = ts13.createSourceFile(componentFilePath, tsSource, ts13.ScriptTarget.ES2022, true, ts13.ScriptKind.TS);
|
|
17770
17868
|
const classNode = findClassDeclaration(sourceFile, className);
|
|
17771
17869
|
if (!classNode) {
|
|
17772
17870
|
return fail("class-not-found", `${className} in ${componentFilePath}`);
|
|
@@ -17792,7 +17890,7 @@ ${block}
|
|
|
17792
17890
|
rebootstrapRequired: false
|
|
17793
17891
|
};
|
|
17794
17892
|
}
|
|
17795
|
-
if (inheritsDecoratedClass(classNode, sourceFile,
|
|
17893
|
+
if (inheritsDecoratedClass(classNode, sourceFile, dirname19(componentFilePath), projectRoot)) {
|
|
17796
17894
|
return fail("inherits-decorated-class");
|
|
17797
17895
|
}
|
|
17798
17896
|
const decorator = findComponentDecorator(classNode);
|
|
@@ -17804,7 +17902,7 @@ ${block}
|
|
|
17804
17902
|
const projectDefaults = readProjectAngularCompilerOptions(projectRoot);
|
|
17805
17903
|
const decoratorMeta = readDecoratorMeta(decoratorArgs, projectDefaults);
|
|
17806
17904
|
const advancedMetadata = extractAdvancedMetadata(classNode, decoratorArgs, compiler);
|
|
17807
|
-
const componentDir =
|
|
17905
|
+
const componentDir = dirname19(componentFilePath);
|
|
17808
17906
|
let templateText;
|
|
17809
17907
|
let templatePath;
|
|
17810
17908
|
if (decoratorMeta.template !== null) {
|
|
@@ -17812,10 +17910,10 @@ ${block}
|
|
|
17812
17910
|
templatePath = componentFilePath;
|
|
17813
17911
|
} else if (decoratorMeta.templateUrl) {
|
|
17814
17912
|
const tplAbs = resolve26(componentDir, decoratorMeta.templateUrl);
|
|
17815
|
-
if (!
|
|
17913
|
+
if (!existsSync24(tplAbs)) {
|
|
17816
17914
|
return fail("template-resource-not-found", `Template file not found: ${tplAbs}`, { file: componentFilePath });
|
|
17817
17915
|
}
|
|
17818
|
-
templateText =
|
|
17916
|
+
templateText = readFileSync19(tplAbs, "utf8");
|
|
17819
17917
|
templatePath = tplAbs;
|
|
17820
17918
|
} else {
|
|
17821
17919
|
return fail("unsupported-decorator-args", "missing template/templateUrl");
|
|
@@ -17886,7 +17984,7 @@ ${block}
|
|
|
17886
17984
|
viewQueries: advancedMetadata.viewQueries,
|
|
17887
17985
|
host: advancedMetadata.host,
|
|
17888
17986
|
lifecycle: {
|
|
17889
|
-
usesOnChanges: classNode.members.some((m) =>
|
|
17987
|
+
usesOnChanges: classNode.members.some((m) => ts13.isMethodDeclaration(m) && m.name !== undefined && ts13.isIdentifier(m.name) && m.name.text === "ngOnChanges")
|
|
17890
17988
|
},
|
|
17891
17989
|
inputs,
|
|
17892
17990
|
outputs,
|
|
@@ -17942,15 +18040,15 @@ ${block}
|
|
|
17942
18040
|
}
|
|
17943
18041
|
const importGenerator = createHmrImportGenerator(namespaceMap);
|
|
17944
18042
|
const tsFunctionDecl = translateStatement(sourceFile, callback, importGenerator);
|
|
17945
|
-
const exportedDecl =
|
|
17946
|
-
|
|
17947
|
-
|
|
18043
|
+
const exportedDecl = ts13.factory.updateFunctionDeclaration(tsFunctionDecl, [
|
|
18044
|
+
ts13.factory.createToken(ts13.SyntaxKind.ExportKeyword),
|
|
18045
|
+
ts13.factory.createToken(ts13.SyntaxKind.DefaultKeyword)
|
|
17948
18046
|
], tsFunctionDecl.asteriskToken, tsFunctionDecl.name, tsFunctionDecl.typeParameters, tsFunctionDecl.parameters, tsFunctionDecl.type, tsFunctionDecl.body);
|
|
17949
|
-
const printer =
|
|
17950
|
-
newLine:
|
|
18047
|
+
const printer = ts13.createPrinter({
|
|
18048
|
+
newLine: ts13.NewLineKind.LineFeed,
|
|
17951
18049
|
removeComments: false
|
|
17952
18050
|
});
|
|
17953
|
-
const fnText = printer.printNode(
|
|
18051
|
+
const fnText = printer.printNode(ts13.EmitHint.Unspecified, exportedDecl, sourceFile);
|
|
17954
18052
|
const provisionalMethodsBlock = buildFreshClassMethodsBlock(classNode, className) ?? "";
|
|
17955
18053
|
const referencedNames = new Set;
|
|
17956
18054
|
const identRe = /[A-Za-z_$][A-Za-z0-9_$]*/g;
|
|
@@ -17960,33 +18058,33 @@ ${block}
|
|
|
17960
18058
|
}
|
|
17961
18059
|
const sourceScopeNames = new Set;
|
|
17962
18060
|
for (const stmt of sourceFile.statements) {
|
|
17963
|
-
if (
|
|
17964
|
-
if (!
|
|
18061
|
+
if (ts13.isImportDeclaration(stmt)) {
|
|
18062
|
+
if (!ts13.isStringLiteral(stmt.moduleSpecifier))
|
|
17965
18063
|
continue;
|
|
17966
18064
|
const clause = stmt.importClause;
|
|
17967
18065
|
if (clause?.name)
|
|
17968
18066
|
sourceScopeNames.add(clause.name.text);
|
|
17969
|
-
if (clause?.namedBindings &&
|
|
18067
|
+
if (clause?.namedBindings && ts13.isNamedImports(clause.namedBindings)) {
|
|
17970
18068
|
for (const el of clause.namedBindings.elements) {
|
|
17971
18069
|
if (el.isTypeOnly)
|
|
17972
18070
|
continue;
|
|
17973
18071
|
sourceScopeNames.add(el.name.text);
|
|
17974
18072
|
}
|
|
17975
|
-
} else if (clause?.namedBindings &&
|
|
18073
|
+
} else if (clause?.namedBindings && ts13.isNamespaceImport(clause.namedBindings)) {
|
|
17976
18074
|
sourceScopeNames.add(clause.namedBindings.name.text);
|
|
17977
18075
|
}
|
|
17978
18076
|
continue;
|
|
17979
18077
|
}
|
|
17980
|
-
if (
|
|
18078
|
+
if (ts13.isVariableStatement(stmt) || stmt.kind === ts13.SyntaxKind.VariableStatement) {
|
|
17981
18079
|
const varStmt = stmt;
|
|
17982
18080
|
for (const decl of varStmt.declarationList.declarations) {
|
|
17983
|
-
if (
|
|
18081
|
+
if (ts13.isIdentifier(decl.name)) {
|
|
17984
18082
|
sourceScopeNames.add(decl.name.text);
|
|
17985
18083
|
}
|
|
17986
18084
|
}
|
|
17987
18085
|
continue;
|
|
17988
18086
|
}
|
|
17989
|
-
if (
|
|
18087
|
+
if (ts13.isFunctionDeclaration(stmt) || ts13.isClassDeclaration(stmt)) {
|
|
17990
18088
|
if (stmt.name)
|
|
17991
18089
|
sourceScopeNames.add(stmt.name.text);
|
|
17992
18090
|
}
|
|
@@ -17997,7 +18095,7 @@ ${block}
|
|
|
17997
18095
|
}
|
|
17998
18096
|
const allImportedNames = new Set;
|
|
17999
18097
|
for (const stmt of sourceFile.statements) {
|
|
18000
|
-
if (!
|
|
18098
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
18001
18099
|
continue;
|
|
18002
18100
|
const clause = stmt.importClause;
|
|
18003
18101
|
if (!clause || clause.isTypeOnly)
|
|
@@ -18007,7 +18105,7 @@ ${block}
|
|
|
18007
18105
|
const bindings = clause.namedBindings;
|
|
18008
18106
|
if (!bindings)
|
|
18009
18107
|
continue;
|
|
18010
|
-
if (
|
|
18108
|
+
if (ts13.isNamespaceImport(bindings)) {
|
|
18011
18109
|
allImportedNames.add(bindings.name.text);
|
|
18012
18110
|
} else {
|
|
18013
18111
|
for (const el of bindings.elements) {
|
|
@@ -18019,10 +18117,10 @@ ${block}
|
|
|
18019
18117
|
}
|
|
18020
18118
|
const depsToDestructure = [...sourceScopeNames].filter((n) => referencedNames.has(n) || allImportedNames.has(n));
|
|
18021
18119
|
const tsSourceText = fnText;
|
|
18022
|
-
const transpiled =
|
|
18120
|
+
const transpiled = ts13.transpileModule(tsSourceText, {
|
|
18023
18121
|
compilerOptions: {
|
|
18024
|
-
module:
|
|
18025
|
-
target:
|
|
18122
|
+
module: ts13.ModuleKind.ES2022,
|
|
18123
|
+
target: ts13.ScriptTarget.ES2022
|
|
18026
18124
|
},
|
|
18027
18125
|
fileName: componentFilePath,
|
|
18028
18126
|
reportDiagnostics: false
|
|
@@ -18565,16 +18663,16 @@ __export(exports_compileEmber, {
|
|
|
18565
18663
|
getEmberServerCompiledDir: () => getEmberServerCompiledDir,
|
|
18566
18664
|
getEmberCompiledRoot: () => getEmberCompiledRoot,
|
|
18567
18665
|
getEmberClientCompiledDir: () => getEmberClientCompiledDir,
|
|
18568
|
-
dirname: () =>
|
|
18666
|
+
dirname: () => dirname20,
|
|
18569
18667
|
compileEmberFileSource: () => compileEmberFileSource,
|
|
18570
18668
|
compileEmberFile: () => compileEmberFile,
|
|
18571
18669
|
compileEmber: () => compileEmber,
|
|
18572
18670
|
clearEmberCompilerCache: () => clearEmberCompilerCache,
|
|
18573
18671
|
basename: () => basename10
|
|
18574
18672
|
});
|
|
18575
|
-
import { existsSync as
|
|
18673
|
+
import { existsSync as existsSync25 } from "fs";
|
|
18576
18674
|
import { mkdir as mkdir6, rm as rm4 } from "fs/promises";
|
|
18577
|
-
import { basename as basename10, dirname as
|
|
18675
|
+
import { basename as basename10, dirname as dirname20, extname as extname7, join as join31, resolve as resolve27 } from "path";
|
|
18578
18676
|
var {build: bunBuild2, Transpiler: Transpiler4, write: write4, file: file4 } = globalThis.Bun;
|
|
18579
18677
|
var cachedPreprocessor = null, getPreprocessor = async () => {
|
|
18580
18678
|
if (cachedPreprocessor)
|
|
@@ -18670,11 +18768,11 @@ export const importSync = (specifier) => {
|
|
|
18670
18768
|
const originalImporter = stagedSourceMap.get(args.importer);
|
|
18671
18769
|
if (!originalImporter)
|
|
18672
18770
|
return;
|
|
18673
|
-
const candidateBase = resolve27(
|
|
18771
|
+
const candidateBase = resolve27(dirname20(originalImporter), args.path);
|
|
18674
18772
|
const extensionsToTry = ["", ".gts", ".gjs", ".ts", ".js"];
|
|
18675
18773
|
for (const ext of extensionsToTry) {
|
|
18676
18774
|
const candidate = candidateBase + ext;
|
|
18677
|
-
if (
|
|
18775
|
+
if (existsSync25(candidate))
|
|
18678
18776
|
return { path: candidate };
|
|
18679
18777
|
}
|
|
18680
18778
|
return;
|
|
@@ -18693,8 +18791,8 @@ export const importSync = (specifier) => {
|
|
|
18693
18791
|
build2.onResolve({ filter: /^@(?:ember|glimmer|simple-dom)\// }, (args) => {
|
|
18694
18792
|
if (standalonePackages.has(args.path))
|
|
18695
18793
|
return;
|
|
18696
|
-
const internal =
|
|
18697
|
-
if (
|
|
18794
|
+
const internal = join31(cwd, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
18795
|
+
if (existsSync25(internal))
|
|
18698
18796
|
return { path: internal };
|
|
18699
18797
|
return;
|
|
18700
18798
|
});
|
|
@@ -18741,16 +18839,16 @@ export default PageComponent;
|
|
|
18741
18839
|
}
|
|
18742
18840
|
const transpiled = transpiler5.transformSync(preprocessed);
|
|
18743
18841
|
const baseName = basename10(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
|
|
18744
|
-
const tmpDir =
|
|
18745
|
-
const serverDir =
|
|
18746
|
-
const clientDir =
|
|
18842
|
+
const tmpDir = join31(compiledRoot, "_tmp");
|
|
18843
|
+
const serverDir = join31(compiledRoot, "server");
|
|
18844
|
+
const clientDir = join31(compiledRoot, "client");
|
|
18747
18845
|
await Promise.all([
|
|
18748
18846
|
mkdir6(tmpDir, { recursive: true }),
|
|
18749
18847
|
mkdir6(serverDir, { recursive: true }),
|
|
18750
18848
|
mkdir6(clientDir, { recursive: true })
|
|
18751
18849
|
]);
|
|
18752
|
-
const tmpPagePath = resolve27(
|
|
18753
|
-
const tmpHarnessPath = resolve27(
|
|
18850
|
+
const tmpPagePath = resolve27(join31(tmpDir, `${baseName}.module.js`));
|
|
18851
|
+
const tmpHarnessPath = resolve27(join31(tmpDir, `${baseName}.harness.js`));
|
|
18754
18852
|
await Promise.all([
|
|
18755
18853
|
write4(tmpPagePath, transpiled),
|
|
18756
18854
|
write4(tmpHarnessPath, generateServerHarness(tmpPagePath))
|
|
@@ -18758,7 +18856,7 @@ export default PageComponent;
|
|
|
18758
18856
|
const stagedSourceMap = new Map([
|
|
18759
18857
|
[tmpPagePath, resolvedEntry]
|
|
18760
18858
|
]);
|
|
18761
|
-
const serverPath =
|
|
18859
|
+
const serverPath = join31(serverDir, `${baseName}.js`);
|
|
18762
18860
|
const buildResult = await bunBuild2({
|
|
18763
18861
|
entrypoints: [tmpHarnessPath],
|
|
18764
18862
|
format: "esm",
|
|
@@ -18775,7 +18873,7 @@ export default PageComponent;
|
|
|
18775
18873
|
console.warn(`\u26A0\uFE0F Ember server build for ${baseName} had errors:`, buildResult.logs);
|
|
18776
18874
|
}
|
|
18777
18875
|
await rm4(tmpDir, { force: true, recursive: true });
|
|
18778
|
-
const clientPath =
|
|
18876
|
+
const clientPath = join31(clientDir, `${baseName}.js`);
|
|
18779
18877
|
await write4(clientPath, transpiled);
|
|
18780
18878
|
return { clientPath, serverPath };
|
|
18781
18879
|
}, compileEmber = async (entries, emberDir, cwd = process.cwd(), _hmr = false) => {
|
|
@@ -18803,7 +18901,7 @@ export default PageComponent;
|
|
|
18803
18901
|
preprocessed = rewriteTemplateEvalToScope(result.code);
|
|
18804
18902
|
}
|
|
18805
18903
|
return transpiler5.transformSync(preprocessed);
|
|
18806
|
-
}, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (_emberDir) => getFrameworkGeneratedDir("ember"), getEmberServerCompiledDir = (emberDir) =>
|
|
18904
|
+
}, clearEmberCompilerCache = () => {}, getEmberCompiledRoot = (_emberDir) => getFrameworkGeneratedDir("ember"), getEmberServerCompiledDir = (emberDir) => join31(getEmberCompiledRoot(emberDir), "server"), getEmberClientCompiledDir = (emberDir) => join31(getEmberCompiledRoot(emberDir), "client");
|
|
18807
18905
|
var init_compileEmber = __esm(() => {
|
|
18808
18906
|
init_generatedDir();
|
|
18809
18907
|
transpiler5 = new Transpiler4({
|
|
@@ -18824,8 +18922,8 @@ __export(exports_buildReactVendor, {
|
|
|
18824
18922
|
computeVendorPaths: () => computeVendorPaths,
|
|
18825
18923
|
buildReactVendor: () => buildReactVendor
|
|
18826
18924
|
});
|
|
18827
|
-
import { existsSync as
|
|
18828
|
-
import { join as
|
|
18925
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync10 } from "fs";
|
|
18926
|
+
import { join as join32, resolve as resolve28 } from "path";
|
|
18829
18927
|
import { rm as rm5 } from "fs/promises";
|
|
18830
18928
|
var {build: bunBuild3 } = globalThis.Bun;
|
|
18831
18929
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
@@ -18838,7 +18936,7 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
18838
18936
|
resolve28(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
18839
18937
|
];
|
|
18840
18938
|
for (const candidate of candidates) {
|
|
18841
|
-
if (
|
|
18939
|
+
if (existsSync26(candidate)) {
|
|
18842
18940
|
return candidate.replace(/\\/g, "/");
|
|
18843
18941
|
}
|
|
18844
18942
|
}
|
|
@@ -18879,14 +18977,14 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
18879
18977
|
`)}
|
|
18880
18978
|
`;
|
|
18881
18979
|
}, buildReactVendor = async (buildDir) => {
|
|
18882
|
-
const vendorDir =
|
|
18980
|
+
const vendorDir = join32(buildDir, "react", "vendor");
|
|
18883
18981
|
mkdirSync10(vendorDir, { recursive: true });
|
|
18884
|
-
const tmpDir =
|
|
18982
|
+
const tmpDir = join32(buildDir, "_vendor_tmp");
|
|
18885
18983
|
mkdirSync10(tmpDir, { recursive: true });
|
|
18886
18984
|
const specifiers = resolveVendorSpecifiers();
|
|
18887
18985
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
18888
18986
|
const safeName = toSafeFileName(specifier);
|
|
18889
|
-
const entryPath =
|
|
18987
|
+
const entryPath = join32(tmpDir, `${safeName}.ts`);
|
|
18890
18988
|
const source = await generateEntrySource(specifier);
|
|
18891
18989
|
await Bun.write(entryPath, source);
|
|
18892
18990
|
return entryPath;
|
|
@@ -18951,7 +19049,7 @@ __export(exports_buildAngularVendor, {
|
|
|
18951
19049
|
buildAngularServerVendor: () => buildAngularServerVendor
|
|
18952
19050
|
});
|
|
18953
19051
|
import { mkdirSync as mkdirSync11 } from "fs";
|
|
18954
|
-
import { join as
|
|
19052
|
+
import { join as join33 } from "path";
|
|
18955
19053
|
import { rm as rm6 } from "fs/promises";
|
|
18956
19054
|
var {build: bunBuild4, Glob: Glob7 } = globalThis.Bun;
|
|
18957
19055
|
var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => jitMode ? [...REQUIRED_ANGULAR_SPECIFIERS_BASE, "@angular/compiler"] : REQUIRED_ANGULAR_SPECIFIERS_BASE, SERVER_ONLY_ANGULAR_SPECIFIERS, BUILD_ONLY_ANGULAR_SPECIFIER_PREFIXES, isBuildOnlyAngularSpecifier = (spec) => BUILD_ONLY_ANGULAR_SPECIFIER_PREFIXES.some((prefix) => spec === prefix || spec.startsWith(`${prefix}/`)), SCAN_SKIP_DIRS, isResolvable2 = (specifier) => {
|
|
@@ -18988,7 +19086,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
18988
19086
|
}
|
|
18989
19087
|
return { angular, transitiveRoots };
|
|
18990
19088
|
}, PARTIAL_DECL_MARKERS, containsPartialDeclarations = (source) => PARTIAL_DECL_MARKERS.some((marker) => source.includes(marker)), collectTransitiveAngularSpecs = async (roots, angularFound) => {
|
|
18991
|
-
const { readFileSync:
|
|
19089
|
+
const { readFileSync: readFileSync20 } = await import("fs");
|
|
18992
19090
|
const transpiler6 = new Bun.Transpiler({ loader: "js" });
|
|
18993
19091
|
const visited = new Set;
|
|
18994
19092
|
const frontier = [];
|
|
@@ -19009,7 +19107,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
19009
19107
|
}
|
|
19010
19108
|
let content;
|
|
19011
19109
|
try {
|
|
19012
|
-
content =
|
|
19110
|
+
content = readFileSync20(resolved, "utf-8");
|
|
19013
19111
|
} catch {
|
|
19014
19112
|
continue;
|
|
19015
19113
|
}
|
|
@@ -19048,14 +19146,14 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
19048
19146
|
await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
|
|
19049
19147
|
return Array.from(angular).filter(isResolvable2);
|
|
19050
19148
|
}, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false, depVendorSpecifiers = []) => {
|
|
19051
|
-
const vendorDir =
|
|
19149
|
+
const vendorDir = join33(buildDir, "angular", "vendor");
|
|
19052
19150
|
mkdirSync11(vendorDir, { recursive: true });
|
|
19053
|
-
const tmpDir =
|
|
19151
|
+
const tmpDir = join33(buildDir, "_angular_vendor_tmp");
|
|
19054
19152
|
mkdirSync11(tmpDir, { recursive: true });
|
|
19055
19153
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
19056
19154
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
19057
19155
|
const safeName = toSafeFileName2(specifier);
|
|
19058
|
-
const entryPath =
|
|
19156
|
+
const entryPath = join33(tmpDir, `${safeName}.ts`);
|
|
19059
19157
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
19060
19158
|
return entryPath;
|
|
19061
19159
|
}));
|
|
@@ -19086,9 +19184,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
19086
19184
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
19087
19185
|
return computeAngularVendorPaths(specifiers);
|
|
19088
19186
|
}, buildAngularServerVendor = async (buildDir, directories = [], linkerJitMode = false) => {
|
|
19089
|
-
const vendorDir =
|
|
19187
|
+
const vendorDir = join33(buildDir, "angular", "vendor", "server");
|
|
19090
19188
|
mkdirSync11(vendorDir, { recursive: true });
|
|
19091
|
-
const tmpDir =
|
|
19189
|
+
const tmpDir = join33(buildDir, "_angular_server_vendor_tmp");
|
|
19092
19190
|
mkdirSync11(tmpDir, { recursive: true });
|
|
19093
19191
|
const browserSpecs = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
19094
19192
|
const allSpecs = new Set(browserSpecs);
|
|
@@ -19099,7 +19197,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
19099
19197
|
const specifiers = Array.from(allSpecs);
|
|
19100
19198
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
19101
19199
|
const safeName = toSafeFileName2(specifier);
|
|
19102
|
-
const entryPath =
|
|
19200
|
+
const entryPath = join33(tmpDir, `${safeName}.ts`);
|
|
19103
19201
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
19104
19202
|
return entryPath;
|
|
19105
19203
|
}));
|
|
@@ -19121,9 +19219,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
19121
19219
|
return specifiers;
|
|
19122
19220
|
}, computeAngularServerVendorPaths = (buildDir, specifiers) => {
|
|
19123
19221
|
const paths = {};
|
|
19124
|
-
const vendorDir =
|
|
19222
|
+
const vendorDir = join33(buildDir, "angular", "vendor", "server");
|
|
19125
19223
|
for (const specifier of specifiers) {
|
|
19126
|
-
paths[specifier] =
|
|
19224
|
+
paths[specifier] = join33(vendorDir, `${toSafeFileName2(specifier)}.js`);
|
|
19127
19225
|
}
|
|
19128
19226
|
return paths;
|
|
19129
19227
|
}, computeAngularServerVendorPathsAsync = async (buildDir, directories = [], linkerJitMode = true) => {
|
|
@@ -19179,17 +19277,17 @@ __export(exports_buildVueVendor, {
|
|
|
19179
19277
|
buildVueVendor: () => buildVueVendor
|
|
19180
19278
|
});
|
|
19181
19279
|
import { mkdirSync as mkdirSync12 } from "fs";
|
|
19182
|
-
import { join as
|
|
19280
|
+
import { join as join34 } from "path";
|
|
19183
19281
|
import { rm as rm7 } from "fs/promises";
|
|
19184
19282
|
var {build: bunBuild5 } = globalThis.Bun;
|
|
19185
19283
|
var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
|
|
19186
|
-
const vendorDir =
|
|
19284
|
+
const vendorDir = join34(buildDir, "vue", "vendor");
|
|
19187
19285
|
mkdirSync12(vendorDir, { recursive: true });
|
|
19188
|
-
const tmpDir =
|
|
19286
|
+
const tmpDir = join34(buildDir, "_vue_vendor_tmp");
|
|
19189
19287
|
mkdirSync12(tmpDir, { recursive: true });
|
|
19190
19288
|
const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
|
|
19191
19289
|
const safeName = toSafeFileName3(specifier);
|
|
19192
|
-
const entryPath =
|
|
19290
|
+
const entryPath = join34(tmpDir, `${safeName}.ts`);
|
|
19193
19291
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
19194
19292
|
`);
|
|
19195
19293
|
return entryPath;
|
|
@@ -19214,11 +19312,11 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
19214
19312
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
19215
19313
|
return;
|
|
19216
19314
|
}
|
|
19217
|
-
const { readFileSync:
|
|
19315
|
+
const { readFileSync: readFileSync20, writeFileSync: writeFileSync11, readdirSync: readdirSync4 } = await import("fs");
|
|
19218
19316
|
const files = readdirSync4(vendorDir).filter((f2) => f2.endsWith(".js"));
|
|
19219
19317
|
for (const file5 of files) {
|
|
19220
|
-
const filePath =
|
|
19221
|
-
const content =
|
|
19318
|
+
const filePath = join34(vendorDir, file5);
|
|
19319
|
+
const content = readFileSync20(filePath, "utf-8");
|
|
19222
19320
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
19223
19321
|
continue;
|
|
19224
19322
|
const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
|
|
@@ -19244,7 +19342,7 @@ __export(exports_buildSvelteVendor, {
|
|
|
19244
19342
|
buildSvelteVendor: () => buildSvelteVendor
|
|
19245
19343
|
});
|
|
19246
19344
|
import { mkdirSync as mkdirSync13 } from "fs";
|
|
19247
|
-
import { join as
|
|
19345
|
+
import { join as join35 } from "path";
|
|
19248
19346
|
import { rm as rm8 } from "fs/promises";
|
|
19249
19347
|
var {build: bunBuild6 } = globalThis.Bun;
|
|
19250
19348
|
var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
@@ -19258,13 +19356,13 @@ var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
|
19258
19356
|
const specifiers = resolveVendorSpecifiers2();
|
|
19259
19357
|
if (specifiers.length === 0)
|
|
19260
19358
|
return;
|
|
19261
|
-
const vendorDir =
|
|
19359
|
+
const vendorDir = join35(buildDir, "svelte", "vendor");
|
|
19262
19360
|
mkdirSync13(vendorDir, { recursive: true });
|
|
19263
|
-
const tmpDir =
|
|
19361
|
+
const tmpDir = join35(buildDir, "_svelte_vendor_tmp");
|
|
19264
19362
|
mkdirSync13(tmpDir, { recursive: true });
|
|
19265
19363
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
19266
19364
|
const safeName = toSafeFileName4(specifier);
|
|
19267
|
-
const entryPath =
|
|
19365
|
+
const entryPath = join35(tmpDir, `${safeName}.ts`);
|
|
19268
19366
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
19269
19367
|
`);
|
|
19270
19368
|
return entryPath;
|
|
@@ -19314,7 +19412,7 @@ __export(exports_rewriteImportsPlugin, {
|
|
|
19314
19412
|
buildWithImportRewrite: () => buildWithImportRewrite
|
|
19315
19413
|
});
|
|
19316
19414
|
import { readdir as readdir3 } from "fs/promises";
|
|
19317
|
-
import { join as
|
|
19415
|
+
import { join as join36 } from "path";
|
|
19318
19416
|
var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
|
|
19319
19417
|
let result = content;
|
|
19320
19418
|
for (const [specifier, webPath] of replacements) {
|
|
@@ -19443,7 +19541,7 @@ ${content}`;
|
|
|
19443
19541
|
const entries = await readdir3(dir);
|
|
19444
19542
|
for (const entry of entries) {
|
|
19445
19543
|
if (entry.endsWith(".js"))
|
|
19446
|
-
allFiles.push(
|
|
19544
|
+
allFiles.push(join36(dir, entry));
|
|
19447
19545
|
}
|
|
19448
19546
|
} catch {}
|
|
19449
19547
|
}
|
|
@@ -19485,14 +19583,14 @@ var init_rewriteImportsPlugin = __esm(() => {
|
|
|
19485
19583
|
import {
|
|
19486
19584
|
copyFileSync as copyFileSync2,
|
|
19487
19585
|
cpSync,
|
|
19488
|
-
existsSync as
|
|
19586
|
+
existsSync as existsSync27,
|
|
19489
19587
|
mkdirSync as mkdirSync14,
|
|
19490
|
-
readFileSync as
|
|
19588
|
+
readFileSync as readFileSync20,
|
|
19491
19589
|
rmSync as rmSync2,
|
|
19492
19590
|
statSync as statSync3,
|
|
19493
19591
|
writeFileSync as writeFileSync11
|
|
19494
19592
|
} from "fs";
|
|
19495
|
-
import { basename as basename11, dirname as
|
|
19593
|
+
import { basename as basename11, dirname as dirname21, extname as extname8, join as join37, relative as relative15, resolve as resolve29 } from "path";
|
|
19496
19594
|
import { cwd, env as env3, exit } from "process";
|
|
19497
19595
|
var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
|
|
19498
19596
|
var isDev2, isBuildTraceEnabled = () => {
|
|
@@ -19570,8 +19668,8 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
19570
19668
|
mkdirSync14(htmxDestDir, { recursive: true });
|
|
19571
19669
|
const glob = new Glob8("htmx*.min.js");
|
|
19572
19670
|
for (const relPath of glob.scanSync({ cwd: htmxDir })) {
|
|
19573
|
-
const src =
|
|
19574
|
-
const dest =
|
|
19671
|
+
const src = join37(htmxDir, relPath);
|
|
19672
|
+
const dest = join37(htmxDestDir, "htmx.min.js");
|
|
19575
19673
|
copyFileSync2(src, dest);
|
|
19576
19674
|
return;
|
|
19577
19675
|
}
|
|
@@ -19615,7 +19713,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
19615
19713
|
addWorkerPathIfExists(file5, relPath, workerPaths);
|
|
19616
19714
|
}
|
|
19617
19715
|
}, collectWorkerPathsFromFile = (file5, patterns, workerPaths) => {
|
|
19618
|
-
const content =
|
|
19716
|
+
const content = readFileSync20(file5, "utf-8");
|
|
19619
19717
|
for (const pattern of patterns) {
|
|
19620
19718
|
collectWorkerPathsFromContent(content, pattern, file5, workerPaths);
|
|
19621
19719
|
}
|
|
@@ -19646,7 +19744,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
19646
19744
|
vuePagesPath
|
|
19647
19745
|
}) => {
|
|
19648
19746
|
const { readdirSync: readDir } = await import("fs");
|
|
19649
|
-
const devIndexDir =
|
|
19747
|
+
const devIndexDir = join37(buildPath, "_src_indexes");
|
|
19650
19748
|
mkdirSync14(devIndexDir, { recursive: true });
|
|
19651
19749
|
if (reactIndexesPath && reactPagesPath) {
|
|
19652
19750
|
copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
|
|
@@ -19658,41 +19756,41 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
19658
19756
|
copyVueDevIndexes(vueDir, vuePagesPath, vueEntries, devIndexDir);
|
|
19659
19757
|
}
|
|
19660
19758
|
}, copyReactDevIndexes = (reactIndexesPath, reactPagesPath, devIndexDir, readDir) => {
|
|
19661
|
-
if (!
|
|
19759
|
+
if (!existsSync27(reactIndexesPath)) {
|
|
19662
19760
|
return;
|
|
19663
19761
|
}
|
|
19664
19762
|
const indexFiles = readDir(reactIndexesPath).filter((file5) => file5.endsWith(".tsx"));
|
|
19665
19763
|
const pagesRel = relative15(process.cwd(), resolve29(reactPagesPath)).replace(/\\/g, "/");
|
|
19666
19764
|
for (const file5 of indexFiles) {
|
|
19667
|
-
let content =
|
|
19765
|
+
let content = readFileSync20(join37(reactIndexesPath, file5), "utf-8");
|
|
19668
19766
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
19669
|
-
writeFileSync11(
|
|
19767
|
+
writeFileSync11(join37(devIndexDir, file5), content);
|
|
19670
19768
|
}
|
|
19671
19769
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
19672
|
-
const svelteIndexDir =
|
|
19770
|
+
const svelteIndexDir = join37(getFrameworkGeneratedDir("svelte"), "indexes");
|
|
19673
19771
|
const sveltePageEntries = svelteEntries.filter((file5) => resolve29(file5).startsWith(resolve29(sveltePagesPath)));
|
|
19674
19772
|
for (const entry of sveltePageEntries) {
|
|
19675
19773
|
const name = basename11(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
19676
|
-
const indexFile =
|
|
19677
|
-
if (!
|
|
19774
|
+
const indexFile = join37(svelteIndexDir, "pages", `${name}.js`);
|
|
19775
|
+
if (!existsSync27(indexFile))
|
|
19678
19776
|
continue;
|
|
19679
|
-
let content =
|
|
19777
|
+
let content = readFileSync20(indexFile, "utf-8");
|
|
19680
19778
|
const srcRel = relative15(process.cwd(), resolve29(entry)).replace(/\\/g, "/");
|
|
19681
19779
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
19682
|
-
writeFileSync11(
|
|
19780
|
+
writeFileSync11(join37(devIndexDir, `${name}.svelte.js`), content);
|
|
19683
19781
|
}
|
|
19684
19782
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
19685
|
-
const vueIndexDir =
|
|
19783
|
+
const vueIndexDir = join37(getFrameworkGeneratedDir("vue"), "indexes");
|
|
19686
19784
|
const vuePageEntries = vueEntries.filter((file5) => resolve29(file5).startsWith(resolve29(vuePagesPath)));
|
|
19687
19785
|
for (const entry of vuePageEntries) {
|
|
19688
19786
|
const name = basename11(entry, ".vue");
|
|
19689
|
-
const indexFile =
|
|
19690
|
-
if (!
|
|
19787
|
+
const indexFile = join37(vueIndexDir, `${name}.js`);
|
|
19788
|
+
if (!existsSync27(indexFile))
|
|
19691
19789
|
continue;
|
|
19692
|
-
let content =
|
|
19790
|
+
let content = readFileSync20(indexFile, "utf-8");
|
|
19693
19791
|
const srcRel = relative15(process.cwd(), resolve29(entry)).replace(/\\/g, "/");
|
|
19694
19792
|
content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
|
|
19695
|
-
writeFileSync11(
|
|
19793
|
+
writeFileSync11(join37(devIndexDir, `${name}.vue.js`), content);
|
|
19696
19794
|
}
|
|
19697
19795
|
}, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
|
|
19698
19796
|
const varIdx = content.indexOf(`var ${firstUseName} =`);
|
|
@@ -19740,7 +19838,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
19740
19838
|
}
|
|
19741
19839
|
return result;
|
|
19742
19840
|
}, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
|
|
19743
|
-
let content =
|
|
19841
|
+
let content = readFileSync20(outputPath, "utf-8");
|
|
19744
19842
|
const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
|
|
19745
19843
|
const useNames = [];
|
|
19746
19844
|
let match;
|
|
@@ -19790,7 +19888,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19790
19888
|
}, rewriteUrlReferences = (outputPaths, urlFileMap) => {
|
|
19791
19889
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
19792
19890
|
for (const outputPath of outputPaths) {
|
|
19793
|
-
let content =
|
|
19891
|
+
let content = readFileSync20(outputPath, "utf-8");
|
|
19794
19892
|
let changed = false;
|
|
19795
19893
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
19796
19894
|
const targetName = basename11(relPath);
|
|
@@ -19852,7 +19950,6 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19852
19950
|
htmlDirectory,
|
|
19853
19951
|
htmxDirectory,
|
|
19854
19952
|
angularDirectory,
|
|
19855
|
-
angular,
|
|
19856
19953
|
emberDirectory,
|
|
19857
19954
|
svelteDirectory,
|
|
19858
19955
|
vueDirectory,
|
|
@@ -19916,10 +20013,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19916
20013
|
restoreTracePhase();
|
|
19917
20014
|
return;
|
|
19918
20015
|
}
|
|
19919
|
-
const traceDir =
|
|
20016
|
+
const traceDir = join37(buildPath2, ".absolute-trace");
|
|
19920
20017
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
19921
20018
|
mkdirSync14(traceDir, { recursive: true });
|
|
19922
|
-
writeFileSync11(
|
|
20019
|
+
writeFileSync11(join37(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
|
|
19923
20020
|
events: traceEvents,
|
|
19924
20021
|
frameworks: traceFrameworkNames,
|
|
19925
20022
|
generatedAt: new Date().toISOString(),
|
|
@@ -19950,15 +20047,15 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19950
20047
|
const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
|
|
19951
20048
|
const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
|
|
19952
20049
|
const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
|
|
19953
|
-
const reactIndexesPath = reactDir &&
|
|
19954
|
-
const reactPagesPath = reactDir &&
|
|
19955
|
-
const htmlPagesPath = htmlDir &&
|
|
19956
|
-
const htmlScriptsPath = htmlDir &&
|
|
19957
|
-
const sveltePagesPath = svelteDir &&
|
|
19958
|
-
const vuePagesPath = vueDir &&
|
|
19959
|
-
const htmxPagesPath = htmxDir &&
|
|
19960
|
-
const angularPagesPath = angularDir &&
|
|
19961
|
-
const emberPagesPath = emberDir &&
|
|
20050
|
+
const reactIndexesPath = reactDir && join37(getFrameworkGeneratedDir("react"), "indexes");
|
|
20051
|
+
const reactPagesPath = reactDir && join37(reactDir, "pages");
|
|
20052
|
+
const htmlPagesPath = htmlDir && join37(htmlDir, "pages");
|
|
20053
|
+
const htmlScriptsPath = htmlDir && join37(htmlDir, "scripts");
|
|
20054
|
+
const sveltePagesPath = svelteDir && join37(svelteDir, "pages");
|
|
20055
|
+
const vuePagesPath = vueDir && join37(vueDir, "pages");
|
|
20056
|
+
const htmxPagesPath = htmxDir && join37(htmxDir, "pages");
|
|
20057
|
+
const angularPagesPath = angularDir && join37(angularDir, "pages");
|
|
20058
|
+
const emberPagesPath = emberDir && join37(emberDir, "pages");
|
|
19962
20059
|
const frontends = [
|
|
19963
20060
|
reactDir,
|
|
19964
20061
|
htmlDir,
|
|
@@ -19989,7 +20086,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19989
20086
|
const sourceClientRoots = [
|
|
19990
20087
|
htmlDir,
|
|
19991
20088
|
htmxDir,
|
|
19992
|
-
islandBootstrapPath &&
|
|
20089
|
+
islandBootstrapPath && dirname21(islandBootstrapPath)
|
|
19993
20090
|
].filter((dir) => Boolean(dir));
|
|
19994
20091
|
const usesGenerated = Boolean(reactDir) || Boolean(svelteDir) || Boolean(vueDir) || Boolean(angularDir);
|
|
19995
20092
|
if (usesGenerated)
|
|
@@ -20017,8 +20114,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20017
20114
|
const [firstEntry] = serverDirMap;
|
|
20018
20115
|
if (!firstEntry)
|
|
20019
20116
|
throw new Error("Expected at least one server directory entry");
|
|
20020
|
-
serverRoot =
|
|
20021
|
-
serverOutDir =
|
|
20117
|
+
serverRoot = join37(firstEntry.dir, firstEntry.subdir);
|
|
20118
|
+
serverOutDir = join37(buildPath, basename11(firstEntry.dir));
|
|
20022
20119
|
} else if (serverDirMap.length > 1) {
|
|
20023
20120
|
serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
|
|
20024
20121
|
serverOutDir = buildPath;
|
|
@@ -20046,7 +20143,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20046
20143
|
await tracePhase("react/index-generation", () => generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr));
|
|
20047
20144
|
}
|
|
20048
20145
|
if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/assets/")))) {
|
|
20049
|
-
await tracePhase("assets/copy", () => cpSync(assetsPath,
|
|
20146
|
+
await tracePhase("assets/copy", () => cpSync(assetsPath, join37(buildPath, "assets"), {
|
|
20050
20147
|
force: true,
|
|
20051
20148
|
recursive: true
|
|
20052
20149
|
}));
|
|
@@ -20156,11 +20253,11 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20156
20253
|
}
|
|
20157
20254
|
}
|
|
20158
20255
|
if (htmlDefaults.error || htmlDefaults.notFound || htmlDefaults.loading || Object.keys(htmlPages).length > 0) {
|
|
20159
|
-
const htmlConventionsOutDir =
|
|
20256
|
+
const htmlConventionsOutDir = join37(buildPath, "conventions", "html");
|
|
20160
20257
|
mkdirSync14(htmlConventionsOutDir, { recursive: true });
|
|
20161
20258
|
const htmlPathRemap = new Map;
|
|
20162
20259
|
for (const sourcePath of htmlConventionSources) {
|
|
20163
|
-
const dest =
|
|
20260
|
+
const dest = join37(htmlConventionsOutDir, basename11(sourcePath));
|
|
20164
20261
|
cpSync(sourcePath, dest, { force: true });
|
|
20165
20262
|
htmlPathRemap.set(sourcePath, dest);
|
|
20166
20263
|
}
|
|
@@ -20203,7 +20300,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20203
20300
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
20204
20301
|
if (entry.startsWith(resolve29(reactIndexesPath))) {
|
|
20205
20302
|
const pageName = basename11(entry, ".tsx");
|
|
20206
|
-
return
|
|
20303
|
+
return join37(reactPagesPath, `${pageName}.tsx`);
|
|
20207
20304
|
}
|
|
20208
20305
|
return null;
|
|
20209
20306
|
}) : allReactEntries;
|
|
@@ -20239,9 +20336,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20239
20336
|
if (shouldCompileAngular && angularDir) {
|
|
20240
20337
|
await tracePhase("scan/angular-handlers", async () => {
|
|
20241
20338
|
const { runAngularHandlerScan: runAngularHandlerScan2 } = await Promise.resolve().then(() => (init_runAngularHandlerScan(), exports_runAngularHandlerScan));
|
|
20242
|
-
runAngularHandlerScan2(projectRoot, angularDir
|
|
20243
|
-
providersImport: angular?.providersImport
|
|
20244
|
-
});
|
|
20339
|
+
runAngularHandlerScan2(projectRoot, angularDir);
|
|
20245
20340
|
});
|
|
20246
20341
|
}
|
|
20247
20342
|
const [
|
|
@@ -20271,14 +20366,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20271
20366
|
try {
|
|
20272
20367
|
const { primeComponentFingerprint: primeComponentFingerprint2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
20273
20368
|
const { readdir: readdir4 } = await import("fs/promises");
|
|
20274
|
-
const { join:
|
|
20369
|
+
const { join: join38 } = await import("path");
|
|
20275
20370
|
const walk = async (dir) => {
|
|
20276
20371
|
const entries = await readdir4(dir, {
|
|
20277
20372
|
withFileTypes: true
|
|
20278
20373
|
});
|
|
20279
20374
|
const out = [];
|
|
20280
20375
|
for (const entry of entries) {
|
|
20281
|
-
const full =
|
|
20376
|
+
const full = join38(dir, entry.name);
|
|
20282
20377
|
if (entry.isDirectory()) {
|
|
20283
20378
|
out.push(...await walk(full));
|
|
20284
20379
|
} else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
|
|
@@ -20343,7 +20438,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20343
20438
|
const compileReactConventions = async () => {
|
|
20344
20439
|
if (reactConventionSources.length === 0)
|
|
20345
20440
|
return emptyStringArray;
|
|
20346
|
-
const destDir =
|
|
20441
|
+
const destDir = join37(buildPath, "conventions", "react");
|
|
20347
20442
|
rmSync2(destDir, { force: true, recursive: true });
|
|
20348
20443
|
mkdirSync14(destDir, { recursive: true });
|
|
20349
20444
|
const destPaths = [];
|
|
@@ -20359,7 +20454,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20359
20454
|
naming: `${idx}-[name].[ext]`,
|
|
20360
20455
|
outdir: destDir,
|
|
20361
20456
|
plugins: [stylePreprocessorPlugin2],
|
|
20362
|
-
root:
|
|
20457
|
+
root: dirname21(source),
|
|
20363
20458
|
target: "bun",
|
|
20364
20459
|
throw: false,
|
|
20365
20460
|
tsconfig: "./tsconfig.json"
|
|
@@ -20387,7 +20482,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20387
20482
|
angularConventionSources.length > 0 && angularDir ? tracePhase("compile/convention-angular", () => Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular)).then((mod) => mod.compileAngular(angularConventionSources, angularDir, hmr, styleTransformConfig))) : { serverPaths: emptyStringArray }
|
|
20388
20483
|
]);
|
|
20389
20484
|
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
20390
|
-
const destDir =
|
|
20485
|
+
const destDir = join37(buildPath, "conventions", framework);
|
|
20391
20486
|
rmSync2(destDir, { force: true, recursive: true });
|
|
20392
20487
|
mkdirSync14(destDir, { recursive: true });
|
|
20393
20488
|
const destPaths = [];
|
|
@@ -20461,7 +20556,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20461
20556
|
}
|
|
20462
20557
|
})) : {
|
|
20463
20558
|
entries: [],
|
|
20464
|
-
generatedRoot:
|
|
20559
|
+
generatedRoot: join37(buildPath, "_island_entries")
|
|
20465
20560
|
};
|
|
20466
20561
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
20467
20562
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -20497,7 +20592,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20497
20592
|
return {};
|
|
20498
20593
|
}
|
|
20499
20594
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
20500
|
-
const refreshEntry =
|
|
20595
|
+
const refreshEntry = join37(reactIndexesPath, "_refresh.tsx");
|
|
20501
20596
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
20502
20597
|
reactClientEntryPoints.push(refreshEntry);
|
|
20503
20598
|
}
|
|
@@ -20599,19 +20694,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20599
20694
|
throw: false
|
|
20600
20695
|
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
20601
20696
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
20602
|
-
rmSync2(
|
|
20697
|
+
rmSync2(join37(buildPath, "react", "generated", "indexes"), {
|
|
20603
20698
|
force: true,
|
|
20604
20699
|
recursive: true
|
|
20605
20700
|
});
|
|
20606
20701
|
}
|
|
20607
20702
|
if (angularDir && angularClientPaths.length > 0) {
|
|
20608
|
-
rmSync2(
|
|
20703
|
+
rmSync2(join37(buildPath, "angular", "indexes"), {
|
|
20609
20704
|
force: true,
|
|
20610
20705
|
recursive: true
|
|
20611
20706
|
});
|
|
20612
20707
|
}
|
|
20613
20708
|
if (islandClientEntryPoints.length > 0) {
|
|
20614
|
-
rmSync2(
|
|
20709
|
+
rmSync2(join37(buildPath, "islands"), {
|
|
20615
20710
|
force: true,
|
|
20616
20711
|
recursive: true
|
|
20617
20712
|
});
|
|
@@ -20700,7 +20795,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20700
20795
|
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
|
|
20701
20796
|
entrypoints: globalCssEntries,
|
|
20702
20797
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
20703
|
-
outdir: stylesDir ?
|
|
20798
|
+
outdir: stylesDir ? join37(buildPath, basename11(stylesDir)) : buildPath,
|
|
20704
20799
|
plugins: [stylePreprocessorPlugin2],
|
|
20705
20800
|
root: stylesDir || clientRoot,
|
|
20706
20801
|
target: "browser",
|
|
@@ -20709,7 +20804,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20709
20804
|
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
|
|
20710
20805
|
entrypoints: vueCssPaths,
|
|
20711
20806
|
naming: `[name].[hash].[ext]`,
|
|
20712
|
-
outdir:
|
|
20807
|
+
outdir: join37(buildPath, assetsPath ? basename11(assetsPath) : "assets", "css"),
|
|
20713
20808
|
target: "browser",
|
|
20714
20809
|
throw: false
|
|
20715
20810
|
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
@@ -20783,7 +20878,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20783
20878
|
if (serverOutputs.length > 0 && angularServerVendorPaths2 && Object.keys(angularServerVendorPaths2).length > 0) {
|
|
20784
20879
|
const { rewriteBuildOutputsWith: rewriteBuildOutputsWith2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
20785
20880
|
await tracePhase("postprocess/server-angular-vendor-imports", () => rewriteBuildOutputsWith2(serverOutputs, (artifact) => {
|
|
20786
|
-
const fileDir =
|
|
20881
|
+
const fileDir = dirname21(artifact.path);
|
|
20787
20882
|
const relativePaths = {};
|
|
20788
20883
|
for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
|
|
20789
20884
|
const rel = relative15(fileDir, absolute);
|
|
@@ -20869,7 +20964,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20869
20964
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
20870
20965
|
if (!hmrClientBundle)
|
|
20871
20966
|
return;
|
|
20872
|
-
let html =
|
|
20967
|
+
let html = readFileSync20(filePath, "utf-8");
|
|
20873
20968
|
if (html.includes("data-hmr-client"))
|
|
20874
20969
|
return;
|
|
20875
20970
|
const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
|
|
@@ -20880,7 +20975,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20880
20975
|
const processHtmlPages = async () => {
|
|
20881
20976
|
if (!(htmlDir && htmlPagesPath))
|
|
20882
20977
|
return;
|
|
20883
|
-
const outputHtmlPages = isSingle ?
|
|
20978
|
+
const outputHtmlPages = isSingle ? join37(buildPath, "pages") : join37(buildPath, basename11(htmlDir), "pages");
|
|
20884
20979
|
mkdirSync14(outputHtmlPages, { recursive: true });
|
|
20885
20980
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
20886
20981
|
force: true,
|
|
@@ -20905,14 +21000,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20905
21000
|
const processHtmxPages = async () => {
|
|
20906
21001
|
if (!(htmxDir && htmxPagesPath))
|
|
20907
21002
|
return;
|
|
20908
|
-
const outputHtmxPages = isSingle ?
|
|
21003
|
+
const outputHtmxPages = isSingle ? join37(buildPath, "pages") : join37(buildPath, basename11(htmxDir), "pages");
|
|
20909
21004
|
mkdirSync14(outputHtmxPages, { recursive: true });
|
|
20910
21005
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
20911
21006
|
force: true,
|
|
20912
21007
|
recursive: true
|
|
20913
21008
|
});
|
|
20914
21009
|
if (shouldCopyHtmx) {
|
|
20915
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
21010
|
+
const htmxDestDir = isSingle ? buildPath : join37(buildPath, basename11(htmxDir));
|
|
20916
21011
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
20917
21012
|
}
|
|
20918
21013
|
if (shouldUpdateHtmxAssetPaths) {
|
|
@@ -20977,9 +21072,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20977
21072
|
writeBuildTrace(buildPath);
|
|
20978
21073
|
return { conventions: conventionsMap, manifest };
|
|
20979
21074
|
}
|
|
20980
|
-
writeFileSync11(
|
|
21075
|
+
writeFileSync11(join37(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
20981
21076
|
if (Object.keys(conventionsMap).length > 0) {
|
|
20982
|
-
writeFileSync11(
|
|
21077
|
+
writeFileSync11(join37(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
20983
21078
|
}
|
|
20984
21079
|
writeBuildTrace(buildPath);
|
|
20985
21080
|
if (mode === "production") {
|
|
@@ -21100,8 +21195,8 @@ var init_build = __esm(() => {
|
|
|
21100
21195
|
});
|
|
21101
21196
|
|
|
21102
21197
|
// src/build/buildEmberVendor.ts
|
|
21103
|
-
import { mkdirSync as mkdirSync15, existsSync as
|
|
21104
|
-
import { join as
|
|
21198
|
+
import { mkdirSync as mkdirSync15, existsSync as existsSync28 } from "fs";
|
|
21199
|
+
import { join as join38 } from "path";
|
|
21105
21200
|
import { rm as rm9 } from "fs/promises";
|
|
21106
21201
|
var {build: bunBuild8 } = globalThis.Bun;
|
|
21107
21202
|
var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
|
|
@@ -21153,8 +21248,8 @@ export const importSync = (specifier) => {
|
|
|
21153
21248
|
if (standaloneSpecifiers.has(specifier)) {
|
|
21154
21249
|
return { resolveTo: specifier, specifier };
|
|
21155
21250
|
}
|
|
21156
|
-
const emberInternalPath =
|
|
21157
|
-
if (!
|
|
21251
|
+
const emberInternalPath = join38(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
|
|
21252
|
+
if (!existsSync28(emberInternalPath)) {
|
|
21158
21253
|
throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
|
|
21159
21254
|
}
|
|
21160
21255
|
return { resolveTo: emberInternalPath, specifier };
|
|
@@ -21185,24 +21280,24 @@ export const importSync = (specifier) => {
|
|
|
21185
21280
|
if (standalonePackages.has(args.path)) {
|
|
21186
21281
|
return;
|
|
21187
21282
|
}
|
|
21188
|
-
const internal =
|
|
21189
|
-
if (
|
|
21283
|
+
const internal = join38(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
21284
|
+
if (existsSync28(internal)) {
|
|
21190
21285
|
return { path: internal };
|
|
21191
21286
|
}
|
|
21192
21287
|
return;
|
|
21193
21288
|
});
|
|
21194
21289
|
}
|
|
21195
21290
|
}), buildEmberVendor = async (buildDir, cwd2 = process.cwd()) => {
|
|
21196
|
-
const vendorDir =
|
|
21291
|
+
const vendorDir = join38(buildDir, "ember", "vendor");
|
|
21197
21292
|
mkdirSync15(vendorDir, { recursive: true });
|
|
21198
|
-
const tmpDir =
|
|
21293
|
+
const tmpDir = join38(buildDir, "_ember_vendor_tmp");
|
|
21199
21294
|
mkdirSync15(tmpDir, { recursive: true });
|
|
21200
|
-
const macrosShimPath =
|
|
21295
|
+
const macrosShimPath = join38(tmpDir, "embroider_macros_shim.js");
|
|
21201
21296
|
await Bun.write(macrosShimPath, generateMacrosShim());
|
|
21202
21297
|
const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd2));
|
|
21203
21298
|
const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
|
|
21204
21299
|
const safeName = toSafeFileName5(resolution.specifier);
|
|
21205
|
-
const entryPath =
|
|
21300
|
+
const entryPath = join38(tmpDir, `${safeName}.js`);
|
|
21206
21301
|
const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
|
|
21207
21302
|
` : generateVendorEntrySource2(resolution);
|
|
21208
21303
|
await Bun.write(entryPath, source);
|
|
@@ -21255,7 +21350,7 @@ __export(exports_dependencyGraph, {
|
|
|
21255
21350
|
buildInitialDependencyGraph: () => buildInitialDependencyGraph,
|
|
21256
21351
|
addFileToGraph: () => addFileToGraph
|
|
21257
21352
|
});
|
|
21258
|
-
import { existsSync as
|
|
21353
|
+
import { existsSync as existsSync29, readFileSync as readFileSync21 } from "fs";
|
|
21259
21354
|
var {Glob: Glob9 } = globalThis.Bun;
|
|
21260
21355
|
import { resolve as resolve30 } from "path";
|
|
21261
21356
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
@@ -21285,10 +21380,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
21285
21380
|
];
|
|
21286
21381
|
for (const ext of extensions) {
|
|
21287
21382
|
const withExt = normalized + ext;
|
|
21288
|
-
if (
|
|
21383
|
+
if (existsSync29(withExt))
|
|
21289
21384
|
return withExt;
|
|
21290
21385
|
}
|
|
21291
|
-
if (
|
|
21386
|
+
if (existsSync29(normalized))
|
|
21292
21387
|
return normalized;
|
|
21293
21388
|
return null;
|
|
21294
21389
|
}, clearExistingDependents = (graph, normalizedPath) => {
|
|
@@ -21303,7 +21398,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
21303
21398
|
}
|
|
21304
21399
|
}, addFileToGraph = (graph, filePath) => {
|
|
21305
21400
|
const normalizedPath = resolve30(filePath);
|
|
21306
|
-
if (!
|
|
21401
|
+
if (!existsSync29(normalizedPath))
|
|
21307
21402
|
return;
|
|
21308
21403
|
const dependencies = extractDependencies(normalizedPath);
|
|
21309
21404
|
clearExistingDependents(graph, normalizedPath);
|
|
@@ -21329,7 +21424,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
21329
21424
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
21330
21425
|
const processedFiles = new Set;
|
|
21331
21426
|
const glob = new Glob9("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
21332
|
-
const resolvedDirs = directories.map((dir) => resolve30(dir)).filter((dir) =>
|
|
21427
|
+
const resolvedDirs = directories.map((dir) => resolve30(dir)).filter((dir) => existsSync29(dir));
|
|
21333
21428
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
21334
21429
|
for (const file5 of allFiles) {
|
|
21335
21430
|
const fullPath = resolve30(file5);
|
|
@@ -21426,15 +21521,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
21426
21521
|
const lowerPath = filePath.toLowerCase();
|
|
21427
21522
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
21428
21523
|
if (loader === "html") {
|
|
21429
|
-
const content =
|
|
21524
|
+
const content = readFileSync21(filePath, "utf-8");
|
|
21430
21525
|
return extractHtmlDependencies(filePath, content);
|
|
21431
21526
|
}
|
|
21432
21527
|
if (loader === "tsx" || loader === "js") {
|
|
21433
|
-
const content =
|
|
21528
|
+
const content = readFileSync21(filePath, "utf-8");
|
|
21434
21529
|
return extractJsDependencies(filePath, content, loader);
|
|
21435
21530
|
}
|
|
21436
21531
|
if (isSvelteOrVue) {
|
|
21437
|
-
const content =
|
|
21532
|
+
const content = readFileSync21(filePath, "utf-8");
|
|
21438
21533
|
return extractSvelteVueDependencies(filePath, content);
|
|
21439
21534
|
}
|
|
21440
21535
|
return [];
|
|
@@ -21577,8 +21672,8 @@ var init_clientManager = __esm(() => {
|
|
|
21577
21672
|
});
|
|
21578
21673
|
|
|
21579
21674
|
// src/dev/pathUtils.ts
|
|
21580
|
-
import { existsSync as
|
|
21581
|
-
import { dirname as
|
|
21675
|
+
import { existsSync as existsSync30, readdirSync as readdirSync4, readFileSync as readFileSync22 } from "fs";
|
|
21676
|
+
import { dirname as dirname22, resolve as resolve32 } from "path";
|
|
21582
21677
|
var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
21583
21678
|
if (shouldIgnorePath(filePath, resolved)) {
|
|
21584
21679
|
return "ignored";
|
|
@@ -21677,7 +21772,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
21677
21772
|
}
|
|
21678
21773
|
let source;
|
|
21679
21774
|
try {
|
|
21680
|
-
source =
|
|
21775
|
+
source = readFileSync22(full, "utf8");
|
|
21681
21776
|
} catch {
|
|
21682
21777
|
continue;
|
|
21683
21778
|
}
|
|
@@ -21706,10 +21801,10 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
21706
21801
|
refs.push(strMatch[1]);
|
|
21707
21802
|
}
|
|
21708
21803
|
}
|
|
21709
|
-
const componentDir =
|
|
21804
|
+
const componentDir = dirname22(full);
|
|
21710
21805
|
for (const ref of refs) {
|
|
21711
21806
|
const refAbs = normalizePath(resolve32(componentDir, ref));
|
|
21712
|
-
const refDir = normalizePath(
|
|
21807
|
+
const refDir = normalizePath(dirname22(refAbs));
|
|
21713
21808
|
if (refDir === angularRootNormalized || refDir.startsWith(angularRootNormalized + "/")) {
|
|
21714
21809
|
continue;
|
|
21715
21810
|
}
|
|
@@ -21751,7 +21846,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
21751
21846
|
push(cfg.stylesDir);
|
|
21752
21847
|
for (const candidate of ["src", "db", "assets", "styles"]) {
|
|
21753
21848
|
const abs = normalizePath(resolve32(cwd2, candidate));
|
|
21754
|
-
if (
|
|
21849
|
+
if (existsSync30(abs) && !roots.includes(abs))
|
|
21755
21850
|
roots.push(abs);
|
|
21756
21851
|
}
|
|
21757
21852
|
try {
|
|
@@ -21836,8 +21931,8 @@ var init_pathUtils = __esm(() => {
|
|
|
21836
21931
|
|
|
21837
21932
|
// src/dev/fileWatcher.ts
|
|
21838
21933
|
import { watch } from "fs";
|
|
21839
|
-
import { existsSync as
|
|
21840
|
-
import { dirname as
|
|
21934
|
+
import { existsSync as existsSync31, readdirSync as readdirSync5, statSync as statSync4 } from "fs";
|
|
21935
|
+
import { dirname as dirname23, join as join39, resolve as resolve33 } from "path";
|
|
21841
21936
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
21842
21937
|
try {
|
|
21843
21938
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -21870,7 +21965,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
21870
21965
|
for (const name of entries) {
|
|
21871
21966
|
if (shouldSkipFilename(name, isStylesDir))
|
|
21872
21967
|
continue;
|
|
21873
|
-
const child =
|
|
21968
|
+
const child = join39(eventDir, name).replace(/\\/g, "/");
|
|
21874
21969
|
let st2;
|
|
21875
21970
|
try {
|
|
21876
21971
|
st2 = statSync4(child);
|
|
@@ -21895,21 +21990,21 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
21895
21990
|
return;
|
|
21896
21991
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
21897
21992
|
if (event === "rename") {
|
|
21898
|
-
const eventDir =
|
|
21993
|
+
const eventDir = dirname23(join39(absolutePath, filename)).replace(/\\/g, "/");
|
|
21899
21994
|
atomicRecoveryScan(eventDir);
|
|
21900
21995
|
}
|
|
21901
21996
|
return;
|
|
21902
21997
|
}
|
|
21903
|
-
const fullPath =
|
|
21998
|
+
const fullPath = join39(absolutePath, filename).replace(/\\/g, "/");
|
|
21904
21999
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
21905
22000
|
return;
|
|
21906
22001
|
}
|
|
21907
|
-
if (event === "rename" && !
|
|
22002
|
+
if (event === "rename" && !existsSync31(fullPath)) {
|
|
21908
22003
|
safeRemoveFromGraph(state.dependencyGraph, fullPath);
|
|
21909
22004
|
onFileChange(fullPath);
|
|
21910
22005
|
return;
|
|
21911
22006
|
}
|
|
21912
|
-
if (
|
|
22007
|
+
if (existsSync31(fullPath)) {
|
|
21913
22008
|
onFileChange(fullPath);
|
|
21914
22009
|
safeAddToGraph(state.dependencyGraph, fullPath);
|
|
21915
22010
|
}
|
|
@@ -21919,7 +22014,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
21919
22014
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
21920
22015
|
paths.forEach((path) => {
|
|
21921
22016
|
const absolutePath = resolve33(path).replace(/\\/g, "/");
|
|
21922
|
-
if (!
|
|
22017
|
+
if (!existsSync31(absolutePath)) {
|
|
21923
22018
|
return;
|
|
21924
22019
|
}
|
|
21925
22020
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -21930,7 +22025,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
21930
22025
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
21931
22026
|
watchPaths.forEach((path) => {
|
|
21932
22027
|
const absolutePath = resolve33(path).replace(/\\/g, "/");
|
|
21933
|
-
if (!
|
|
22028
|
+
if (!existsSync31(absolutePath)) {
|
|
21934
22029
|
return;
|
|
21935
22030
|
}
|
|
21936
22031
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -22052,10 +22147,10 @@ var init_assetStore = __esm(() => {
|
|
|
22052
22147
|
});
|
|
22053
22148
|
|
|
22054
22149
|
// src/dev/fileHashTracker.ts
|
|
22055
|
-
import { readFileSync as
|
|
22150
|
+
import { readFileSync as readFileSync23 } from "fs";
|
|
22056
22151
|
var computeFileHash = (filePath) => {
|
|
22057
22152
|
try {
|
|
22058
|
-
const fileContent =
|
|
22153
|
+
const fileContent = readFileSync23(filePath);
|
|
22059
22154
|
return Number(Bun.hash(fileContent));
|
|
22060
22155
|
} catch {
|
|
22061
22156
|
return UNFOUND_INDEX;
|
|
@@ -22269,9 +22364,9 @@ __export(exports_resolveOwningComponents, {
|
|
|
22269
22364
|
resolveDescendantsOfParent: () => resolveDescendantsOfParent,
|
|
22270
22365
|
invalidateResourceIndex: () => invalidateResourceIndex
|
|
22271
22366
|
});
|
|
22272
|
-
import { readdirSync as readdirSync6, readFileSync as
|
|
22273
|
-
import { dirname as
|
|
22274
|
-
import
|
|
22367
|
+
import { readdirSync as readdirSync6, readFileSync as readFileSync24, statSync as statSync5 } from "fs";
|
|
22368
|
+
import { dirname as dirname24, extname as extname9, join as join40, resolve as resolve37 } from "path";
|
|
22369
|
+
import ts14 from "typescript";
|
|
22275
22370
|
var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") || file5.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
22276
22371
|
const out = [];
|
|
22277
22372
|
const visit = (dir) => {
|
|
@@ -22285,7 +22380,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
22285
22380
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
22286
22381
|
continue;
|
|
22287
22382
|
}
|
|
22288
|
-
const full =
|
|
22383
|
+
const full = join40(dir, entry.name);
|
|
22289
22384
|
if (entry.isDirectory()) {
|
|
22290
22385
|
visit(full);
|
|
22291
22386
|
} else if (entry.isFile() && isAngularSourceFile(entry.name)) {
|
|
@@ -22297,13 +22392,13 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
22297
22392
|
return out;
|
|
22298
22393
|
}, getStringPropertyValue = (obj, name) => {
|
|
22299
22394
|
for (const prop of obj.properties) {
|
|
22300
|
-
if (!
|
|
22395
|
+
if (!ts14.isPropertyAssignment(prop))
|
|
22301
22396
|
continue;
|
|
22302
|
-
const propName =
|
|
22397
|
+
const propName = ts14.isIdentifier(prop.name) ? prop.name.text : ts14.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
22303
22398
|
if (propName !== name)
|
|
22304
22399
|
continue;
|
|
22305
22400
|
const init = prop.initializer;
|
|
22306
|
-
if (
|
|
22401
|
+
if (ts14.isStringLiteral(init) || ts14.isNoSubstitutionTemplateLiteral(init)) {
|
|
22307
22402
|
return init.text;
|
|
22308
22403
|
}
|
|
22309
22404
|
}
|
|
@@ -22311,16 +22406,16 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
22311
22406
|
}, getStringArrayProperty = (obj, name) => {
|
|
22312
22407
|
const out = [];
|
|
22313
22408
|
for (const prop of obj.properties) {
|
|
22314
|
-
if (!
|
|
22409
|
+
if (!ts14.isPropertyAssignment(prop))
|
|
22315
22410
|
continue;
|
|
22316
|
-
const propName =
|
|
22411
|
+
const propName = ts14.isIdentifier(prop.name) ? prop.name.text : ts14.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
22317
22412
|
if (propName !== name)
|
|
22318
22413
|
continue;
|
|
22319
22414
|
const init = prop.initializer;
|
|
22320
|
-
if (!
|
|
22415
|
+
if (!ts14.isArrayLiteralExpression(init))
|
|
22321
22416
|
continue;
|
|
22322
22417
|
for (const element of init.elements) {
|
|
22323
|
-
if (
|
|
22418
|
+
if (ts14.isStringLiteral(element) || ts14.isNoSubstitutionTemplateLiteral(element)) {
|
|
22324
22419
|
out.push(element.text);
|
|
22325
22420
|
}
|
|
22326
22421
|
}
|
|
@@ -22329,31 +22424,31 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
22329
22424
|
}, parseDecoratedClasses = (filePath) => {
|
|
22330
22425
|
let source;
|
|
22331
22426
|
try {
|
|
22332
|
-
source =
|
|
22427
|
+
source = readFileSync24(filePath, "utf8");
|
|
22333
22428
|
} catch {
|
|
22334
22429
|
return [];
|
|
22335
22430
|
}
|
|
22336
|
-
const sourceFile =
|
|
22431
|
+
const sourceFile = ts14.createSourceFile(filePath, source, ts14.ScriptTarget.ES2022, true, ts14.ScriptKind.TS);
|
|
22337
22432
|
const out = [];
|
|
22338
22433
|
const visit = (node) => {
|
|
22339
|
-
if (
|
|
22340
|
-
for (const decorator of
|
|
22434
|
+
if (ts14.isClassDeclaration(node) && node.name) {
|
|
22435
|
+
for (const decorator of ts14.getDecorators(node) ?? []) {
|
|
22341
22436
|
const expr = decorator.expression;
|
|
22342
|
-
if (!
|
|
22437
|
+
if (!ts14.isCallExpression(expr))
|
|
22343
22438
|
continue;
|
|
22344
22439
|
const fn2 = expr.expression;
|
|
22345
|
-
if (!
|
|
22440
|
+
if (!ts14.isIdentifier(fn2))
|
|
22346
22441
|
continue;
|
|
22347
22442
|
const kind = ENTITY_DECORATORS[fn2.text];
|
|
22348
22443
|
if (!kind)
|
|
22349
22444
|
continue;
|
|
22350
22445
|
let extendsName = null;
|
|
22351
22446
|
for (const heritage of node.heritageClauses ?? []) {
|
|
22352
|
-
if (heritage.token !==
|
|
22447
|
+
if (heritage.token !== ts14.SyntaxKind.ExtendsKeyword) {
|
|
22353
22448
|
continue;
|
|
22354
22449
|
}
|
|
22355
22450
|
const first = heritage.types[0];
|
|
22356
|
-
if (first &&
|
|
22451
|
+
if (first && ts14.isIdentifier(first.expression)) {
|
|
22357
22452
|
extendsName = first.expression.text;
|
|
22358
22453
|
}
|
|
22359
22454
|
break;
|
|
@@ -22366,7 +22461,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
22366
22461
|
extendsName
|
|
22367
22462
|
};
|
|
22368
22463
|
const arg = expr.arguments[0];
|
|
22369
|
-
if (arg &&
|
|
22464
|
+
if (arg && ts14.isObjectLiteralExpression(arg) && kind === "component") {
|
|
22370
22465
|
const tplUrl = getStringPropertyValue(arg, "templateUrl");
|
|
22371
22466
|
if (tplUrl)
|
|
22372
22467
|
entry.templateUrls.push(tplUrl);
|
|
@@ -22379,7 +22474,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
22379
22474
|
break;
|
|
22380
22475
|
}
|
|
22381
22476
|
}
|
|
22382
|
-
|
|
22477
|
+
ts14.forEachChild(node, visit);
|
|
22383
22478
|
};
|
|
22384
22479
|
visit(sourceFile);
|
|
22385
22480
|
return out;
|
|
@@ -22419,16 +22514,16 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
22419
22514
|
}, indexByRoot, resolveParentClassFile = (parentName, childFilePath, angularRoot) => {
|
|
22420
22515
|
let source;
|
|
22421
22516
|
try {
|
|
22422
|
-
source =
|
|
22517
|
+
source = readFileSync24(childFilePath, "utf8");
|
|
22423
22518
|
} catch {
|
|
22424
22519
|
return null;
|
|
22425
22520
|
}
|
|
22426
|
-
const sf =
|
|
22427
|
-
const childDir =
|
|
22521
|
+
const sf = ts14.createSourceFile(childFilePath, source, ts14.ScriptTarget.ES2022, true, ts14.ScriptKind.TS);
|
|
22522
|
+
const childDir = dirname24(childFilePath);
|
|
22428
22523
|
for (const stmt of sf.statements) {
|
|
22429
|
-
if (!
|
|
22524
|
+
if (!ts14.isImportDeclaration(stmt))
|
|
22430
22525
|
continue;
|
|
22431
|
-
if (!
|
|
22526
|
+
if (!ts14.isStringLiteral(stmt.moduleSpecifier))
|
|
22432
22527
|
continue;
|
|
22433
22528
|
const clause = stmt.importClause;
|
|
22434
22529
|
if (!clause || clause.isTypeOnly)
|
|
@@ -22436,7 +22531,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
22436
22531
|
let matchesName = false;
|
|
22437
22532
|
if (clause.name && clause.name.text === parentName)
|
|
22438
22533
|
matchesName = true;
|
|
22439
|
-
if (!matchesName && clause.namedBindings &&
|
|
22534
|
+
if (!matchesName && clause.namedBindings && ts14.isNamedImports(clause.namedBindings)) {
|
|
22440
22535
|
for (const el of clause.namedBindings.elements) {
|
|
22441
22536
|
if (el.isTypeOnly)
|
|
22442
22537
|
continue;
|
|
@@ -22481,7 +22576,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
22481
22576
|
const parentFile = new Map;
|
|
22482
22577
|
for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
|
|
22483
22578
|
const classes = parseDecoratedClasses(tsPath);
|
|
22484
|
-
const componentDir =
|
|
22579
|
+
const componentDir = dirname24(tsPath);
|
|
22485
22580
|
for (const cls of classes) {
|
|
22486
22581
|
const entity = {
|
|
22487
22582
|
className: cls.className,
|
|
@@ -22657,8 +22752,8 @@ __export(exports_moduleServer, {
|
|
|
22657
22752
|
createModuleServer: () => createModuleServer,
|
|
22658
22753
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
22659
22754
|
});
|
|
22660
|
-
import { existsSync as
|
|
22661
|
-
import { basename as basename13, dirname as
|
|
22755
|
+
import { existsSync as existsSync32, readFileSync as readFileSync25, statSync as statSync6 } from "fs";
|
|
22756
|
+
import { basename as basename13, dirname as dirname25, extname as extname10, join as join41, resolve as resolve38, relative as relative16 } from "path";
|
|
22662
22757
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
22663
22758
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
22664
22759
|
const allExports = [];
|
|
@@ -22678,7 +22773,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
22678
22773
|
${stubs}
|
|
22679
22774
|
`;
|
|
22680
22775
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
22681
|
-
const found = extensions.find((ext) =>
|
|
22776
|
+
const found = extensions.find((ext) => existsSync32(resolve38(projectRoot, srcPath + ext)));
|
|
22682
22777
|
return found ? srcPath + found : srcPath;
|
|
22683
22778
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
22684
22779
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -22730,13 +22825,13 @@ ${stubs}
|
|
|
22730
22825
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
22731
22826
|
if (!subpath) {
|
|
22732
22827
|
const pkgDir = resolve38(projectRoot, "node_modules", packageName ?? "");
|
|
22733
|
-
const pkgJsonPath =
|
|
22734
|
-
if (
|
|
22735
|
-
const pkg = JSON.parse(
|
|
22828
|
+
const pkgJsonPath = join41(pkgDir, "package.json");
|
|
22829
|
+
if (existsSync32(pkgJsonPath)) {
|
|
22830
|
+
const pkg = JSON.parse(readFileSync25(pkgJsonPath, "utf-8"));
|
|
22736
22831
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
22737
22832
|
if (esmEntry) {
|
|
22738
22833
|
const resolved = resolve38(pkgDir, esmEntry);
|
|
22739
|
-
if (
|
|
22834
|
+
if (existsSync32(resolved))
|
|
22740
22835
|
return relative16(projectRoot, resolved);
|
|
22741
22836
|
}
|
|
22742
22837
|
}
|
|
@@ -22767,7 +22862,7 @@ ${stubs}
|
|
|
22767
22862
|
};
|
|
22768
22863
|
result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
|
|
22769
22864
|
result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
|
|
22770
|
-
const fileDir =
|
|
22865
|
+
const fileDir = dirname25(filePath);
|
|
22771
22866
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
22772
22867
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
22773
22868
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
@@ -22833,7 +22928,7 @@ ${code}`;
|
|
|
22833
22928
|
reactFastRefreshWarningEmitted = true;
|
|
22834
22929
|
logWarn("React HMR is blocked: this Bun build ignores " + "`reactFastRefresh` on Bun.Transpiler, so component state " + "cannot be preserved across edits. Tracking " + "https://github.com/oven-sh/bun/pull/28312 \u2014 if it still has " + "not merged, leave a \uD83D\uDC4D on the PR so the Bun team knows it " + "is blocking you. Until then, React edits trigger a full " + "reload instead of a fast refresh.");
|
|
22835
22930
|
}, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
22836
|
-
const raw =
|
|
22931
|
+
const raw = readFileSync25(filePath, "utf-8");
|
|
22837
22932
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
22838
22933
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
22839
22934
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -22849,7 +22944,7 @@ ${transpiled}`;
|
|
|
22849
22944
|
transpiled += buildIslandMetadataExports(raw);
|
|
22850
22945
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
22851
22946
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
22852
|
-
const raw =
|
|
22947
|
+
const raw = readFileSync25(filePath, "utf-8");
|
|
22853
22948
|
const ext = extname10(filePath);
|
|
22854
22949
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
22855
22950
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -23015,7 +23110,7 @@ ${code}`;
|
|
|
23015
23110
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
23016
23111
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
23017
23112
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
23018
|
-
const raw =
|
|
23113
|
+
const raw = readFileSync25(filePath, "utf-8");
|
|
23019
23114
|
if (!svelteCompiler) {
|
|
23020
23115
|
svelteCompiler = await import("svelte/compiler");
|
|
23021
23116
|
}
|
|
@@ -23077,7 +23172,7 @@ export default __script__;`;
|
|
|
23077
23172
|
return `${cssInjection}
|
|
23078
23173
|
${code}`;
|
|
23079
23174
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
23080
|
-
const rawSource =
|
|
23175
|
+
const rawSource = readFileSync25(filePath, "utf-8");
|
|
23081
23176
|
const raw = addAutoRouterSetupApp(rawSource);
|
|
23082
23177
|
if (!vueCompiler) {
|
|
23083
23178
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
@@ -23115,11 +23210,11 @@ ${code}`;
|
|
|
23115
23210
|
`);
|
|
23116
23211
|
return result;
|
|
23117
23212
|
}, resolveSvelteModulePath = (path) => {
|
|
23118
|
-
if (
|
|
23213
|
+
if (existsSync32(path))
|
|
23119
23214
|
return path;
|
|
23120
|
-
if (
|
|
23215
|
+
if (existsSync32(`${path}.ts`))
|
|
23121
23216
|
return `${path}.ts`;
|
|
23122
|
-
if (
|
|
23217
|
+
if (existsSync32(`${path}.js`))
|
|
23123
23218
|
return `${path}.js`;
|
|
23124
23219
|
return path;
|
|
23125
23220
|
}, jsResponse = (body) => {
|
|
@@ -23132,7 +23227,7 @@ ${code}`;
|
|
|
23132
23227
|
}
|
|
23133
23228
|
});
|
|
23134
23229
|
}, handleCssRequest = (filePath) => {
|
|
23135
|
-
const raw =
|
|
23230
|
+
const raw = readFileSync25(filePath, "utf-8");
|
|
23136
23231
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
23137
23232
|
return [
|
|
23138
23233
|
`const style = document.createElement('style');`,
|
|
@@ -23270,7 +23365,7 @@ export default {};
|
|
|
23270
23365
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
23271
23366
|
if (ext)
|
|
23272
23367
|
return { ext, filePath };
|
|
23273
|
-
const found = MODULE_EXTENSIONS.find((candidate) =>
|
|
23368
|
+
const found = MODULE_EXTENSIONS.find((candidate) => existsSync32(filePath + candidate));
|
|
23274
23369
|
if (!found)
|
|
23275
23370
|
return { ext, filePath };
|
|
23276
23371
|
const resolved = filePath + found;
|
|
@@ -23563,7 +23658,7 @@ __export(exports_hmrCompiler, {
|
|
|
23563
23658
|
getApplyMetadataModule: () => getApplyMetadataModule,
|
|
23564
23659
|
encodeHmrComponentId: () => encodeHmrComponentId
|
|
23565
23660
|
});
|
|
23566
|
-
import { dirname as
|
|
23661
|
+
import { dirname as dirname26, relative as relative17, resolve as resolve39 } from "path";
|
|
23567
23662
|
import { performance as performance2 } from "perf_hooks";
|
|
23568
23663
|
var getApplyMetadataModule = async (encodedId) => {
|
|
23569
23664
|
const decoded = decodeURIComponent(encodedId);
|
|
@@ -23583,7 +23678,7 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
23583
23678
|
const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
|
|
23584
23679
|
const owners = resolveOwningComponents2({
|
|
23585
23680
|
changedFilePath: componentFilePath,
|
|
23586
|
-
userAngularRoot:
|
|
23681
|
+
userAngularRoot: dirname26(componentFilePath)
|
|
23587
23682
|
});
|
|
23588
23683
|
const owner = owners.find((o3) => o3.className === className);
|
|
23589
23684
|
const kind = owner?.kind ?? "component";
|
|
@@ -23790,8 +23885,8 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
23790
23885
|
var init_simpleHTMXHMR = () => {};
|
|
23791
23886
|
|
|
23792
23887
|
// src/dev/rebuildTrigger.ts
|
|
23793
|
-
import { existsSync as
|
|
23794
|
-
import { basename as basename14, dirname as
|
|
23888
|
+
import { existsSync as existsSync33, rmSync as rmSync3 } from "fs";
|
|
23889
|
+
import { basename as basename14, dirname as dirname27, join as join42, relative as relative18, resolve as resolve42, sep as sep4 } from "path";
|
|
23795
23890
|
var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequentially = (items, action) => items.reduce((chain, item) => chain.then(() => action(item)), Promise.resolve()), getStyleTransformConfig = (config) => createStyleTransformConfig(config.stylePreprocessors, config.postcss), recompileTailwindForFastPath = async (state, config, files) => {
|
|
23796
23891
|
if (!config.tailwind)
|
|
23797
23892
|
return;
|
|
@@ -23890,7 +23985,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23890
23985
|
detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
|
|
23891
23986
|
}
|
|
23892
23987
|
return { ...parsed, framework: detectedFw };
|
|
23893
|
-
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) &&
|
|
23988
|
+
}, isValidDeletedAffectedFile = (affectedFile, deletedPathResolved, processedFiles) => affectedFile !== deletedPathResolved && !processedFiles.has(affectedFile) && existsSync33(affectedFile), FRAMEWORK_DIR_KEYS_FOR_CLEANUP, removeStaleGenerated = (state, deletedFile) => {
|
|
23894
23989
|
const config = state.config;
|
|
23895
23990
|
const cwd2 = process.cwd();
|
|
23896
23991
|
const absDeleted = resolve42(deletedFile).replace(/\\/g, "/");
|
|
@@ -23908,8 +24003,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23908
24003
|
const relJs = `${rel.slice(0, -ext[0].length)}.js`;
|
|
23909
24004
|
const generatedDir = getFrameworkGeneratedDir(framework, cwd2);
|
|
23910
24005
|
for (const candidate of [
|
|
23911
|
-
|
|
23912
|
-
`${
|
|
24006
|
+
join42(generatedDir, relJs),
|
|
24007
|
+
`${join42(generatedDir, relJs)}.map`
|
|
23913
24008
|
]) {
|
|
23914
24009
|
try {
|
|
23915
24010
|
rmSync3(candidate, { force: true });
|
|
@@ -23936,7 +24031,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23936
24031
|
if (!dependents || dependents.size === 0) {
|
|
23937
24032
|
return;
|
|
23938
24033
|
}
|
|
23939
|
-
const dependentFiles = Array.from(dependents).filter((file5) =>
|
|
24034
|
+
const dependentFiles = Array.from(dependents).filter((file5) => existsSync33(file5));
|
|
23940
24035
|
if (dependentFiles.length === 0) {
|
|
23941
24036
|
return;
|
|
23942
24037
|
}
|
|
@@ -23952,7 +24047,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23952
24047
|
try {
|
|
23953
24048
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
|
|
23954
24049
|
affectedFiles.forEach((affectedFile) => {
|
|
23955
|
-
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath &&
|
|
24050
|
+
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync33(affectedFile)) {
|
|
23956
24051
|
validFiles.push(affectedFile);
|
|
23957
24052
|
processedFiles.add(affectedFile);
|
|
23958
24053
|
}
|
|
@@ -23977,7 +24072,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23977
24072
|
collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
|
|
23978
24073
|
}, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
|
|
23979
24074
|
filePathSet.forEach((filePathInSet) => {
|
|
23980
|
-
if (!
|
|
24075
|
+
if (!existsSync33(filePathInSet)) {
|
|
23981
24076
|
collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
|
|
23982
24077
|
return;
|
|
23983
24078
|
}
|
|
@@ -24114,8 +24209,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24114
24209
|
const buildDir = state.resolvedPaths.buildDir;
|
|
24115
24210
|
const destPath = resolve42(buildDir, urlPrefix ? `${urlPrefix}/${relFromDir}` : relFromDir);
|
|
24116
24211
|
const { mkdir: mkdir7, copyFile, readFile: readFile6 } = await import("fs/promises");
|
|
24117
|
-
const { dirname:
|
|
24118
|
-
await mkdir7(
|
|
24212
|
+
const { dirname: dirname28 } = await import("path");
|
|
24213
|
+
await mkdir7(dirname28(destPath), { recursive: true });
|
|
24119
24214
|
await copyFile(absSource, destPath);
|
|
24120
24215
|
const bytes = await readFile6(destPath);
|
|
24121
24216
|
const webPath = urlPrefix ? `/${urlPrefix}/${relFromDir}` : `/${relFromDir}`;
|
|
@@ -24231,7 +24326,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24231
24326
|
return componentFile;
|
|
24232
24327
|
}
|
|
24233
24328
|
const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
|
|
24234
|
-
if (
|
|
24329
|
+
if (existsSync33(tsCounterpart)) {
|
|
24235
24330
|
return tsCounterpart;
|
|
24236
24331
|
}
|
|
24237
24332
|
if (!graph)
|
|
@@ -24317,7 +24412,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24317
24412
|
const keepByDir = new Map;
|
|
24318
24413
|
const prefixByDir = new Map;
|
|
24319
24414
|
for (const artifact of freshOutputs) {
|
|
24320
|
-
const dir =
|
|
24415
|
+
const dir = dirname27(artifact.path);
|
|
24321
24416
|
const name = basename14(artifact.path);
|
|
24322
24417
|
const [prefix] = name.split(".");
|
|
24323
24418
|
if (!prefix)
|
|
@@ -24747,12 +24842,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24747
24842
|
try {
|
|
24748
24843
|
const { primeComponentFingerprint: primeComponentFingerprint2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
24749
24844
|
const { readdir: readdir5 } = await import("fs/promises");
|
|
24750
|
-
const { join:
|
|
24845
|
+
const { join: join43 } = await import("path");
|
|
24751
24846
|
const walk = async (dir) => {
|
|
24752
24847
|
const entries = await readdir5(dir, { withFileTypes: true });
|
|
24753
24848
|
const files = [];
|
|
24754
24849
|
for (const entry of entries) {
|
|
24755
|
-
const full =
|
|
24850
|
+
const full = join43(dir, entry.name);
|
|
24756
24851
|
if (entry.isDirectory()) {
|
|
24757
24852
|
files.push(...await walk(full));
|
|
24758
24853
|
} else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
|
|
@@ -25195,7 +25290,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
25195
25290
|
const { vueServerPaths, vueIndexPaths, vueClientPaths, vueCssPaths } = await compileVue2(vueFiles, vueDir, true, getStyleTransformConfig(state.config));
|
|
25196
25291
|
const serverEntries = [...vueServerPaths];
|
|
25197
25292
|
const clientEntries = [...vueIndexPaths, ...vueClientPaths];
|
|
25198
|
-
const cssOutDir =
|
|
25293
|
+
const cssOutDir = join42(buildDir, state.resolvedPaths.assetsDir ? basename14(state.resolvedPaths.assetsDir) : "assets", "css");
|
|
25199
25294
|
const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "vue");
|
|
25200
25295
|
const [serverResult, clientResult, cssResult] = await Promise.all([
|
|
25201
25296
|
serverEntries.length > 0 ? bunBuild9({
|
|
@@ -25436,7 +25531,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
25436
25531
|
if (!buildReference?.source) {
|
|
25437
25532
|
return;
|
|
25438
25533
|
}
|
|
25439
|
-
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve42(
|
|
25534
|
+
const sourcePath = buildReference.source.startsWith("file://") ? new URL(buildReference.source).pathname : resolve42(dirname27(buildInfo.resolvedRegistryPath), buildReference.source);
|
|
25440
25535
|
islandFiles.add(resolve42(sourcePath));
|
|
25441
25536
|
}, resolveIslandSourceFiles = async (config) => {
|
|
25442
25537
|
const registryPath = config.islands?.registry;
|
|
@@ -26190,7 +26285,7 @@ __export(exports_buildDepVendor, {
|
|
|
26190
26285
|
buildDepVendor: () => buildDepVendor
|
|
26191
26286
|
});
|
|
26192
26287
|
import { mkdirSync as mkdirSync16 } from "fs";
|
|
26193
|
-
import { join as
|
|
26288
|
+
import { join as join43 } from "path";
|
|
26194
26289
|
import { rm as rm10 } from "fs/promises";
|
|
26195
26290
|
var {build: bunBuild9, Glob: Glob10 } = globalThis.Bun;
|
|
26196
26291
|
var toSafeFileName6 = (specifier) => {
|
|
@@ -26244,7 +26339,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
26244
26339
|
framework: Array.from(framework).filter(isResolvable4)
|
|
26245
26340
|
};
|
|
26246
26341
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
26247
|
-
const { readFileSync:
|
|
26342
|
+
const { readFileSync: readFileSync26 } = await import("fs");
|
|
26248
26343
|
const transpiler6 = new Bun.Transpiler({ loader: "js" });
|
|
26249
26344
|
const newSpecs = new Set;
|
|
26250
26345
|
for (const spec of specs) {
|
|
@@ -26259,7 +26354,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
26259
26354
|
}
|
|
26260
26355
|
let content;
|
|
26261
26356
|
try {
|
|
26262
|
-
content =
|
|
26357
|
+
content = readFileSync26(resolved, "utf-8");
|
|
26263
26358
|
} catch {
|
|
26264
26359
|
continue;
|
|
26265
26360
|
}
|
|
@@ -26301,7 +26396,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
26301
26396
|
}), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
26302
26397
|
const entries = await Promise.all(specifiers.map(async (specifier) => {
|
|
26303
26398
|
const safeName = toSafeFileName6(specifier);
|
|
26304
|
-
const entryPath =
|
|
26399
|
+
const entryPath = join43(tmpDir, `${safeName}.ts`);
|
|
26305
26400
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
26306
26401
|
return { entryPath, specifier };
|
|
26307
26402
|
}));
|
|
@@ -26362,9 +26457,9 @@ var toSafeFileName6 = (specifier) => {
|
|
|
26362
26457
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
26363
26458
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
26364
26459
|
return {};
|
|
26365
|
-
const vendorDir =
|
|
26460
|
+
const vendorDir = join43(buildDir, "vendor");
|
|
26366
26461
|
mkdirSync16(vendorDir, { recursive: true });
|
|
26367
|
-
const tmpDir =
|
|
26462
|
+
const tmpDir = join43(buildDir, "_dep_vendor_tmp");
|
|
26368
26463
|
mkdirSync16(tmpDir, { recursive: true });
|
|
26369
26464
|
const allSpecs = new Set(initialSpecs);
|
|
26370
26465
|
const alreadyScanned = new Set;
|
|
@@ -27065,17 +27160,17 @@ __export(exports_devtoolsJson, {
|
|
|
27065
27160
|
normalizeDevtoolsWorkspaceRoot: () => normalizeDevtoolsWorkspaceRoot,
|
|
27066
27161
|
devtoolsJson: () => devtoolsJson
|
|
27067
27162
|
});
|
|
27068
|
-
import { existsSync as
|
|
27069
|
-
import { dirname as
|
|
27163
|
+
import { existsSync as existsSync34, mkdirSync as mkdirSync17, readFileSync as readFileSync26, writeFileSync as writeFileSync12 } from "fs";
|
|
27164
|
+
import { dirname as dirname28, join as join44, resolve as resolve44 } from "path";
|
|
27070
27165
|
import { Elysia as Elysia3 } from "elysia";
|
|
27071
27166
|
var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
|
|
27072
27167
|
Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
|
|
27073
27168
|
return uuid;
|
|
27074
|
-
}, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) => resolve44(uuidCachePath ??
|
|
27075
|
-
if (!
|
|
27169
|
+
}, isUuidV4 = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value), resolveDevtoolsUuidCachePath = (buildDir, uuidCachePath) => resolve44(uuidCachePath ?? join44(buildDir, ".absolute", "chrome-devtools-workspace-uuid")), readCachedUuid = (cachePath) => {
|
|
27170
|
+
if (!existsSync34(cachePath))
|
|
27076
27171
|
return null;
|
|
27077
27172
|
try {
|
|
27078
|
-
const value =
|
|
27173
|
+
const value = readFileSync26(cachePath, "utf-8").trim();
|
|
27079
27174
|
return isUuidV4(value) ? value : null;
|
|
27080
27175
|
} catch {
|
|
27081
27176
|
return null;
|
|
@@ -27093,7 +27188,7 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
27093
27188
|
if (cachedUuid)
|
|
27094
27189
|
return setGlobalUuid(cachedUuid);
|
|
27095
27190
|
const uuid = crypto.randomUUID();
|
|
27096
|
-
mkdirSync17(
|
|
27191
|
+
mkdirSync17(dirname28(cachePath), { recursive: true });
|
|
27097
27192
|
writeFileSync12(cachePath, uuid, "utf-8");
|
|
27098
27193
|
return setGlobalUuid(uuid);
|
|
27099
27194
|
}, devtoolsJson = (buildDir, options = {}) => {
|
|
@@ -27110,11 +27205,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
27110
27205
|
if (process.env.WSL_DISTRO_NAME) {
|
|
27111
27206
|
const distro = process.env.WSL_DISTRO_NAME;
|
|
27112
27207
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
27113
|
-
return
|
|
27208
|
+
return join44("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
|
|
27114
27209
|
}
|
|
27115
27210
|
if (process.env.DOCKER_DESKTOP && !root.startsWith("\\\\")) {
|
|
27116
27211
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
27117
|
-
return
|
|
27212
|
+
return join44("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
|
|
27118
27213
|
}
|
|
27119
27214
|
return root;
|
|
27120
27215
|
};
|
|
@@ -27125,13 +27220,13 @@ var exports_imageOptimizer = {};
|
|
|
27125
27220
|
__export(exports_imageOptimizer, {
|
|
27126
27221
|
imageOptimizer: () => imageOptimizer
|
|
27127
27222
|
});
|
|
27128
|
-
import { existsSync as
|
|
27223
|
+
import { existsSync as existsSync35 } from "fs";
|
|
27129
27224
|
import { resolve as resolve45 } from "path";
|
|
27130
27225
|
import { Elysia as Elysia4 } from "elysia";
|
|
27131
27226
|
var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
|
|
27132
27227
|
try {
|
|
27133
27228
|
const resolved = validateSafePath(path, baseDir);
|
|
27134
|
-
if (
|
|
27229
|
+
if (existsSync35(resolved))
|
|
27135
27230
|
return resolved;
|
|
27136
27231
|
return null;
|
|
27137
27232
|
} catch {
|
|
@@ -27345,15 +27440,15 @@ __export(exports_prerender, {
|
|
|
27345
27440
|
prerender: () => prerender,
|
|
27346
27441
|
PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
|
|
27347
27442
|
});
|
|
27348
|
-
import { mkdirSync as mkdirSync18, readFileSync as
|
|
27349
|
-
import { join as
|
|
27443
|
+
import { mkdirSync as mkdirSync18, readFileSync as readFileSync27 } from "fs";
|
|
27444
|
+
import { join as join45 } from "path";
|
|
27350
27445
|
var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_TIMEOUT_MS = 30000, PRERENDER_BYPASS_HEADER = "X-Absolute-Prerender-Bypass", routeToFilename = (route) => route === "/" ? "index.html" : `${route.slice(1).replace(/\//g, "-")}.html`, writeTimestamp = async (htmlPath) => {
|
|
27351
27446
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
27352
27447
|
await Bun.write(metaPath, String(Date.now()));
|
|
27353
27448
|
}, readTimestamp = (htmlPath) => {
|
|
27354
27449
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
27355
27450
|
try {
|
|
27356
|
-
const content =
|
|
27451
|
+
const content = readFileSync27(metaPath, "utf-8");
|
|
27357
27452
|
return Number(content) || 0;
|
|
27358
27453
|
} catch {
|
|
27359
27454
|
return 0;
|
|
@@ -27412,7 +27507,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
27412
27507
|
return false;
|
|
27413
27508
|
const html = await res.text();
|
|
27414
27509
|
const fileName = routeToFilename(route);
|
|
27415
|
-
const filePath =
|
|
27510
|
+
const filePath = join45(prerenderDir, fileName);
|
|
27416
27511
|
await Bun.write(filePath, html);
|
|
27417
27512
|
await writeTimestamp(filePath);
|
|
27418
27513
|
return true;
|
|
@@ -27438,13 +27533,13 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
27438
27533
|
}
|
|
27439
27534
|
const html = await res.text();
|
|
27440
27535
|
const fileName = routeToFilename(route);
|
|
27441
|
-
const filePath =
|
|
27536
|
+
const filePath = join45(prerenderDir, fileName);
|
|
27442
27537
|
await Bun.write(filePath, html);
|
|
27443
27538
|
await writeTimestamp(filePath);
|
|
27444
27539
|
result.routes.set(route, filePath);
|
|
27445
27540
|
log2?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
|
|
27446
27541
|
}, prerender = async (port, outDir, staticConfig, log2) => {
|
|
27447
|
-
const prerenderDir =
|
|
27542
|
+
const prerenderDir = join45(outDir, "_prerendered");
|
|
27448
27543
|
mkdirSync18(prerenderDir, { recursive: true });
|
|
27449
27544
|
const baseUrl = `http://localhost:${port}`;
|
|
27450
27545
|
let routes;
|
|
@@ -27544,21 +27639,21 @@ __export(exports_serverEntryWatcher, {
|
|
|
27544
27639
|
startServerEntryWatcher: () => startServerEntryWatcher,
|
|
27545
27640
|
isAtomicWriteTemp: () => isAtomicWriteTemp
|
|
27546
27641
|
});
|
|
27547
|
-
import { existsSync as
|
|
27642
|
+
import { existsSync as existsSync38, statSync as statSync8, watch as watch2 } from "fs";
|
|
27548
27643
|
import { createRequire as createRequire2 } from "module";
|
|
27549
|
-
import { dirname as
|
|
27644
|
+
import { dirname as dirname29, join as join48, resolve as resolve47 } from "path";
|
|
27550
27645
|
var ATOMIC_RECOVERY_WINDOW_MS = 1000, RELOAD_DEBOUNCE_MS = 80, ATOMIC_WRITE_TEMP_PATTERNS2, isAtomicWriteTemp = (filename) => filename.endsWith(".tmp") || filename.includes(".tmp.") || filename.endsWith("~") || filename.startsWith(".#") || ATOMIC_WRITE_TEMP_PATTERNS2.some((re2) => re2.test(filename)), startServerEntryWatcher = () => {
|
|
27551
27646
|
if (globalThis.__absoluteEntryWatcherStarted)
|
|
27552
27647
|
return;
|
|
27553
27648
|
const main = Bun.main;
|
|
27554
|
-
if (!main || !
|
|
27649
|
+
if (!main || !existsSync38(main))
|
|
27555
27650
|
return;
|
|
27556
27651
|
globalThis.__absoluteEntryWatcherStarted = true;
|
|
27557
27652
|
const entryPath = resolve47(main);
|
|
27558
|
-
const entryDir =
|
|
27653
|
+
const entryDir = dirname29(entryPath);
|
|
27559
27654
|
const entryBase = entryPath.slice(entryDir.length + 1);
|
|
27560
27655
|
const configPath2 = resolve47(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
27561
|
-
const configDir2 =
|
|
27656
|
+
const configDir2 = dirname29(configPath2);
|
|
27562
27657
|
const configBase = configPath2.slice(configDir2.length + 1);
|
|
27563
27658
|
const recentlyHandled = new Map;
|
|
27564
27659
|
let entryReloadTimer = null;
|
|
@@ -27649,7 +27744,7 @@ var ATOMIC_RECOVERY_WINDOW_MS = 1000, RELOAD_DEBOUNCE_MS = 80, ATOMIC_WRITE_TEMP
|
|
|
27649
27744
|
continue;
|
|
27650
27745
|
let st2;
|
|
27651
27746
|
try {
|
|
27652
|
-
st2 = statSync8(
|
|
27747
|
+
st2 = statSync8(join48(dir, entry.name));
|
|
27653
27748
|
} catch {
|
|
27654
27749
|
continue;
|
|
27655
27750
|
}
|
|
@@ -28204,8 +28299,8 @@ var handleHTMXPageRequest = async (pagePath) => {
|
|
|
28204
28299
|
};
|
|
28205
28300
|
// src/core/prepare.ts
|
|
28206
28301
|
init_loadConfig();
|
|
28207
|
-
import { existsSync as
|
|
28208
|
-
import { basename as basename15, join as
|
|
28302
|
+
import { existsSync as existsSync36, readdirSync as readdirSync7, readFileSync as readFileSync28 } from "fs";
|
|
28303
|
+
import { basename as basename15, join as join46, relative as relative19, resolve as resolve46 } from "path";
|
|
28209
28304
|
import { Elysia as Elysia5 } from "elysia";
|
|
28210
28305
|
|
|
28211
28306
|
// src/core/loadIslandRegistry.ts
|
|
@@ -28604,7 +28699,7 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
|
|
|
28604
28699
|
if (!fileName)
|
|
28605
28700
|
continue;
|
|
28606
28701
|
const srcPath = resolve46(devIndexDir, fileName);
|
|
28607
|
-
if (!
|
|
28702
|
+
if (!existsSync36(srcPath))
|
|
28608
28703
|
continue;
|
|
28609
28704
|
const rel = relative19(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
28610
28705
|
manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
@@ -28712,7 +28807,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
28712
28807
|
};
|
|
28713
28808
|
var loadPrerenderMap = (prerenderDir) => {
|
|
28714
28809
|
const map = new Map;
|
|
28715
|
-
if (!
|
|
28810
|
+
if (!existsSync36(prerenderDir))
|
|
28716
28811
|
return map;
|
|
28717
28812
|
let entries;
|
|
28718
28813
|
try {
|
|
@@ -28725,7 +28820,7 @@ var loadPrerenderMap = (prerenderDir) => {
|
|
|
28725
28820
|
continue;
|
|
28726
28821
|
const name = basename15(entry, ".html");
|
|
28727
28822
|
const route = name === "index" ? "/" : `/${name}`;
|
|
28728
|
-
map.set(route,
|
|
28823
|
+
map.set(route, join46(prerenderDir, entry));
|
|
28729
28824
|
}
|
|
28730
28825
|
return map;
|
|
28731
28826
|
};
|
|
@@ -28777,7 +28872,7 @@ var prepare = async (configOrPath) => {
|
|
|
28777
28872
|
return result;
|
|
28778
28873
|
}
|
|
28779
28874
|
stepStartedAt = performance.now();
|
|
28780
|
-
const manifest = JSON.parse(
|
|
28875
|
+
const manifest = JSON.parse(readFileSync28(`${buildDir}/manifest.json`, "utf-8"));
|
|
28781
28876
|
setCurrentIslandManifest(manifest);
|
|
28782
28877
|
if (config.islands?.registry) {
|
|
28783
28878
|
setCurrentIslandRegistry(await loadIslandRegistry(config.islands.registry));
|
|
@@ -28785,9 +28880,9 @@ var prepare = async (configOrPath) => {
|
|
|
28785
28880
|
setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
|
|
28786
28881
|
recordStep("load production manifest and island metadata", stepStartedAt);
|
|
28787
28882
|
stepStartedAt = performance.now();
|
|
28788
|
-
const conventionsPath =
|
|
28789
|
-
if (
|
|
28790
|
-
const conventions2 = JSON.parse(
|
|
28883
|
+
const conventionsPath = join46(buildDir, "conventions.json");
|
|
28884
|
+
if (existsSync36(conventionsPath)) {
|
|
28885
|
+
const conventions2 = JSON.parse(readFileSync28(conventionsPath, "utf-8"));
|
|
28791
28886
|
setConventions(conventions2);
|
|
28792
28887
|
}
|
|
28793
28888
|
recordStep("load production conventions", stepStartedAt);
|
|
@@ -28801,7 +28896,7 @@ var prepare = async (configOrPath) => {
|
|
|
28801
28896
|
});
|
|
28802
28897
|
recordStep("create static plugin", stepStartedAt);
|
|
28803
28898
|
stepStartedAt = performance.now();
|
|
28804
|
-
const prerenderDir =
|
|
28899
|
+
const prerenderDir = join46(buildDir, "_prerendered");
|
|
28805
28900
|
const prerenderMap = loadPrerenderMap(prerenderDir);
|
|
28806
28901
|
recordStep("load prerender map", stepStartedAt);
|
|
28807
28902
|
if (prerenderMap.size > 0) {
|
|
@@ -28859,18 +28954,18 @@ import { argv } from "process";
|
|
|
28859
28954
|
var {env: env4 } = globalThis.Bun;
|
|
28860
28955
|
|
|
28861
28956
|
// src/dev/devCert.ts
|
|
28862
|
-
import { existsSync as
|
|
28863
|
-
import { join as
|
|
28864
|
-
var CERT_DIR =
|
|
28865
|
-
var CERT_PATH =
|
|
28866
|
-
var KEY_PATH =
|
|
28957
|
+
import { existsSync as existsSync37, mkdirSync as mkdirSync19, readFileSync as readFileSync29, rmSync as rmSync4 } from "fs";
|
|
28958
|
+
import { join as join47 } from "path";
|
|
28959
|
+
var CERT_DIR = join47(process.cwd(), ".absolutejs");
|
|
28960
|
+
var CERT_PATH = join47(CERT_DIR, "cert.pem");
|
|
28961
|
+
var KEY_PATH = join47(CERT_DIR, "key.pem");
|
|
28867
28962
|
var CERT_VALIDITY_DAYS = 365;
|
|
28868
28963
|
var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
|
|
28869
28964
|
var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`);
|
|
28870
|
-
var certFilesExist = () =>
|
|
28965
|
+
var certFilesExist = () => existsSync37(CERT_PATH) && existsSync37(KEY_PATH);
|
|
28871
28966
|
var isCertExpired = () => {
|
|
28872
28967
|
try {
|
|
28873
|
-
const certPem =
|
|
28968
|
+
const certPem = readFileSync29(CERT_PATH, "utf-8");
|
|
28874
28969
|
const proc = Bun.spawnSync(["openssl", "x509", "-enddate", "-noout"], {
|
|
28875
28970
|
stdin: new TextEncoder().encode(certPem)
|
|
28876
28971
|
});
|
|
@@ -28966,8 +29061,8 @@ var loadDevCert = () => {
|
|
|
28966
29061
|
return null;
|
|
28967
29062
|
try {
|
|
28968
29063
|
return {
|
|
28969
|
-
cert:
|
|
28970
|
-
key:
|
|
29064
|
+
cert: readFileSync29(paths.cert, "utf-8"),
|
|
29065
|
+
key: readFileSync29(paths.key, "utf-8")
|
|
28971
29066
|
};
|
|
28972
29067
|
} catch {
|
|
28973
29068
|
return null;
|
|
@@ -29242,7 +29337,7 @@ var generateHeadElement = ({
|
|
|
29242
29337
|
};
|
|
29243
29338
|
// src/utils/defineEnv.ts
|
|
29244
29339
|
var {env: bunEnv } = globalThis.Bun;
|
|
29245
|
-
import { existsSync as
|
|
29340
|
+
import { existsSync as existsSync39, readFileSync as readFileSync30 } from "fs";
|
|
29246
29341
|
import { resolve as resolve48 } from "path";
|
|
29247
29342
|
|
|
29248
29343
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
@@ -35279,18 +35374,18 @@ ${lines.join(`
|
|
|
35279
35374
|
var checkEnvFileSecurity = (properties) => {
|
|
35280
35375
|
const cwd2 = process.cwd();
|
|
35281
35376
|
const envPath = resolve48(cwd2, ".env");
|
|
35282
|
-
if (!
|
|
35377
|
+
if (!existsSync39(envPath))
|
|
35283
35378
|
return;
|
|
35284
35379
|
const sensitiveKeys = Object.keys(properties).filter(isSensitive);
|
|
35285
35380
|
if (sensitiveKeys.length === 0)
|
|
35286
35381
|
return;
|
|
35287
|
-
const envContent =
|
|
35382
|
+
const envContent = readFileSync30(envPath, "utf-8");
|
|
35288
35383
|
const presentKeys = sensitiveKeys.filter((key) => envContent.includes(`${key}=`));
|
|
35289
35384
|
if (presentKeys.length === 0)
|
|
35290
35385
|
return;
|
|
35291
35386
|
const gitignorePath = resolve48(cwd2, ".gitignore");
|
|
35292
|
-
if (
|
|
35293
|
-
const gitignore =
|
|
35387
|
+
if (existsSync39(gitignorePath)) {
|
|
35388
|
+
const gitignore = readFileSync30(gitignorePath, "utf-8");
|
|
35294
35389
|
if (gitignore.split(`
|
|
35295
35390
|
`).some((line) => line.trim() === ".env"))
|
|
35296
35391
|
return;
|
|
@@ -35531,5 +35626,5 @@ export {
|
|
|
35531
35626
|
ANGULAR_INIT_TIMEOUT_MS
|
|
35532
35627
|
};
|
|
35533
35628
|
|
|
35534
|
-
//# debugId=
|
|
35629
|
+
//# debugId=B66D4EB3D82B66BA64756E2164756E21
|
|
35535
35630
|
//# sourceMappingURL=index.js.map
|