@absolutejs/absolute 0.19.0-beta.970 → 0.19.0-beta.972
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 +175 -7102
- package/dist/angular/index.js.map +5 -10
- package/dist/angular/server.js +115 -15979
- package/dist/angular/server.js.map +5 -233
- package/dist/build.js +883 -769
- package/dist/build.js.map +7 -6
- package/dist/index.js +925 -811
- package/dist/index.js.map +7 -6
- package/dist/src/angular/loadGlobalProviders.d.ts +7 -0
- package/dist/src/build/emitAngularProvidersFiles.d.ts +11 -1
- package/dist/src/build/parseAngularConfigImports.d.ts +9 -0
- package/dist/src/utils/loadConfig.d.ts +3 -0
- package/dist/types/build.d.ts +13 -0
- 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,6 +12025,13 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
|
|
|
12025
12025
|
sections.push(renderImportGroup(group, outputPath));
|
|
12026
12026
|
}
|
|
12027
12027
|
}
|
|
12028
|
+
if (providersImport) {
|
|
12029
|
+
const outputDir = dirname13(outputPath);
|
|
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
|
+
}
|
|
12028
12035
|
if (basePath !== null) {
|
|
12029
12036
|
sections.push(`import { APP_BASE_HREF } from "@angular/common";`, `const __basePathProvider = { provide: APP_BASE_HREF, useValue: ${JSON.stringify(basePath)} };`);
|
|
12030
12037
|
}
|
|
@@ -12032,13 +12039,17 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
|
|
|
12032
12039
|
const routesImport = relativeRoutesImport(dirname13(outputPath), pageRoutes.pageFile);
|
|
12033
12040
|
sections.push(`import { ${["provideRouter", ...ROUTER_FEATURES_DEFAULT].join(", ")} } from "@angular/router";`, `import { routes as __pageRoutes } from "${routesImport}";`, `const __routerProvider = provideRouter(__pageRoutes, ${ROUTER_FEATURES_DEFAULT.map((name) => `${name}()`).join(", ")});`);
|
|
12034
12041
|
}
|
|
12035
|
-
const
|
|
12036
|
-
const
|
|
12042
|
+
const userProvidersExpr = call.providersExpr ?? "[]";
|
|
12043
|
+
const fragments = [];
|
|
12044
|
+
if (providersImport)
|
|
12045
|
+
fragments.push("...__globalProviders");
|
|
12046
|
+
if (call.providersExpr !== null)
|
|
12047
|
+
fragments.push(`...(${userProvidersExpr})`);
|
|
12037
12048
|
if (pageRoutes?.hasRoutes)
|
|
12038
|
-
|
|
12049
|
+
fragments.push("__routerProvider");
|
|
12039
12050
|
if (basePath !== null)
|
|
12040
|
-
|
|
12041
|
-
const exportExpr =
|
|
12051
|
+
fragments.push("__basePathProvider");
|
|
12052
|
+
const exportExpr = fragments.length === 0 ? "[]" : `[${fragments.join(", ")}]`;
|
|
12042
12053
|
sections.push(`export const providers = ${exportExpr};`);
|
|
12043
12054
|
return sections.join(`
|
|
12044
12055
|
|
|
@@ -12051,7 +12062,7 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
|
|
|
12051
12062
|
return null;
|
|
12052
12063
|
const trimmed = mountPath.slice(0, -1);
|
|
12053
12064
|
return trimmed === "/" ? null : trimmed;
|
|
12054
|
-
}, emitAngularProvidersFiles = (projectRoot, calls, pageRoutes) => {
|
|
12065
|
+
}, emitAngularProvidersFiles = (projectRoot, calls, pageRoutes, options = {}) => {
|
|
12055
12066
|
const outputDir = getProvidersOutputDir(projectRoot);
|
|
12056
12067
|
mkdirSync8(outputDir, { recursive: true });
|
|
12057
12068
|
const pageRoutesByKey = new Map;
|
|
@@ -12063,7 +12074,7 @@ var buildModuleSpecifier = (importSpec, outputPath) => {
|
|
|
12063
12074
|
const outputPath = join24(outputDir, `${call.manifestKey}.providers.ts`);
|
|
12064
12075
|
const basePath = deriveBasePath(call.mountPath);
|
|
12065
12076
|
const pageRoute = pageRoutesByKey.get(call.manifestKey);
|
|
12066
|
-
const content = renderFile(call, outputPath, basePath, pageRoute);
|
|
12077
|
+
const content = renderFile(call, outputPath, basePath, pageRoute, options.providersImport ?? null);
|
|
12067
12078
|
writeFileSync8(outputPath, content, "utf-8");
|
|
12068
12079
|
emitted.push({
|
|
12069
12080
|
basePath,
|
|
@@ -12131,14 +12142,115 @@ var init_emitAngularRouteMounts = __esm(() => {
|
|
|
12131
12142
|
init_generatedDir();
|
|
12132
12143
|
});
|
|
12133
12144
|
|
|
12134
|
-
// src/build/
|
|
12135
|
-
import {
|
|
12136
|
-
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";
|
|
12137
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";
|
|
12138
12250
|
var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (filePath) => {
|
|
12139
12251
|
if (filePath.endsWith(".tsx"))
|
|
12140
|
-
return
|
|
12141
|
-
return
|
|
12252
|
+
return ts8.ScriptKind.TSX;
|
|
12253
|
+
return ts8.ScriptKind.TS;
|
|
12142
12254
|
}, hasSourceExtension3 = (filePath) => {
|
|
12143
12255
|
const idx = filePath.lastIndexOf(".");
|
|
12144
12256
|
if (idx === -1)
|
|
@@ -12166,16 +12278,16 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
12166
12278
|
continue;
|
|
12167
12279
|
if (entry.name.startsWith("."))
|
|
12168
12280
|
continue;
|
|
12169
|
-
stack.push(
|
|
12281
|
+
stack.push(join27(dir, entry.name));
|
|
12170
12282
|
} else if (entry.isFile() && hasSourceExtension3(entry.name)) {
|
|
12171
|
-
out.push(
|
|
12283
|
+
out.push(join27(dir, entry.name));
|
|
12172
12284
|
}
|
|
12173
12285
|
}
|
|
12174
12286
|
}
|
|
12175
12287
|
return out;
|
|
12176
12288
|
}, fileMayContainAngularHandler = (source) => source.includes("handleAngularPageRequest"), collectFileImports = (sf, filePath) => {
|
|
12177
12289
|
const map = new Map;
|
|
12178
|
-
const fileDir =
|
|
12290
|
+
const fileDir = dirname15(filePath);
|
|
12179
12291
|
const recordSpec = (localName, spec) => {
|
|
12180
12292
|
map.set(localName, spec);
|
|
12181
12293
|
};
|
|
@@ -12183,15 +12295,15 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
12183
12295
|
if (specifier.startsWith(".")) {
|
|
12184
12296
|
return resolve22(fileDir, specifier);
|
|
12185
12297
|
}
|
|
12186
|
-
if (
|
|
12298
|
+
if (isAbsolute4(specifier)) {
|
|
12187
12299
|
return specifier;
|
|
12188
12300
|
}
|
|
12189
12301
|
return null;
|
|
12190
12302
|
};
|
|
12191
12303
|
for (const statement of sf.statements) {
|
|
12192
|
-
if (!
|
|
12304
|
+
if (!ts8.isImportDeclaration(statement))
|
|
12193
12305
|
continue;
|
|
12194
|
-
if (!
|
|
12306
|
+
if (!ts8.isStringLiteral(statement.moduleSpecifier))
|
|
12195
12307
|
continue;
|
|
12196
12308
|
if (statement.importClause?.isTypeOnly)
|
|
12197
12309
|
continue;
|
|
@@ -12212,7 +12324,7 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
12212
12324
|
const bindings = clause.namedBindings;
|
|
12213
12325
|
if (!bindings)
|
|
12214
12326
|
continue;
|
|
12215
|
-
if (
|
|
12327
|
+
if (ts8.isNamespaceImport(bindings)) {
|
|
12216
12328
|
recordSpec(bindings.name.text, {
|
|
12217
12329
|
importedName: "*",
|
|
12218
12330
|
isDefault: false,
|
|
@@ -12240,38 +12352,38 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
12240
12352
|
}, collectExpressionIdentifiers = (expr) => {
|
|
12241
12353
|
const out = new Set;
|
|
12242
12354
|
const visit = (node) => {
|
|
12243
|
-
if (
|
|
12355
|
+
if (ts8.isIdentifier(node)) {
|
|
12244
12356
|
out.add(node.text);
|
|
12245
12357
|
return;
|
|
12246
12358
|
}
|
|
12247
|
-
if (
|
|
12359
|
+
if (ts8.isPropertyAccessExpression(node)) {
|
|
12248
12360
|
visit(node.expression);
|
|
12249
12361
|
return;
|
|
12250
12362
|
}
|
|
12251
|
-
|
|
12363
|
+
ts8.forEachChild(node, visit);
|
|
12252
12364
|
};
|
|
12253
12365
|
visit(expr);
|
|
12254
12366
|
return out;
|
|
12255
12367
|
}, extractManifestKey = (pagePathValue) => {
|
|
12256
|
-
if (!
|
|
12368
|
+
if (!ts8.isCallExpression(pagePathValue))
|
|
12257
12369
|
return null;
|
|
12258
12370
|
const callee = pagePathValue.expression;
|
|
12259
|
-
if (!
|
|
12371
|
+
if (!ts8.isIdentifier(callee) || callee.text !== "asset")
|
|
12260
12372
|
return null;
|
|
12261
12373
|
const [, second] = pagePathValue.arguments;
|
|
12262
12374
|
if (!second)
|
|
12263
12375
|
return null;
|
|
12264
|
-
if (!
|
|
12376
|
+
if (!ts8.isStringLiteral(second))
|
|
12265
12377
|
return null;
|
|
12266
12378
|
return second.text;
|
|
12267
12379
|
}, findEnclosingMountPath = (node) => {
|
|
12268
12380
|
let cursor = node.parent;
|
|
12269
12381
|
while (cursor) {
|
|
12270
|
-
if (
|
|
12382
|
+
if (ts8.isCallExpression(cursor)) {
|
|
12271
12383
|
const callee = cursor.expression;
|
|
12272
|
-
if (
|
|
12384
|
+
if (ts8.isPropertyAccessExpression(callee) && ts8.isIdentifier(callee.name) && ELYSIA_ROUTE_METHODS2.has(callee.name.text)) {
|
|
12273
12385
|
const firstArg = cursor.arguments[0];
|
|
12274
|
-
if (firstArg &&
|
|
12386
|
+
if (firstArg && ts8.isStringLiteral(firstArg) && firstArg.text.startsWith("/")) {
|
|
12275
12387
|
return firstArg.text;
|
|
12276
12388
|
}
|
|
12277
12389
|
}
|
|
@@ -12282,37 +12394,37 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
12282
12394
|
}, extractCallsFromFile = (filePath, out) => {
|
|
12283
12395
|
let source;
|
|
12284
12396
|
try {
|
|
12285
|
-
source =
|
|
12397
|
+
source = readFileSync16(filePath, "utf-8");
|
|
12286
12398
|
} catch {
|
|
12287
12399
|
return;
|
|
12288
12400
|
}
|
|
12289
12401
|
if (!fileMayContainAngularHandler(source))
|
|
12290
12402
|
return;
|
|
12291
|
-
const sf =
|
|
12403
|
+
const sf = ts8.createSourceFile(filePath, source, ts8.ScriptTarget.Latest, true, getScriptKind2(filePath));
|
|
12292
12404
|
const imports = collectFileImports(sf, filePath);
|
|
12293
12405
|
const visit = (node) => {
|
|
12294
|
-
if (
|
|
12406
|
+
if (ts8.isCallExpression(node) && ts8.isIdentifier(node.expression) && node.expression.text === "handleAngularPageRequest") {
|
|
12295
12407
|
const [arg] = node.arguments;
|
|
12296
|
-
if (arg &&
|
|
12408
|
+
if (arg && ts8.isObjectLiteralExpression(arg)) {
|
|
12297
12409
|
let manifestKey = null;
|
|
12298
12410
|
let providersExpr = null;
|
|
12299
12411
|
for (const prop of arg.properties) {
|
|
12300
|
-
if (
|
|
12412
|
+
if (ts8.isPropertyAssignment(prop)) {
|
|
12301
12413
|
if (!prop.name)
|
|
12302
12414
|
continue;
|
|
12303
|
-
const name =
|
|
12415
|
+
const name = ts8.isIdentifier(prop.name) ? prop.name.text : ts8.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
12304
12416
|
if (name === "pagePath") {
|
|
12305
12417
|
manifestKey = extractManifestKey(prop.initializer);
|
|
12306
12418
|
} else if (name === "providers") {
|
|
12307
12419
|
providersExpr = prop.initializer;
|
|
12308
12420
|
}
|
|
12309
|
-
} else if (
|
|
12421
|
+
} else if (ts8.isSpreadAssignment(prop)) {
|
|
12310
12422
|
if (manifestKey)
|
|
12311
12423
|
continue;
|
|
12312
12424
|
const spreadExpr = prop.expression;
|
|
12313
|
-
if (
|
|
12425
|
+
if (ts8.isCallExpression(spreadExpr) && spreadExpr.arguments.length > 0) {
|
|
12314
12426
|
const [firstArg] = spreadExpr.arguments;
|
|
12315
|
-
if (firstArg &&
|
|
12427
|
+
if (firstArg && ts8.isStringLiteral(firstArg)) {
|
|
12316
12428
|
manifestKey = firstArg.text;
|
|
12317
12429
|
}
|
|
12318
12430
|
}
|
|
@@ -12340,9 +12452,9 @@ var ELYSIA_ROUTE_METHODS2, SKIP_DIRS3, SOURCE_EXTENSIONS3, getScriptKind2 = (fil
|
|
|
12340
12452
|
}
|
|
12341
12453
|
}
|
|
12342
12454
|
}
|
|
12343
|
-
|
|
12455
|
+
ts8.forEachChild(node, visit);
|
|
12344
12456
|
};
|
|
12345
|
-
|
|
12457
|
+
ts8.forEachChild(sf, visit);
|
|
12346
12458
|
}, scanAngularHandlerCalls = (projectRoot) => {
|
|
12347
12459
|
const files = collectSourceFiles2(projectRoot);
|
|
12348
12460
|
const collected = [];
|
|
@@ -12385,7 +12497,8 @@ __export(exports_runAngularHandlerScan, {
|
|
|
12385
12497
|
var runAngularHandlerScan = (projectRoot, angularDirectory) => {
|
|
12386
12498
|
const calls = scanAngularHandlerCalls(projectRoot);
|
|
12387
12499
|
const pageRoutes = scanAngularPageRoutes(angularDirectory);
|
|
12388
|
-
const
|
|
12500
|
+
const providersImport = parseAngularProvidersImport(projectRoot);
|
|
12501
|
+
const providersFiles = emitAngularProvidersFiles(projectRoot, calls, pageRoutes, { providersImport });
|
|
12389
12502
|
emitAngularRouteMounts(projectRoot, calls);
|
|
12390
12503
|
return {
|
|
12391
12504
|
calls,
|
|
@@ -12397,6 +12510,7 @@ var runAngularHandlerScan = (projectRoot, angularDirectory) => {
|
|
|
12397
12510
|
var init_runAngularHandlerScan = __esm(() => {
|
|
12398
12511
|
init_emitAngularProvidersFiles();
|
|
12399
12512
|
init_emitAngularRouteMounts();
|
|
12513
|
+
init_parseAngularConfigImports();
|
|
12400
12514
|
init_scanAngularHandlerCalls();
|
|
12401
12515
|
init_scanAngularPageRoutes();
|
|
12402
12516
|
});
|
|
@@ -12463,11 +12577,11 @@ __export(exports_compileSvelte, {
|
|
|
12463
12577
|
compileSvelte: () => compileSvelte,
|
|
12464
12578
|
clearSvelteCompilerCache: () => clearSvelteCompilerCache
|
|
12465
12579
|
});
|
|
12466
|
-
import { existsSync as
|
|
12580
|
+
import { existsSync as existsSync21 } from "fs";
|
|
12467
12581
|
import { mkdir as mkdir4, stat as stat2 } from "fs/promises";
|
|
12468
12582
|
import {
|
|
12469
|
-
dirname as
|
|
12470
|
-
join as
|
|
12583
|
+
dirname as dirname16,
|
|
12584
|
+
join as join28,
|
|
12471
12585
|
basename as basename7,
|
|
12472
12586
|
extname as extname5,
|
|
12473
12587
|
resolve as resolve23,
|
|
@@ -12479,11 +12593,11 @@ var {write: write2, file: file2, Transpiler: Transpiler2 } = globalThis.Bun;
|
|
|
12479
12593
|
var resolveDevClientDir2 = () => {
|
|
12480
12594
|
const projectRoot = process.cwd();
|
|
12481
12595
|
const fromSource = resolve23(import.meta.dir, "../dev/client");
|
|
12482
|
-
if (
|
|
12596
|
+
if (existsSync21(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
12483
12597
|
return fromSource;
|
|
12484
12598
|
}
|
|
12485
12599
|
const fromNodeModules = resolve23(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
12486
|
-
if (
|
|
12600
|
+
if (existsSync21(fromNodeModules))
|
|
12487
12601
|
return fromNodeModules;
|
|
12488
12602
|
return resolve23(import.meta.dir, "./dev/client");
|
|
12489
12603
|
}, devClientDir2, hmrClientPath3, persistentCache, sourceHashCache, clearSvelteCompilerCache = () => {
|
|
@@ -12515,7 +12629,7 @@ var resolveDevClientDir2 = () => {
|
|
|
12515
12629
|
}, resolveRelativeModule2 = async (spec, from) => {
|
|
12516
12630
|
if (!spec.startsWith("."))
|
|
12517
12631
|
return null;
|
|
12518
|
-
const basePath = resolve23(
|
|
12632
|
+
const basePath = resolve23(dirname16(from), spec);
|
|
12519
12633
|
const candidates = [
|
|
12520
12634
|
basePath,
|
|
12521
12635
|
`${basePath}.ts`,
|
|
@@ -12526,14 +12640,14 @@ var resolveDevClientDir2 = () => {
|
|
|
12526
12640
|
`${basePath}.svelte`,
|
|
12527
12641
|
`${basePath}.svelte.ts`,
|
|
12528
12642
|
`${basePath}.svelte.js`,
|
|
12529
|
-
|
|
12530
|
-
|
|
12531
|
-
|
|
12532
|
-
|
|
12533
|
-
|
|
12534
|
-
|
|
12535
|
-
|
|
12536
|
-
|
|
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")
|
|
12537
12651
|
];
|
|
12538
12652
|
const checks = await Promise.all(candidates.map(exists));
|
|
12539
12653
|
return candidates.find((_2, index) => checks[index]) ?? null;
|
|
@@ -12542,7 +12656,7 @@ var resolveDevClientDir2 = () => {
|
|
|
12542
12656
|
const resolved = resolvePackageImport(spec);
|
|
12543
12657
|
return resolved && /\.svelte(\.(?:ts|js))?$/.test(resolved) ? resolved : null;
|
|
12544
12658
|
}
|
|
12545
|
-
const basePath = resolve23(
|
|
12659
|
+
const basePath = resolve23(dirname16(from), spec);
|
|
12546
12660
|
const explicit = /\.(svelte|svelte\.(?:ts|js))$/.test(basePath);
|
|
12547
12661
|
if (!explicit) {
|
|
12548
12662
|
const extensions = [".svelte", ".svelte.ts", ".svelte.js"];
|
|
@@ -12572,9 +12686,9 @@ var resolveDevClientDir2 = () => {
|
|
|
12572
12686
|
}, compileSvelte = async (entryPoints, svelteRoot, cache = new Map, isDev2 = false, stylePreprocessors) => {
|
|
12573
12687
|
const { compile, compileModule, preprocess } = await import("svelte/compiler");
|
|
12574
12688
|
const generatedDir = getFrameworkGeneratedDir("svelte");
|
|
12575
|
-
const clientDir =
|
|
12576
|
-
const indexDir =
|
|
12577
|
-
const serverDir =
|
|
12689
|
+
const clientDir = join28(generatedDir, "client");
|
|
12690
|
+
const indexDir = join28(generatedDir, "indexes");
|
|
12691
|
+
const serverDir = join28(generatedDir, "server");
|
|
12578
12692
|
await Promise.all([clientDir, indexDir, serverDir].map((dir) => mkdir4(dir, { recursive: true })));
|
|
12579
12693
|
const dev = env2.NODE_ENV !== "production";
|
|
12580
12694
|
const build2 = async (src) => {
|
|
@@ -12586,7 +12700,7 @@ var resolveDevClientDir2 = () => {
|
|
|
12586
12700
|
const contentHash = Bun.hash(raw).toString(BASE_36_RADIX);
|
|
12587
12701
|
const prevHash = sourceHashCache.get(src);
|
|
12588
12702
|
const persistent = persistentCache.get(src);
|
|
12589
|
-
if (prevHash === contentHash && persistent &&
|
|
12703
|
+
if (prevHash === contentHash && persistent && existsSync21(persistent.ssr) && existsSync21(persistent.client)) {
|
|
12590
12704
|
cache.set(src, persistent);
|
|
12591
12705
|
return persistent;
|
|
12592
12706
|
}
|
|
@@ -12602,8 +12716,8 @@ var resolveDevClientDir2 = () => {
|
|
|
12602
12716
|
const preprocessedClient = isModule ? loweredClientSource.code : (await preprocess(loweredClientSource.code, svelteStylePreprocessor)).code;
|
|
12603
12717
|
const transpiledServer = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedServer) : preprocessedServer;
|
|
12604
12718
|
const transpiledClient = src.endsWith(".ts") || src.endsWith(".svelte.ts") ? transpiler3.transformSync(preprocessedClient) : preprocessedClient;
|
|
12605
|
-
const rawRel =
|
|
12606
|
-
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;
|
|
12607
12721
|
const baseName = basename7(src).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
12608
12722
|
const importPaths = Array.from(transpiledServer.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((path) => path !== undefined);
|
|
12609
12723
|
const resolvedModuleImports = await Promise.all(importPaths.map((importPath) => resolveRelativeModule2(importPath, src)));
|
|
@@ -12612,8 +12726,8 @@ var resolveDevClientDir2 = () => {
|
|
|
12612
12726
|
const childBuilt = await Promise.all(childSources.map((child) => build2(child)));
|
|
12613
12727
|
const hasAwaitSlotFromChildren = childBuilt.some((child) => child.hasAwaitSlot);
|
|
12614
12728
|
const externalRewrites = new Map;
|
|
12615
|
-
const ssrOutputDir =
|
|
12616
|
-
const clientOutputDir =
|
|
12729
|
+
const ssrOutputDir = dirname16(join28(serverDir, relDir, `${baseName}.js`));
|
|
12730
|
+
const clientOutputDir = dirname16(join28(clientDir, relDir, `${baseName}.js`));
|
|
12617
12731
|
for (let idx = 0;idx < importPaths.length; idx++) {
|
|
12618
12732
|
const rawSpec = importPaths[idx];
|
|
12619
12733
|
if (!rawSpec)
|
|
@@ -12678,11 +12792,11 @@ var resolveDevClientDir2 = () => {
|
|
|
12678
12792
|
code += islandMetadataExports;
|
|
12679
12793
|
return { code, map: compiledJs.map };
|
|
12680
12794
|
};
|
|
12681
|
-
const ssrPath =
|
|
12682
|
-
const clientPath =
|
|
12795
|
+
const ssrPath = join28(serverDir, relDir, `${baseName}.js`);
|
|
12796
|
+
const clientPath = join28(clientDir, relDir, `${baseName}.js`);
|
|
12683
12797
|
await Promise.all([
|
|
12684
|
-
mkdir4(
|
|
12685
|
-
mkdir4(
|
|
12798
|
+
mkdir4(dirname16(ssrPath), { recursive: true }),
|
|
12799
|
+
mkdir4(dirname16(clientPath), { recursive: true })
|
|
12686
12800
|
]);
|
|
12687
12801
|
const inlineMap = (map) => map ? `
|
|
12688
12802
|
//# sourceMappingURL=data:application/json;base64,${Buffer.from(JSON.stringify(map)).toString("base64")}
|
|
@@ -12715,10 +12829,10 @@ var resolveDevClientDir2 = () => {
|
|
|
12715
12829
|
};
|
|
12716
12830
|
const roots = await Promise.all(entryPoints.map(build2));
|
|
12717
12831
|
await Promise.all(roots.map(async ({ client: client2, hasAwaitSlot }) => {
|
|
12718
|
-
const relClientDir =
|
|
12832
|
+
const relClientDir = dirname16(relative11(clientDir, client2));
|
|
12719
12833
|
const name = basename7(client2, extname5(client2));
|
|
12720
|
-
const indexPath =
|
|
12721
|
-
const importRaw = relative11(
|
|
12834
|
+
const indexPath = join28(indexDir, relClientDir, `${name}.js`);
|
|
12835
|
+
const importRaw = relative11(dirname16(indexPath), client2).split(sep2).join("/");
|
|
12722
12836
|
const importPath = importRaw.startsWith(".") || importRaw.startsWith("/") ? importRaw : `./${importRaw}`;
|
|
12723
12837
|
const hmrImports = isDev2 ? `window.__HMR_FRAMEWORK__ = "svelte";
|
|
12724
12838
|
import "${hmrClientPath3}";
|
|
@@ -12789,14 +12903,14 @@ if (typeof window !== "undefined") {
|
|
|
12789
12903
|
setTimeout(releaseStreamingSlots, 0);
|
|
12790
12904
|
}
|
|
12791
12905
|
}`;
|
|
12792
|
-
await mkdir4(
|
|
12906
|
+
await mkdir4(dirname16(indexPath), { recursive: true });
|
|
12793
12907
|
return write2(indexPath, bootstrap);
|
|
12794
12908
|
}));
|
|
12795
12909
|
return {
|
|
12796
12910
|
svelteClientPaths: roots.map(({ client: client2 }) => client2),
|
|
12797
12911
|
svelteIndexPaths: roots.map(({ client: client2 }) => {
|
|
12798
|
-
const rel =
|
|
12799
|
-
return
|
|
12912
|
+
const rel = dirname16(relative11(clientDir, client2));
|
|
12913
|
+
return join28(indexDir, rel, basename7(client2));
|
|
12800
12914
|
}),
|
|
12801
12915
|
svelteServerPaths: roots.map(({ ssr }) => ssr)
|
|
12802
12916
|
};
|
|
@@ -12811,7 +12925,7 @@ var init_compileSvelte = __esm(() => {
|
|
|
12811
12925
|
init_lowerAwaitSlotSyntax();
|
|
12812
12926
|
init_renderToReadableStream();
|
|
12813
12927
|
devClientDir2 = resolveDevClientDir2();
|
|
12814
|
-
hmrClientPath3 =
|
|
12928
|
+
hmrClientPath3 = join28(devClientDir2, "hmrClient.ts").replace(/\\/g, "/");
|
|
12815
12929
|
persistentCache = new Map;
|
|
12816
12930
|
sourceHashCache = new Map;
|
|
12817
12931
|
transpiler3 = new Transpiler2({ loader: "ts", target: "browser" });
|
|
@@ -12826,7 +12940,7 @@ __export(exports_chainInlineSourcemaps, {
|
|
|
12826
12940
|
chainBundleInlineSourcemap: () => chainBundleInlineSourcemap,
|
|
12827
12941
|
buildLineRemap: () => buildLineRemap
|
|
12828
12942
|
});
|
|
12829
|
-
import { readFileSync as
|
|
12943
|
+
import { readFileSync as readFileSync17, writeFileSync as writeFileSync10 } from "fs";
|
|
12830
12944
|
var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", BASE64_TO_INT, decodeVlq = (str, startPos) => {
|
|
12831
12945
|
let result = 0;
|
|
12832
12946
|
let shift = 0;
|
|
@@ -13117,7 +13231,7 @@ var BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567
|
|
|
13117
13231
|
version: 3
|
|
13118
13232
|
};
|
|
13119
13233
|
}, chainBundleInlineSourcemap = (bundleFilePath) => {
|
|
13120
|
-
const text =
|
|
13234
|
+
const text = readFileSync17(bundleFilePath, "utf-8");
|
|
13121
13235
|
const outerMap = extractInlineMap(text);
|
|
13122
13236
|
if (!outerMap)
|
|
13123
13237
|
return;
|
|
@@ -13203,13 +13317,13 @@ __export(exports_compileVue, {
|
|
|
13203
13317
|
compileVue: () => compileVue,
|
|
13204
13318
|
clearVueHmrCaches: () => clearVueHmrCaches
|
|
13205
13319
|
});
|
|
13206
|
-
import { existsSync as
|
|
13320
|
+
import { existsSync as existsSync22 } from "fs";
|
|
13207
13321
|
import { mkdir as mkdir5 } from "fs/promises";
|
|
13208
13322
|
import {
|
|
13209
13323
|
basename as basename8,
|
|
13210
|
-
dirname as
|
|
13211
|
-
isAbsolute as
|
|
13212
|
-
join as
|
|
13324
|
+
dirname as dirname17,
|
|
13325
|
+
isAbsolute as isAbsolute5,
|
|
13326
|
+
join as join29,
|
|
13213
13327
|
relative as relative12,
|
|
13214
13328
|
resolve as resolve24
|
|
13215
13329
|
} from "path";
|
|
@@ -13217,11 +13331,11 @@ var {file: file3, write: write3, Transpiler: Transpiler3 } = globalThis.Bun;
|
|
|
13217
13331
|
var resolveDevClientDir3 = () => {
|
|
13218
13332
|
const projectRoot = process.cwd();
|
|
13219
13333
|
const fromSource = resolve24(import.meta.dir, "../dev/client");
|
|
13220
|
-
if (
|
|
13334
|
+
if (existsSync22(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
13221
13335
|
return fromSource;
|
|
13222
13336
|
}
|
|
13223
13337
|
const fromNodeModules = resolve24(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
13224
|
-
if (
|
|
13338
|
+
if (existsSync22(fromNodeModules))
|
|
13225
13339
|
return fromNodeModules;
|
|
13226
13340
|
return resolve24(import.meta.dir, "./dev/client");
|
|
13227
13341
|
}, devClientDir3, hmrClientPath4, transpiler4, scriptCache, scriptSetupCache, templateCache, styleCache, persistentBuildCache, vueSourceHashCache, vueHmrMetadata, clearVueHmrCaches = () => {
|
|
@@ -13305,7 +13419,7 @@ var resolveDevClientDir3 = () => {
|
|
|
13305
13419
|
const contentHash = Bun.hash(sourceContent).toString(BASE_36_RADIX);
|
|
13306
13420
|
const prevHash = vueSourceHashCache.get(sourceFilePath);
|
|
13307
13421
|
const persistent = persistentBuildCache.get(sourceFilePath);
|
|
13308
|
-
if (prevHash === contentHash && persistent &&
|
|
13422
|
+
if (prevHash === contentHash && persistent && existsSync22(persistent.clientPath) && existsSync22(persistent.serverPath)) {
|
|
13309
13423
|
cacheMap.set(sourceFilePath, persistent);
|
|
13310
13424
|
return persistent;
|
|
13311
13425
|
}
|
|
@@ -13333,12 +13447,12 @@ var resolveDevClientDir3 = () => {
|
|
|
13333
13447
|
const childComponentPaths = importPaths.filter((path) => path.startsWith(".") && path.endsWith(".vue"));
|
|
13334
13448
|
const packageComponentPaths = Array.from(resolvedPackageVueImports.entries());
|
|
13335
13449
|
const helperModulePaths = importPaths.filter((path) => path.startsWith(".") && !path.endsWith(".vue") && !isStylePath(path));
|
|
13336
|
-
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));
|
|
13337
13451
|
for (const stylePath of stylePathsImported) {
|
|
13338
13452
|
addStyleImporter(sourceFilePath, stylePath);
|
|
13339
13453
|
}
|
|
13340
13454
|
const childBuildResults = await Promise.all([
|
|
13341
|
-
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve24(
|
|
13455
|
+
...childComponentPaths.map((relativeChildPath) => compileVueFile(resolve24(dirname17(sourceFilePath), relativeChildPath), outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors)),
|
|
13342
13456
|
...packageComponentPaths.map(([, absolutePath]) => compileVueFile(absolutePath, outputDirs, cacheMap, false, vueRootDir, compiler, stylePreprocessors))
|
|
13343
13457
|
]);
|
|
13344
13458
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
@@ -13348,7 +13462,7 @@ var resolveDevClientDir3 = () => {
|
|
|
13348
13462
|
sourceMap: true
|
|
13349
13463
|
}) : { bindings: {}, content: "export default {};", map: undefined };
|
|
13350
13464
|
const strippedScript = stripExports2(compiledScript.content);
|
|
13351
|
-
const sourceDir =
|
|
13465
|
+
const sourceDir = dirname17(sourceFilePath);
|
|
13352
13466
|
const transpiledScript = transpiler4.transformSync(strippedScript).replace(/(['"])(\.{1,2}\/[^'"]+)(['"])/g, (_2, quoteStart, relativeImport, quoteEnd) => `${quoteStart}${toJs(relativeImport, sourceDir)}${quoteEnd}`);
|
|
13353
13467
|
const packageImportRewrites = new Map;
|
|
13354
13468
|
for (const [bareImport, absolutePath] of packageComponentPaths) {
|
|
@@ -13387,8 +13501,8 @@ var resolveDevClientDir3 = () => {
|
|
|
13387
13501
|
];
|
|
13388
13502
|
let cssOutputPaths = [];
|
|
13389
13503
|
if (isEntryPoint && allCss.length) {
|
|
13390
|
-
const cssOutputFile =
|
|
13391
|
-
await mkdir5(
|
|
13504
|
+
const cssOutputFile = join29(outputDirs.css, `${toKebab(fileBaseName)}-compiled.css`);
|
|
13505
|
+
await mkdir5(dirname17(cssOutputFile), { recursive: true });
|
|
13392
13506
|
await write3(cssOutputFile, allCss.join(`
|
|
13393
13507
|
`));
|
|
13394
13508
|
cssOutputPaths = [cssOutputFile];
|
|
@@ -13418,9 +13532,9 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13418
13532
|
};
|
|
13419
13533
|
const clientCode = assembleModule(generateRenderFunction(false), "render", true) + islandMetadataExports;
|
|
13420
13534
|
const serverCode = assembleModule(generateRenderFunction(true), "ssrRender", false) + islandMetadataExports;
|
|
13421
|
-
const clientOutputPath =
|
|
13422
|
-
const serverOutputPath =
|
|
13423
|
-
const relDir =
|
|
13535
|
+
const clientOutputPath = join29(outputDirs.client, `${relativeWithoutExtension}.js`);
|
|
13536
|
+
const serverOutputPath = join29(outputDirs.server, `${relativeWithoutExtension}.js`);
|
|
13537
|
+
const relDir = dirname17(relativeFilePath);
|
|
13424
13538
|
const relDepth = relDir === "." ? 0 : relDir.split("/").length;
|
|
13425
13539
|
const adjustImports = (code) => code.replace(/(from\s+['"])(\.\.\/(?:\.\.\/)*)/g, (_2, prefix, dots) => {
|
|
13426
13540
|
const upCount = dots.split("/").length - 1;
|
|
@@ -13432,15 +13546,15 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13432
13546
|
let result2 = code;
|
|
13433
13547
|
for (const [bareImport, paths] of packageImportRewrites) {
|
|
13434
13548
|
const targetPath = mode === "server" ? paths.server : paths.client;
|
|
13435
|
-
let rel = relative12(
|
|
13549
|
+
let rel = relative12(dirname17(outputPath), targetPath).replace(/\\/g, "/");
|
|
13436
13550
|
if (!rel.startsWith("."))
|
|
13437
13551
|
rel = `./${rel}`;
|
|
13438
13552
|
result2 = result2.replaceAll(bareImport, rel);
|
|
13439
13553
|
}
|
|
13440
13554
|
return result2;
|
|
13441
13555
|
};
|
|
13442
|
-
await mkdir5(
|
|
13443
|
-
await mkdir5(
|
|
13556
|
+
await mkdir5(dirname17(clientOutputPath), { recursive: true });
|
|
13557
|
+
await mkdir5(dirname17(serverOutputPath), { recursive: true });
|
|
13444
13558
|
const clientFinal = rewritePackageImports(adjustImports(clientCode), clientOutputPath, "client");
|
|
13445
13559
|
const serverFinal = rewritePackageImports(adjustImports(serverCode), serverOutputPath, "server");
|
|
13446
13560
|
const inlineSourceMapFor = (finalContent) => {
|
|
@@ -13462,7 +13576,7 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13462
13576
|
hmrId,
|
|
13463
13577
|
serverPath: serverOutputPath,
|
|
13464
13578
|
tsHelperPaths: [
|
|
13465
|
-
...helperModulePaths.map((helper) => resolve24(
|
|
13579
|
+
...helperModulePaths.map((helper) => resolve24(dirname17(sourceFilePath), helper.endsWith(".ts") ? helper : `${helper}.ts`)),
|
|
13466
13580
|
...childBuildResults.flatMap((child) => child.tsHelperPaths)
|
|
13467
13581
|
]
|
|
13468
13582
|
};
|
|
@@ -13472,10 +13586,10 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13472
13586
|
}, compileVue = async (entryPoints, vueRootDir, isDev2 = false, stylePreprocessors) => {
|
|
13473
13587
|
const compiler = await import("@vue/compiler-sfc");
|
|
13474
13588
|
const generatedDir = getFrameworkGeneratedDir("vue");
|
|
13475
|
-
const clientOutputDir =
|
|
13476
|
-
const indexOutputDir =
|
|
13477
|
-
const serverOutputDir =
|
|
13478
|
-
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");
|
|
13479
13593
|
await Promise.all([
|
|
13480
13594
|
mkdir5(clientOutputDir, { recursive: true }),
|
|
13481
13595
|
mkdir5(indexOutputDir, { recursive: true }),
|
|
@@ -13492,16 +13606,16 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13492
13606
|
}, buildCache, true, vueRootDir, compiler, stylePreprocessors);
|
|
13493
13607
|
result.tsHelperPaths.forEach((path) => allTsHelperPaths.add(path));
|
|
13494
13608
|
const entryBaseName = basename8(entryPath, ".vue");
|
|
13495
|
-
const indexOutputFile =
|
|
13496
|
-
const clientOutputFile =
|
|
13497
|
-
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 });
|
|
13498
13612
|
const vueHmrImports = isDev2 ? [
|
|
13499
13613
|
`window.__HMR_FRAMEWORK__ = "vue";`,
|
|
13500
13614
|
`import "${hmrClientPath4}";`
|
|
13501
13615
|
] : [];
|
|
13502
13616
|
await write3(indexOutputFile, [
|
|
13503
13617
|
...vueHmrImports,
|
|
13504
|
-
`import Comp, * as PageModule from "${relative12(
|
|
13618
|
+
`import Comp, * as PageModule from "${relative12(dirname17(indexOutputFile), clientOutputFile).replace(/\\/g, "/")}";`,
|
|
13505
13619
|
'import { createSSRApp, createApp } from "vue";',
|
|
13506
13620
|
"",
|
|
13507
13621
|
"// HMR State Preservation: Check for preserved state from HMR",
|
|
@@ -13646,10 +13760,10 @@ if (typeof __VUE_HMR_RUNTIME__ !== 'undefined') {
|
|
|
13646
13760
|
const sourceCode = await file3(tsPath).text();
|
|
13647
13761
|
const transpiledCode = transpiler4.transformSync(sourceCode);
|
|
13648
13762
|
const relativeJsPath = relative12(vueRootDir, tsPath).replace(/\.ts$/, ".js");
|
|
13649
|
-
const outClientPath =
|
|
13650
|
-
const outServerPath =
|
|
13651
|
-
await mkdir5(
|
|
13652
|
-
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 });
|
|
13653
13767
|
await write3(outClientPath, transpiledCode);
|
|
13654
13768
|
await write3(outServerPath, transpiledCode);
|
|
13655
13769
|
}));
|
|
@@ -13670,7 +13784,7 @@ var init_compileVue = __esm(() => {
|
|
|
13670
13784
|
init_vueAutoRouterTransform();
|
|
13671
13785
|
init_stylePreprocessor();
|
|
13672
13786
|
devClientDir3 = resolveDevClientDir3();
|
|
13673
|
-
hmrClientPath4 =
|
|
13787
|
+
hmrClientPath4 = join29(devClientDir3, "hmrClient.ts").replace(/\\/g, "/");
|
|
13674
13788
|
transpiler4 = new Transpiler3({ loader: "ts", target: "browser" });
|
|
13675
13789
|
scriptCache = new Map;
|
|
13676
13790
|
scriptSetupCache = new Map;
|
|
@@ -14151,17 +14265,17 @@ __export(exports_compileAngular, {
|
|
|
14151
14265
|
compileAngularFile: () => compileAngularFile,
|
|
14152
14266
|
compileAngular: () => compileAngular
|
|
14153
14267
|
});
|
|
14154
|
-
import { existsSync as
|
|
14155
|
-
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";
|
|
14156
14270
|
var {Glob: Glob6 } = globalThis.Bun;
|
|
14157
|
-
import
|
|
14271
|
+
import ts9 from "typescript";
|
|
14158
14272
|
var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
14159
14273
|
const tracePhase = globalThis.__absoluteBuildTracePhase;
|
|
14160
14274
|
return tracePhase ? tracePhase(`compile/angular/${name}`, fn2, metadata2) : await fn2();
|
|
14161
14275
|
}, readTsconfigPathAliases = () => {
|
|
14162
14276
|
try {
|
|
14163
14277
|
const configPath2 = resolve25(process.cwd(), "tsconfig.json");
|
|
14164
|
-
const config =
|
|
14278
|
+
const config = ts9.readConfigFile(configPath2, ts9.sys.readFile).config;
|
|
14165
14279
|
const compilerOptions = config?.compilerOptions ?? {};
|
|
14166
14280
|
const baseUrl = resolve25(process.cwd(), compilerOptions.baseUrl ?? ".");
|
|
14167
14281
|
const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
|
|
@@ -14195,12 +14309,12 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14195
14309
|
`${candidate}.tsx`,
|
|
14196
14310
|
`${candidate}.js`,
|
|
14197
14311
|
`${candidate}.jsx`,
|
|
14198
|
-
|
|
14199
|
-
|
|
14200
|
-
|
|
14201
|
-
|
|
14312
|
+
join30(candidate, "index.ts"),
|
|
14313
|
+
join30(candidate, "index.tsx"),
|
|
14314
|
+
join30(candidate, "index.js"),
|
|
14315
|
+
join30(candidate, "index.jsx")
|
|
14202
14316
|
];
|
|
14203
|
-
return candidates.find((file4) =>
|
|
14317
|
+
return candidates.find((file4) => existsSync23(file4));
|
|
14204
14318
|
}, createLegacyAngularAnimationUsageResolver = (rootDir) => {
|
|
14205
14319
|
const baseDir = resolve25(rootDir);
|
|
14206
14320
|
const tsconfigAliases = readTsconfigPathAliases();
|
|
@@ -14270,7 +14384,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14270
14384
|
if (scan.usesLegacyAnimations)
|
|
14271
14385
|
return true;
|
|
14272
14386
|
for (const specifier of scan.imports) {
|
|
14273
|
-
const importedPath = resolveLocalImport(specifier,
|
|
14387
|
+
const importedPath = resolveLocalImport(specifier, dirname18(resolved));
|
|
14274
14388
|
if (importedPath && await visit(importedPath, visited)) {
|
|
14275
14389
|
return true;
|
|
14276
14390
|
}
|
|
@@ -14281,16 +14395,16 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14281
14395
|
}, resolveDevClientDir4 = () => {
|
|
14282
14396
|
const projectRoot = process.cwd();
|
|
14283
14397
|
const fromSource = resolve25(import.meta.dir, "../dev/client");
|
|
14284
|
-
if (
|
|
14398
|
+
if (existsSync23(fromSource) && fromSource.startsWith(projectRoot)) {
|
|
14285
14399
|
return fromSource;
|
|
14286
14400
|
}
|
|
14287
14401
|
const fromNodeModules = resolve25(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
|
|
14288
|
-
if (
|
|
14402
|
+
if (existsSync23(fromNodeModules))
|
|
14289
14403
|
return fromNodeModules;
|
|
14290
14404
|
return resolve25(import.meta.dir, "./dev/client");
|
|
14291
14405
|
}, devClientDir4, hmrClientPath5, formatDiagnosticMessage = (diagnostic) => {
|
|
14292
14406
|
try {
|
|
14293
|
-
return
|
|
14407
|
+
return ts9.flattenDiagnosticMessageText(diagnostic.messageText, `
|
|
14294
14408
|
`);
|
|
14295
14409
|
} catch {
|
|
14296
14410
|
return String(diagnostic.messageText || "Unknown error");
|
|
@@ -14298,7 +14412,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14298
14412
|
}, throwOnCompilationErrors = (diagnostics) => {
|
|
14299
14413
|
if (!diagnostics?.length)
|
|
14300
14414
|
return;
|
|
14301
|
-
const errors = diagnostics.filter((diag) => diag.category ===
|
|
14415
|
+
const errors = diagnostics.filter((diag) => diag.category === ts9.DiagnosticCategory.Error);
|
|
14302
14416
|
if (!errors.length)
|
|
14303
14417
|
return;
|
|
14304
14418
|
const fullMessage = errors.map(formatDiagnosticMessage).join(`
|
|
@@ -14329,51 +14443,51 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14329
14443
|
return `${path.replace(/\.ts$/, ".js")}${query}`;
|
|
14330
14444
|
if (hasJsLikeExtension(path))
|
|
14331
14445
|
return `${path}${query}`;
|
|
14332
|
-
const importerDir =
|
|
14446
|
+
const importerDir = dirname18(importerOutputPath);
|
|
14333
14447
|
const fileCandidate = resolve25(importerDir, `${path}.js`);
|
|
14334
|
-
if (outputFiles?.has(fileCandidate) ||
|
|
14448
|
+
if (outputFiles?.has(fileCandidate) || existsSync23(fileCandidate)) {
|
|
14335
14449
|
return `${path}.js${query}`;
|
|
14336
14450
|
}
|
|
14337
14451
|
const indexCandidate = resolve25(importerDir, path, "index.js");
|
|
14338
|
-
if (outputFiles?.has(indexCandidate) ||
|
|
14452
|
+
if (outputFiles?.has(indexCandidate) || existsSync23(indexCandidate)) {
|
|
14339
14453
|
return `${path}/index.js${query}`;
|
|
14340
14454
|
}
|
|
14341
14455
|
return `${path}.js${query}`;
|
|
14342
14456
|
}, isRelativeModuleSpecifier = (specifier) => specifier.startsWith("./") || specifier.startsWith("../"), extractLocalImportSpecifiers = (source, fileName) => {
|
|
14343
|
-
const sourceFile =
|
|
14457
|
+
const sourceFile = ts9.createSourceFile(fileName, source, ts9.ScriptTarget.Latest, true, ts9.ScriptKind.TS);
|
|
14344
14458
|
const specifiers = [];
|
|
14345
14459
|
const addSpecifier = (node) => {
|
|
14346
|
-
if (!node || !
|
|
14460
|
+
if (!node || !ts9.isStringLiteralLike(node))
|
|
14347
14461
|
return;
|
|
14348
14462
|
const specifier = node.text;
|
|
14349
14463
|
if (isRelativeModuleSpecifier(specifier))
|
|
14350
14464
|
specifiers.push(specifier);
|
|
14351
14465
|
};
|
|
14352
14466
|
const visit = (node) => {
|
|
14353
|
-
if (
|
|
14467
|
+
if (ts9.isImportDeclaration(node) || ts9.isExportDeclaration(node)) {
|
|
14354
14468
|
addSpecifier(node.moduleSpecifier);
|
|
14355
|
-
} else if (
|
|
14469
|
+
} else if (ts9.isCallExpression(node) && node.expression.kind === ts9.SyntaxKind.ImportKeyword) {
|
|
14356
14470
|
addSpecifier(node.arguments[0]);
|
|
14357
14471
|
}
|
|
14358
|
-
|
|
14472
|
+
ts9.forEachChild(node, visit);
|
|
14359
14473
|
};
|
|
14360
14474
|
visit(sourceFile);
|
|
14361
14475
|
return specifiers;
|
|
14362
14476
|
}, resolveLocalTsImport = (fromFile, specifier) => {
|
|
14363
14477
|
if (!isRelativeModuleSpecifier(specifier))
|
|
14364
14478
|
return null;
|
|
14365
|
-
const basePath = resolve25(
|
|
14479
|
+
const basePath = resolve25(dirname18(fromFile), specifier);
|
|
14366
14480
|
const candidates = /\.[cm]?[tj]sx?$/.test(basePath) ? [basePath] : [
|
|
14367
14481
|
`${basePath}.ts`,
|
|
14368
14482
|
`${basePath}.tsx`,
|
|
14369
14483
|
`${basePath}.mts`,
|
|
14370
14484
|
`${basePath}.cts`,
|
|
14371
|
-
|
|
14372
|
-
|
|
14373
|
-
|
|
14374
|
-
|
|
14485
|
+
join30(basePath, "index.ts"),
|
|
14486
|
+
join30(basePath, "index.tsx"),
|
|
14487
|
+
join30(basePath, "index.mts"),
|
|
14488
|
+
join30(basePath, "index.cts")
|
|
14375
14489
|
];
|
|
14376
|
-
return candidates.map((candidate) => resolve25(candidate)).find((candidate) =>
|
|
14490
|
+
return candidates.map((candidate) => resolve25(candidate)).find((candidate) => existsSync23(candidate) && !candidate.endsWith(".d.ts")) ?? null;
|
|
14377
14491
|
}, readFileForAotTransform = async (fileName, readFile6) => {
|
|
14378
14492
|
const hostSource = readFile6?.(fileName);
|
|
14379
14493
|
if (typeof hostSource === "string")
|
|
@@ -14397,15 +14511,15 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14397
14511
|
const paths = [];
|
|
14398
14512
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14399
14513
|
if (templateUrlMatch?.[1])
|
|
14400
|
-
paths.push(
|
|
14514
|
+
paths.push(join30(fileDir, templateUrlMatch[1]));
|
|
14401
14515
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14402
14516
|
if (styleUrlMatch?.[1])
|
|
14403
|
-
paths.push(
|
|
14517
|
+
paths.push(join30(fileDir, styleUrlMatch[1]));
|
|
14404
14518
|
const styleUrlsMatch = findUncommentedMatch(source, /styleUrls\s*:\s*\[([^\]]+)\]/);
|
|
14405
14519
|
const urlMatches = styleUrlsMatch?.[1]?.match(/['"]([^'"]+)['"]/g);
|
|
14406
14520
|
if (urlMatches) {
|
|
14407
14521
|
for (const urlMatch of urlMatches) {
|
|
14408
|
-
paths.push(
|
|
14522
|
+
paths.push(join30(fileDir, urlMatch.replace(/['"]/g, "")));
|
|
14409
14523
|
}
|
|
14410
14524
|
}
|
|
14411
14525
|
return paths.map((path) => resolve25(path));
|
|
@@ -14420,13 +14534,13 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14420
14534
|
return null;
|
|
14421
14535
|
}
|
|
14422
14536
|
}, writeResourceCacheFile = async (cachePath, source) => {
|
|
14423
|
-
await fs5.mkdir(
|
|
14537
|
+
await fs5.mkdir(dirname18(cachePath), { recursive: true });
|
|
14424
14538
|
await fs5.writeFile(cachePath, JSON.stringify({
|
|
14425
14539
|
source,
|
|
14426
14540
|
version: 1
|
|
14427
14541
|
}), "utf-8");
|
|
14428
14542
|
}, resolveResourceTransformCachePath = async (filePath, source, stylePreprocessors) => {
|
|
14429
|
-
const resourcePaths = collectAngularResourcePaths(source,
|
|
14543
|
+
const resourcePaths = collectAngularResourcePaths(source, dirname18(filePath));
|
|
14430
14544
|
const resourceContents = await Promise.all(resourcePaths.map(async (resourcePath) => {
|
|
14431
14545
|
const content = await fs5.readFile(resourcePath, "utf-8");
|
|
14432
14546
|
return `${resourcePath}\x00${content}`;
|
|
@@ -14439,7 +14553,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14439
14553
|
safeStableStringify(stylePreprocessors ?? null)
|
|
14440
14554
|
].join("\x00");
|
|
14441
14555
|
const cacheKey2 = Bun.hash(cacheInput).toString(BASE_36_RADIX);
|
|
14442
|
-
return
|
|
14556
|
+
return join30(process.cwd(), ".absolutejs", "cache", "angular-resources", `${cacheKey2}.json`);
|
|
14443
14557
|
}, precomputeAotResourceTransforms = async (inputPaths, readFile6, stylePreprocessors) => {
|
|
14444
14558
|
const transformedSources = new Map;
|
|
14445
14559
|
const visited = new Set;
|
|
@@ -14454,7 +14568,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14454
14568
|
if (visited.has(resolvedPath))
|
|
14455
14569
|
return;
|
|
14456
14570
|
visited.add(resolvedPath);
|
|
14457
|
-
if (!
|
|
14571
|
+
if (!existsSync23(resolvedPath) || resolvedPath.endsWith(".d.ts"))
|
|
14458
14572
|
return;
|
|
14459
14573
|
stats.filesVisited += 1;
|
|
14460
14574
|
const source = await readFileForAotTransform(resolvedPath, readFile6);
|
|
@@ -14466,7 +14580,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14466
14580
|
transformedSource = cached.source;
|
|
14467
14581
|
} else {
|
|
14468
14582
|
stats.cacheMisses += 1;
|
|
14469
|
-
const transformed = await inlineResources(source,
|
|
14583
|
+
const transformed = await inlineResources(source, dirname18(resolvedPath), stylePreprocessors);
|
|
14470
14584
|
transformedSource = transformed.source;
|
|
14471
14585
|
await writeResourceCacheFile(cachePath, transformedSource);
|
|
14472
14586
|
}
|
|
@@ -14485,17 +14599,17 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14485
14599
|
return { stats, transformedSources };
|
|
14486
14600
|
}, compileAngularFiles = async (inputPaths, outDir, stylePreprocessors) => {
|
|
14487
14601
|
const islandMetadataByOutputPath = await traceAngularPhase("aot/island-metadata", () => new Map(inputPaths.map((inputPath) => {
|
|
14488
|
-
const outputPath = resolve25(
|
|
14602
|
+
const outputPath = resolve25(join30(outDir, relative13(process.cwd(), resolve25(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
|
|
14489
14603
|
return [
|
|
14490
14604
|
outputPath,
|
|
14491
|
-
buildIslandMetadataExports(
|
|
14605
|
+
buildIslandMetadataExports(readFileSync18(inputPath, "utf-8"))
|
|
14492
14606
|
];
|
|
14493
14607
|
})), { entries: inputPaths.length });
|
|
14494
14608
|
await traceAngularPhase("aot/preload-compiler", () => import("@angular/compiler"));
|
|
14495
14609
|
const { readConfiguration, performCompilation, EmitFlags } = await traceAngularPhase("aot/import-compiler-cli", () => import("@angular/compiler-cli"));
|
|
14496
14610
|
const tsLibDir = await traceAngularPhase("aot/resolve-typescript-lib", () => {
|
|
14497
14611
|
const tsPath = __require.resolve("typescript");
|
|
14498
|
-
const tsRootDir =
|
|
14612
|
+
const tsRootDir = dirname18(tsPath);
|
|
14499
14613
|
return tsRootDir.endsWith("lib") ? tsRootDir : resolve25(tsRootDir, "lib");
|
|
14500
14614
|
});
|
|
14501
14615
|
const config = await traceAngularPhase("aot/read-configuration", () => readConfiguration("./tsconfig.json"));
|
|
@@ -14503,25 +14617,25 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14503
14617
|
emitDecoratorMetadata: true,
|
|
14504
14618
|
esModuleInterop: true,
|
|
14505
14619
|
experimentalDecorators: true,
|
|
14506
|
-
module:
|
|
14507
|
-
moduleResolution:
|
|
14508
|
-
newLine:
|
|
14620
|
+
module: ts9.ModuleKind.ESNext,
|
|
14621
|
+
moduleResolution: ts9.ModuleResolutionKind.Bundler,
|
|
14622
|
+
newLine: ts9.NewLineKind.LineFeed,
|
|
14509
14623
|
noLib: false,
|
|
14510
14624
|
outDir,
|
|
14511
14625
|
skipLibCheck: true,
|
|
14512
|
-
target:
|
|
14626
|
+
target: ts9.ScriptTarget.ES2022,
|
|
14513
14627
|
...config.options
|
|
14514
14628
|
};
|
|
14515
|
-
options.target =
|
|
14629
|
+
options.target = ts9.ScriptTarget.ES2022;
|
|
14516
14630
|
options.experimentalDecorators = true;
|
|
14517
14631
|
options.emitDecoratorMetadata = true;
|
|
14518
|
-
options.newLine =
|
|
14632
|
+
options.newLine = ts9.NewLineKind.LineFeed;
|
|
14519
14633
|
options.outDir = outDir;
|
|
14520
14634
|
options.noEmit = false;
|
|
14521
14635
|
options.incremental = false;
|
|
14522
14636
|
options.tsBuildInfoFile = undefined;
|
|
14523
14637
|
options.rootDir = process.cwd();
|
|
14524
|
-
const host = await traceAngularPhase("aot/create-compiler-host", () =>
|
|
14638
|
+
const host = await traceAngularPhase("aot/create-compiler-host", () => ts9.createCompilerHost(options));
|
|
14525
14639
|
const originalGetDefaultLibLocation = host.getDefaultLibLocation;
|
|
14526
14640
|
host.getDefaultLibLocation = () => tsLibDir || (originalGetDefaultLibLocation ? originalGetDefaultLibLocation() : "");
|
|
14527
14641
|
const originalGetDefaultLibFileName = host.getDefaultLibFileName;
|
|
@@ -14532,7 +14646,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14532
14646
|
const originalGetSourceFile = host.getSourceFile;
|
|
14533
14647
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
14534
14648
|
if (fileName.startsWith("lib.") && fileName.endsWith(".d.ts") && tsLibDir) {
|
|
14535
|
-
const resolvedPath =
|
|
14649
|
+
const resolvedPath = join30(tsLibDir, fileName);
|
|
14536
14650
|
return originalGetSourceFile?.call(host, resolvedPath, languageVersion, onError);
|
|
14537
14651
|
}
|
|
14538
14652
|
return originalGetSourceFile?.call(host, fileName, languageVersion, onError);
|
|
@@ -14567,7 +14681,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14567
14681
|
host.getSourceFile = (fileName, languageVersion, onError) => {
|
|
14568
14682
|
const source = transformedSources.get(resolve25(fileName));
|
|
14569
14683
|
if (source) {
|
|
14570
|
-
return
|
|
14684
|
+
return ts9.createSourceFile(fileName, source, languageVersion, true);
|
|
14571
14685
|
}
|
|
14572
14686
|
return originalGetSourceFileForCompile?.call(host, fileName, languageVersion, onError);
|
|
14573
14687
|
};
|
|
@@ -14587,7 +14701,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14587
14701
|
const entries = await traceAngularPhase("aot/postprocess-emitted-js", () => {
|
|
14588
14702
|
const rawEntries = Object.entries(emitted).filter(([fileName]) => fileName.endsWith(".js")).map(([fileName, content]) => ({
|
|
14589
14703
|
content,
|
|
14590
|
-
target:
|
|
14704
|
+
target: join30(outDir, fileName)
|
|
14591
14705
|
}));
|
|
14592
14706
|
const outputFiles = new Set(rawEntries.map(({ target }) => resolve25(target)));
|
|
14593
14707
|
return rawEntries.map(({ content, target }) => {
|
|
@@ -14609,7 +14723,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14609
14723
|
});
|
|
14610
14724
|
});
|
|
14611
14725
|
await traceAngularPhase("aot/write-output", () => Promise.all(entries.map(async ({ target, content }) => {
|
|
14612
|
-
await fs5.mkdir(
|
|
14726
|
+
await fs5.mkdir(dirname18(target), { recursive: true });
|
|
14613
14727
|
await fs5.writeFile(target, content, "utf-8");
|
|
14614
14728
|
})), { outputs: entries.length });
|
|
14615
14729
|
return await traceAngularPhase("aot/collect-output-paths", () => entries.map(({ target }) => target), { outputs: entries.length });
|
|
@@ -14628,7 +14742,7 @@ var traceAngularPhase = async (name, fn2, metadata2) => {
|
|
|
14628
14742
|
return null;
|
|
14629
14743
|
}, resolveAngularDeferImportSpecifier = () => {
|
|
14630
14744
|
const sourceEntry = resolve25(import.meta.dir, "../angular/components/index.ts");
|
|
14631
|
-
if (
|
|
14745
|
+
if (existsSync23(sourceEntry)) {
|
|
14632
14746
|
return sourceEntry.replace(/\\/g, "/");
|
|
14633
14747
|
}
|
|
14634
14748
|
return "@absolutejs/absolute/angular/components";
|
|
@@ -14756,7 +14870,7 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
|
|
|
14756
14870
|
${fields}
|
|
14757
14871
|
`);
|
|
14758
14872
|
}, readAndEscapeFile = async (filePath, stylePreprocessors) => {
|
|
14759
|
-
if (!
|
|
14873
|
+
if (!existsSync23(filePath)) {
|
|
14760
14874
|
throw new Error(`Unable to inline Angular style resource: file not found at ${filePath}`);
|
|
14761
14875
|
}
|
|
14762
14876
|
const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
|
|
@@ -14764,8 +14878,8 @@ ${fields}
|
|
|
14764
14878
|
}, inlineTemplateAndLowerDefer = async (source, fileDir) => {
|
|
14765
14879
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14766
14880
|
if (templateUrlMatch?.[1]) {
|
|
14767
|
-
const templatePath =
|
|
14768
|
-
if (!
|
|
14881
|
+
const templatePath = join30(fileDir, templateUrlMatch[1]);
|
|
14882
|
+
if (!existsSync23(templatePath)) {
|
|
14769
14883
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
14770
14884
|
}
|
|
14771
14885
|
const templateRaw2 = await fs5.readFile(templatePath, "utf-8");
|
|
@@ -14795,11 +14909,11 @@ ${fields}
|
|
|
14795
14909
|
}, inlineTemplateAndLowerDeferSync = (source, fileDir) => {
|
|
14796
14910
|
const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14797
14911
|
if (templateUrlMatch?.[1]) {
|
|
14798
|
-
const templatePath =
|
|
14799
|
-
if (!
|
|
14912
|
+
const templatePath = join30(fileDir, templateUrlMatch[1]);
|
|
14913
|
+
if (!existsSync23(templatePath)) {
|
|
14800
14914
|
throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
|
|
14801
14915
|
}
|
|
14802
|
-
const templateRaw2 =
|
|
14916
|
+
const templateRaw2 = readFileSync18(templatePath, "utf-8");
|
|
14803
14917
|
const lowered2 = lowerAngularDeferSyntax(templateRaw2);
|
|
14804
14918
|
const escaped2 = escapeTemplateContent(lowered2.template);
|
|
14805
14919
|
const replacedSource2 = source.slice(0, templateUrlMatch.index) + `template: \`${escaped2}\`` + source.slice(templateUrlMatch.index + templateUrlMatch[0].length);
|
|
@@ -14832,7 +14946,7 @@ ${fields}
|
|
|
14832
14946
|
return source;
|
|
14833
14947
|
const stylePromises = urlMatches.map((urlMatch) => {
|
|
14834
14948
|
const styleUrl = urlMatch.replace(/['"]/g, "");
|
|
14835
|
-
return readAndEscapeFile(
|
|
14949
|
+
return readAndEscapeFile(join30(fileDir, styleUrl), stylePreprocessors);
|
|
14836
14950
|
});
|
|
14837
14951
|
const results = await Promise.all(stylePromises);
|
|
14838
14952
|
const inlinedStyles = results.filter(Boolean).map((escaped) => `\`${escaped}\``);
|
|
@@ -14843,7 +14957,7 @@ ${fields}
|
|
|
14843
14957
|
const styleUrlMatch = findUncommentedMatch(source, /styleUrl\s*:\s*['"]([^'"]+)['"]/);
|
|
14844
14958
|
if (!styleUrlMatch?.[1])
|
|
14845
14959
|
return source;
|
|
14846
|
-
const escaped = await readAndEscapeFile(
|
|
14960
|
+
const escaped = await readAndEscapeFile(join30(fileDir, styleUrlMatch[1]), stylePreprocessors);
|
|
14847
14961
|
if (!escaped)
|
|
14848
14962
|
return source;
|
|
14849
14963
|
return source.slice(0, styleUrlMatch.index) + `styles: [\`${escaped}\`]` + source.slice(styleUrlMatch.index + styleUrlMatch[0].length);
|
|
@@ -14879,12 +14993,12 @@ ${fields}
|
|
|
14879
14993
|
`${candidate}.js`,
|
|
14880
14994
|
`${candidate}.jsx`,
|
|
14881
14995
|
`${candidate}.json`,
|
|
14882
|
-
|
|
14883
|
-
|
|
14884
|
-
|
|
14885
|
-
|
|
14996
|
+
join30(candidate, "index.ts"),
|
|
14997
|
+
join30(candidate, "index.tsx"),
|
|
14998
|
+
join30(candidate, "index.js"),
|
|
14999
|
+
join30(candidate, "index.jsx")
|
|
14886
15000
|
];
|
|
14887
|
-
return candidates.find((file4) =>
|
|
15001
|
+
return candidates.find((file4) => existsSync23(file4));
|
|
14888
15002
|
};
|
|
14889
15003
|
const resolveLocalImport = (specifier, fromDir) => {
|
|
14890
15004
|
if (specifier.startsWith(".") || specifier.startsWith("/")) {
|
|
@@ -14906,10 +15020,10 @@ ${fields}
|
|
|
14906
15020
|
}
|
|
14907
15021
|
};
|
|
14908
15022
|
const toOutputPath = (sourcePath) => {
|
|
14909
|
-
const inputDir =
|
|
15023
|
+
const inputDir = dirname18(sourcePath);
|
|
14910
15024
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
14911
15025
|
const fileBase = basename9(sourcePath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
14912
|
-
return
|
|
15026
|
+
return join30(outDir, relativeDir, fileBase);
|
|
14913
15027
|
};
|
|
14914
15028
|
const withCacheBuster = (specifier) => {
|
|
14915
15029
|
if (!cacheBuster)
|
|
@@ -14956,11 +15070,11 @@ ${fields}
|
|
|
14956
15070
|
if (visited.has(resolved))
|
|
14957
15071
|
return;
|
|
14958
15072
|
visited.add(resolved);
|
|
14959
|
-
if (resolved.endsWith(".json") &&
|
|
14960
|
-
const inputDir2 =
|
|
15073
|
+
if (resolved.endsWith(".json") && existsSync23(resolved)) {
|
|
15074
|
+
const inputDir2 = dirname18(resolved);
|
|
14961
15075
|
const relativeDir2 = inputDir2.startsWith(baseDir) ? inputDir2.substring(baseDir.length + 1) : inputDir2;
|
|
14962
|
-
const targetDir2 =
|
|
14963
|
-
const targetPath2 =
|
|
15076
|
+
const targetDir2 = join30(outDir, relativeDir2);
|
|
15077
|
+
const targetPath2 = join30(targetDir2, basename9(resolved));
|
|
14964
15078
|
await fs5.mkdir(targetDir2, { recursive: true });
|
|
14965
15079
|
await fs5.copyFile(resolved, targetPath2);
|
|
14966
15080
|
allOutputs.push(targetPath2);
|
|
@@ -14969,15 +15083,15 @@ ${fields}
|
|
|
14969
15083
|
let actualPath = resolved;
|
|
14970
15084
|
if (!actualPath.endsWith(".ts"))
|
|
14971
15085
|
actualPath += ".ts";
|
|
14972
|
-
if (!
|
|
15086
|
+
if (!existsSync23(actualPath))
|
|
14973
15087
|
return;
|
|
14974
15088
|
let sourceCode = await fs5.readFile(actualPath, "utf-8");
|
|
14975
|
-
const inlined = await inlineResources(sourceCode,
|
|
14976
|
-
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source,
|
|
14977
|
-
const inputDir =
|
|
15089
|
+
const inlined = await inlineResources(sourceCode, dirname18(actualPath), stylePreprocessors);
|
|
15090
|
+
sourceCode = inlineTemplateAndLowerDeferSync(inlined.source, dirname18(actualPath)).source;
|
|
15091
|
+
const inputDir = dirname18(actualPath);
|
|
14978
15092
|
const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
|
|
14979
15093
|
const fileBase = basename9(actualPath).replace(/\.[cm]?[tj]sx?$/, ".js");
|
|
14980
|
-
const targetDir =
|
|
15094
|
+
const targetDir = join30(outDir, relativeDir);
|
|
14981
15095
|
const targetPath = toOutputPath(actualPath);
|
|
14982
15096
|
const localImports = [];
|
|
14983
15097
|
const importRewrites = new Map;
|
|
@@ -15007,7 +15121,7 @@ ${fields}
|
|
|
15007
15121
|
const isEntry = resolve25(actualPath) === resolve25(entryPath);
|
|
15008
15122
|
const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
|
|
15009
15123
|
const cacheKey2 = actualPath;
|
|
15010
|
-
const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey2) !== contentHash || !
|
|
15124
|
+
const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey2) !== contentHash || !existsSync23(targetPath);
|
|
15011
15125
|
if (shouldWriteFile) {
|
|
15012
15126
|
const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath, importRewrites);
|
|
15013
15127
|
await fs5.mkdir(targetDir, { recursive: true });
|
|
@@ -15019,7 +15133,7 @@ ${fields}
|
|
|
15019
15133
|
};
|
|
15020
15134
|
await transpileFile(inputPath);
|
|
15021
15135
|
const entryOutputPath = toOutputPath(entryPath);
|
|
15022
|
-
if (
|
|
15136
|
+
if (existsSync23(entryOutputPath)) {
|
|
15023
15137
|
const entryOutput = await fs5.readFile(entryOutputPath, "utf-8");
|
|
15024
15138
|
const withoutLegacyFlag = entryOutput.replace(/\nexport const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;\n?/g, `
|
|
15025
15139
|
`);
|
|
@@ -15038,24 +15152,24 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
15038
15152
|
return { clientPaths: [...emptyPaths], serverPaths: [...emptyPaths] };
|
|
15039
15153
|
}
|
|
15040
15154
|
const compiledRoot = compiledParent;
|
|
15041
|
-
const indexesDir =
|
|
15155
|
+
const indexesDir = join30(compiledParent, "indexes");
|
|
15042
15156
|
await traceAngularPhase("setup/create-indexes-dir", () => fs5.mkdir(indexesDir, { recursive: true }));
|
|
15043
15157
|
const aotOutputs = hmr ? [] : await traceAngularPhase("aot/compile-files", () => compileAngularFiles(entryPoints.map((entry) => resolve25(entry)), compiledRoot, stylePreprocessors), { entries: entryPoints.length });
|
|
15044
15158
|
if (!hmr) {
|
|
15045
15159
|
await traceAngularPhase("aot/copy-json-resources", async () => {
|
|
15046
15160
|
const cwd = process.cwd();
|
|
15047
15161
|
const angularSrcDir = resolve25(outRoot);
|
|
15048
|
-
if (!
|
|
15162
|
+
if (!existsSync23(angularSrcDir))
|
|
15049
15163
|
return;
|
|
15050
15164
|
const jsonGlob = new Glob6("**/*.json");
|
|
15051
15165
|
for (const rel of jsonGlob.scanSync({
|
|
15052
15166
|
absolute: false,
|
|
15053
15167
|
cwd: angularSrcDir
|
|
15054
15168
|
})) {
|
|
15055
|
-
const sourcePath =
|
|
15169
|
+
const sourcePath = join30(angularSrcDir, rel);
|
|
15056
15170
|
const cwdRel = relative13(cwd, sourcePath);
|
|
15057
|
-
const targetPath =
|
|
15058
|
-
await fs5.mkdir(
|
|
15171
|
+
const targetPath = join30(compiledRoot, cwdRel);
|
|
15172
|
+
await fs5.mkdir(dirname18(targetPath), { recursive: true });
|
|
15059
15173
|
await fs5.copyFile(sourcePath, targetPath);
|
|
15060
15174
|
}
|
|
15061
15175
|
});
|
|
@@ -15071,24 +15185,24 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
15071
15185
|
const fileBase = basename9(resolvedEntry).replace(/\.[tj]s$/, "");
|
|
15072
15186
|
const jsName = `${fileBase}.js`;
|
|
15073
15187
|
const compiledFallbackPaths = [
|
|
15074
|
-
|
|
15075
|
-
|
|
15076
|
-
|
|
15188
|
+
join30(compiledRoot, relativeEntry),
|
|
15189
|
+
join30(compiledRoot, "pages", jsName),
|
|
15190
|
+
join30(compiledRoot, jsName)
|
|
15077
15191
|
].map((file4) => resolve25(file4));
|
|
15078
15192
|
const resolveRawServerFile = (candidatePaths) => {
|
|
15079
15193
|
const normalizedCandidates = [
|
|
15080
15194
|
...candidatePaths.map((file4) => resolve25(file4)),
|
|
15081
15195
|
...compiledFallbackPaths
|
|
15082
15196
|
];
|
|
15083
|
-
let candidate = normalizedCandidates.find((file4) =>
|
|
15197
|
+
let candidate = normalizedCandidates.find((file4) => existsSync23(file4) && file4.endsWith(`${sep3}${relativeEntry}`));
|
|
15084
15198
|
if (!candidate) {
|
|
15085
|
-
candidate = normalizedCandidates.find((file4) =>
|
|
15199
|
+
candidate = normalizedCandidates.find((file4) => existsSync23(file4) && file4.endsWith(`${sep3}pages${sep3}${jsName}`));
|
|
15086
15200
|
}
|
|
15087
15201
|
if (!candidate) {
|
|
15088
|
-
candidate = normalizedCandidates.find((file4) =>
|
|
15202
|
+
candidate = normalizedCandidates.find((file4) => existsSync23(file4) && file4.endsWith(`${sep3}${jsName}`));
|
|
15089
15203
|
}
|
|
15090
15204
|
if (!candidate) {
|
|
15091
|
-
candidate = normalizedCandidates.find((file4) =>
|
|
15205
|
+
candidate = normalizedCandidates.find((file4) => existsSync23(file4));
|
|
15092
15206
|
}
|
|
15093
15207
|
return candidate;
|
|
15094
15208
|
};
|
|
@@ -15096,11 +15210,11 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
15096
15210
|
if (!rawServerFile) {
|
|
15097
15211
|
rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-fallback", () => resolveRawServerFile([]), { entry: resolvedEntry });
|
|
15098
15212
|
}
|
|
15099
|
-
if (rawServerFile && !
|
|
15213
|
+
if (rawServerFile && !existsSync23(rawServerFile)) {
|
|
15100
15214
|
outputs = hmr ? await compileEntry() : aotOutputs;
|
|
15101
15215
|
rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-retry", () => resolveRawServerFile(outputs), { entry: resolvedEntry });
|
|
15102
15216
|
}
|
|
15103
|
-
if (!rawServerFile || !
|
|
15217
|
+
if (!rawServerFile || !existsSync23(rawServerFile)) {
|
|
15104
15218
|
throw new Error(`Compiled output not found for ${entry}. Looking for: ${jsName}. Available: ${[
|
|
15105
15219
|
...outputs,
|
|
15106
15220
|
...compiledFallbackPaths
|
|
@@ -15121,8 +15235,8 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
15121
15235
|
const usesLegacyAnimations = await traceAngularPhase("wrapper/detect-legacy-animations", () => usesLegacyAngularAnimations(resolvedEntry), { entry: resolvedEntry });
|
|
15122
15236
|
const serverContentHash = Bun.hash(original).toString(BASE_36_RADIX);
|
|
15123
15237
|
const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
|
|
15124
|
-
const clientFile =
|
|
15125
|
-
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__"))) {
|
|
15126
15240
|
return {
|
|
15127
15241
|
clientPath: clientFile,
|
|
15128
15242
|
indexUnchanged: true,
|
|
@@ -15150,8 +15264,8 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
|
|
|
15150
15264
|
const relativePath = relative13(indexesDir, rawServerFile).replace(/\\/g, "/");
|
|
15151
15265
|
const normalizedImportPath = relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
|
|
15152
15266
|
const manifestKeyForProviders = toPascal(fileBase);
|
|
15153
|
-
const providersFilePath =
|
|
15154
|
-
const hasGeneratedProviders =
|
|
15267
|
+
const providersFilePath = join30(compiledParent, "providers", `${manifestKeyForProviders}.providers.ts`);
|
|
15268
|
+
const hasGeneratedProviders = existsSync23(providersFilePath);
|
|
15155
15269
|
const providersImportPath = hasGeneratedProviders ? (() => {
|
|
15156
15270
|
const rel = relative13(indexesDir, providersFilePath.replace(/\.ts$/, "")).replace(/\\/g, "/");
|
|
15157
15271
|
return rel.startsWith(".") ? rel : `./${rel}`;
|
|
@@ -15357,24 +15471,24 @@ var init_compileAngular = __esm(() => {
|
|
|
15357
15471
|
init_stylePreprocessor();
|
|
15358
15472
|
init_generatedDir();
|
|
15359
15473
|
devClientDir4 = resolveDevClientDir4();
|
|
15360
|
-
hmrClientPath5 =
|
|
15474
|
+
hmrClientPath5 = join30(devClientDir4, "hmrClient.ts").replace(/\\/g, "/");
|
|
15361
15475
|
jitContentCache = new Map;
|
|
15362
15476
|
wrapperOutputCache = new Map;
|
|
15363
15477
|
});
|
|
15364
15478
|
|
|
15365
15479
|
// src/dev/angular/hmrImportGenerator.ts
|
|
15366
|
-
import
|
|
15480
|
+
import ts10 from "typescript";
|
|
15367
15481
|
var createHmrImportGenerator = (namespaceMap) => ({
|
|
15368
15482
|
addImport(request) {
|
|
15369
15483
|
const ns = namespaceMap.get(request.exportModuleSpecifier);
|
|
15370
15484
|
if (!ns) {
|
|
15371
15485
|
throw new Error(`HMR import generator has no namespace mapping for ${request.exportModuleSpecifier}. ` + `Add it to namespaceDependencies before calling compileHmrUpdateCallback.`);
|
|
15372
15486
|
}
|
|
15373
|
-
const namespaceId =
|
|
15487
|
+
const namespaceId = ts10.factory.createIdentifier(ns);
|
|
15374
15488
|
if (request.exportSymbolName === null) {
|
|
15375
15489
|
return namespaceId;
|
|
15376
15490
|
}
|
|
15377
|
-
return
|
|
15491
|
+
return ts10.factory.createPropertyAccessExpression(namespaceId, ts10.factory.createIdentifier(request.exportSymbolName));
|
|
15378
15492
|
}
|
|
15379
15493
|
});
|
|
15380
15494
|
var init_hmrImportGenerator = () => {};
|
|
@@ -15747,13 +15861,13 @@ var init_translator = __esm(() => {
|
|
|
15747
15861
|
});
|
|
15748
15862
|
|
|
15749
15863
|
// src/dev/angular/vendor/translator/ts_util.ts
|
|
15750
|
-
import
|
|
15864
|
+
import ts11 from "typescript";
|
|
15751
15865
|
function tsNumericExpression(value) {
|
|
15752
15866
|
if (value < 0) {
|
|
15753
|
-
const operand =
|
|
15754
|
-
return
|
|
15867
|
+
const operand = ts11.factory.createNumericLiteral(Math.abs(value));
|
|
15868
|
+
return ts11.factory.createPrefixUnaryExpression(ts11.SyntaxKind.MinusToken, operand);
|
|
15755
15869
|
}
|
|
15756
|
-
return
|
|
15870
|
+
return ts11.factory.createNumericLiteral(value);
|
|
15757
15871
|
}
|
|
15758
15872
|
var init_ts_util = __esm(() => {
|
|
15759
15873
|
/*!
|
|
@@ -15766,142 +15880,142 @@ var init_ts_util = __esm(() => {
|
|
|
15766
15880
|
});
|
|
15767
15881
|
|
|
15768
15882
|
// src/dev/angular/vendor/translator/typescript_ast_factory.ts
|
|
15769
|
-
import
|
|
15883
|
+
import ts12 from "typescript";
|
|
15770
15884
|
|
|
15771
15885
|
class TypeScriptAstFactory {
|
|
15772
15886
|
annotateForClosureCompiler;
|
|
15773
15887
|
externalSourceFiles = new Map;
|
|
15774
15888
|
UNARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
15775
|
-
"+":
|
|
15776
|
-
"-":
|
|
15777
|
-
"!":
|
|
15889
|
+
"+": ts12.SyntaxKind.PlusToken,
|
|
15890
|
+
"-": ts12.SyntaxKind.MinusToken,
|
|
15891
|
+
"!": ts12.SyntaxKind.ExclamationToken
|
|
15778
15892
|
}))();
|
|
15779
15893
|
BINARY_OPERATORS = /* @__PURE__ */ (() => ({
|
|
15780
|
-
"&&":
|
|
15781
|
-
">":
|
|
15782
|
-
">=":
|
|
15783
|
-
"&":
|
|
15784
|
-
"|":
|
|
15785
|
-
"/":
|
|
15786
|
-
"==":
|
|
15787
|
-
"===":
|
|
15788
|
-
"<":
|
|
15789
|
-
"<=":
|
|
15790
|
-
"-":
|
|
15791
|
-
"%":
|
|
15792
|
-
"*":
|
|
15793
|
-
"**":
|
|
15794
|
-
"!=":
|
|
15795
|
-
"!==":
|
|
15796
|
-
"||":
|
|
15797
|
-
"+":
|
|
15798
|
-
"??":
|
|
15799
|
-
"=":
|
|
15800
|
-
"+=":
|
|
15801
|
-
"-=":
|
|
15802
|
-
"*=":
|
|
15803
|
-
"/=":
|
|
15804
|
-
"%=":
|
|
15805
|
-
"**=":
|
|
15806
|
-
"&&=":
|
|
15807
|
-
"||=":
|
|
15808
|
-
"??=":
|
|
15809
|
-
in:
|
|
15810
|
-
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
|
|
15811
15925
|
}))();
|
|
15812
15926
|
VAR_TYPES = /* @__PURE__ */ (() => ({
|
|
15813
|
-
const:
|
|
15814
|
-
let:
|
|
15815
|
-
var:
|
|
15927
|
+
const: ts12.NodeFlags.Const,
|
|
15928
|
+
let: ts12.NodeFlags.Let,
|
|
15929
|
+
var: ts12.NodeFlags.None
|
|
15816
15930
|
}))();
|
|
15817
15931
|
constructor(annotateForClosureCompiler) {
|
|
15818
15932
|
this.annotateForClosureCompiler = annotateForClosureCompiler;
|
|
15819
15933
|
}
|
|
15820
15934
|
attachComments = attachComments;
|
|
15821
|
-
createArrayLiteral =
|
|
15935
|
+
createArrayLiteral = ts12.factory.createArrayLiteralExpression;
|
|
15822
15936
|
createAssignment(target, operator, value) {
|
|
15823
|
-
return
|
|
15937
|
+
return ts12.factory.createBinaryExpression(target, this.BINARY_OPERATORS[operator], value);
|
|
15824
15938
|
}
|
|
15825
15939
|
createBinaryExpression(leftOperand, operator, rightOperand) {
|
|
15826
|
-
return
|
|
15940
|
+
return ts12.factory.createBinaryExpression(leftOperand, this.BINARY_OPERATORS[operator], rightOperand);
|
|
15827
15941
|
}
|
|
15828
15942
|
createBlock(body) {
|
|
15829
|
-
return
|
|
15943
|
+
return ts12.factory.createBlock(body);
|
|
15830
15944
|
}
|
|
15831
15945
|
createCallExpression(callee, args, pure) {
|
|
15832
|
-
const call =
|
|
15946
|
+
const call = ts12.factory.createCallExpression(callee, undefined, args);
|
|
15833
15947
|
if (pure) {
|
|
15834
|
-
|
|
15948
|
+
ts12.addSyntheticLeadingComment(call, ts12.SyntaxKind.MultiLineCommentTrivia, this.annotateForClosureCompiler ? "* @pureOrBreakMyCode " /* CLOSURE */ : "@__PURE__" /* TERSER */, false);
|
|
15835
15949
|
}
|
|
15836
15950
|
return call;
|
|
15837
15951
|
}
|
|
15838
15952
|
createConditional(condition, whenTrue, whenFalse) {
|
|
15839
|
-
return
|
|
15953
|
+
return ts12.factory.createConditionalExpression(condition, undefined, whenTrue, undefined, whenFalse);
|
|
15840
15954
|
}
|
|
15841
|
-
createElementAccess =
|
|
15842
|
-
createExpressionStatement =
|
|
15955
|
+
createElementAccess = ts12.factory.createElementAccessExpression;
|
|
15956
|
+
createExpressionStatement = ts12.factory.createExpressionStatement;
|
|
15843
15957
|
createDynamicImport(url) {
|
|
15844
|
-
return
|
|
15845
|
-
typeof url === "string" ?
|
|
15958
|
+
return ts12.factory.createCallExpression(ts12.factory.createToken(ts12.SyntaxKind.ImportKeyword), undefined, [
|
|
15959
|
+
typeof url === "string" ? ts12.factory.createStringLiteral(url) : url
|
|
15846
15960
|
]);
|
|
15847
15961
|
}
|
|
15848
15962
|
createFunctionDeclaration(functionName, parameters, body) {
|
|
15849
|
-
if (!
|
|
15850
|
-
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]}.`);
|
|
15851
15965
|
}
|
|
15852
|
-
return
|
|
15966
|
+
return ts12.factory.createFunctionDeclaration(undefined, undefined, functionName, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
15853
15967
|
}
|
|
15854
15968
|
createFunctionExpression(functionName, parameters, body) {
|
|
15855
|
-
if (!
|
|
15856
|
-
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]}.`);
|
|
15857
15971
|
}
|
|
15858
|
-
return
|
|
15972
|
+
return ts12.factory.createFunctionExpression(undefined, undefined, functionName ?? undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, body);
|
|
15859
15973
|
}
|
|
15860
15974
|
createArrowFunctionExpression(parameters, body) {
|
|
15861
|
-
if (
|
|
15862
|
-
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]}.`);
|
|
15863
15977
|
}
|
|
15864
|
-
return
|
|
15978
|
+
return ts12.factory.createArrowFunction(undefined, undefined, parameters.map((param) => this.createParameter(param)), undefined, undefined, body);
|
|
15865
15979
|
}
|
|
15866
15980
|
createParameter(param) {
|
|
15867
|
-
return
|
|
15981
|
+
return ts12.factory.createParameterDeclaration(undefined, undefined, param.name, undefined, param.type ?? undefined);
|
|
15868
15982
|
}
|
|
15869
|
-
createIdentifier =
|
|
15983
|
+
createIdentifier = ts12.factory.createIdentifier;
|
|
15870
15984
|
createIfStatement(condition, thenStatement, elseStatement) {
|
|
15871
|
-
return
|
|
15985
|
+
return ts12.factory.createIfStatement(condition, thenStatement, elseStatement ?? undefined);
|
|
15872
15986
|
}
|
|
15873
15987
|
createLiteral(value) {
|
|
15874
15988
|
if (value === undefined) {
|
|
15875
|
-
return
|
|
15989
|
+
return ts12.factory.createIdentifier("undefined");
|
|
15876
15990
|
} else if (value === null) {
|
|
15877
|
-
return
|
|
15991
|
+
return ts12.factory.createNull();
|
|
15878
15992
|
} else if (typeof value === "boolean") {
|
|
15879
|
-
return value ?
|
|
15993
|
+
return value ? ts12.factory.createTrue() : ts12.factory.createFalse();
|
|
15880
15994
|
} else if (typeof value === "number") {
|
|
15881
15995
|
return tsNumericExpression(value);
|
|
15882
15996
|
} else {
|
|
15883
|
-
return
|
|
15997
|
+
return ts12.factory.createStringLiteral(value);
|
|
15884
15998
|
}
|
|
15885
15999
|
}
|
|
15886
16000
|
createNewExpression(expression, args) {
|
|
15887
|
-
return
|
|
16001
|
+
return ts12.factory.createNewExpression(expression, undefined, args);
|
|
15888
16002
|
}
|
|
15889
16003
|
createObjectLiteral(properties) {
|
|
15890
|
-
return
|
|
16004
|
+
return ts12.factory.createObjectLiteralExpression(properties.map((prop) => {
|
|
15891
16005
|
if (prop.kind === "spread") {
|
|
15892
|
-
return
|
|
16006
|
+
return ts12.factory.createSpreadAssignment(prop.expression);
|
|
15893
16007
|
}
|
|
15894
|
-
return
|
|
16008
|
+
return ts12.factory.createPropertyAssignment(prop.quoted ? ts12.factory.createStringLiteral(prop.propertyName) : ts12.factory.createIdentifier(prop.propertyName), prop.value);
|
|
15895
16009
|
}));
|
|
15896
16010
|
}
|
|
15897
|
-
createParenthesizedExpression =
|
|
15898
|
-
createPropertyAccess =
|
|
15899
|
-
createSpreadElement =
|
|
16011
|
+
createParenthesizedExpression = ts12.factory.createParenthesizedExpression;
|
|
16012
|
+
createPropertyAccess = ts12.factory.createPropertyAccessExpression;
|
|
16013
|
+
createSpreadElement = ts12.factory.createSpreadElement;
|
|
15900
16014
|
createReturnStatement(expression) {
|
|
15901
|
-
return
|
|
16015
|
+
return ts12.factory.createReturnStatement(expression ?? undefined);
|
|
15902
16016
|
}
|
|
15903
16017
|
createTaggedTemplate(tag, template) {
|
|
15904
|
-
return
|
|
16018
|
+
return ts12.factory.createTaggedTemplateExpression(tag, undefined, this.createTemplateLiteral(template));
|
|
15905
16019
|
}
|
|
15906
16020
|
createTemplateLiteral(template) {
|
|
15907
16021
|
let templateLiteral;
|
|
@@ -15911,7 +16025,7 @@ class TypeScriptAstFactory {
|
|
|
15911
16025
|
throw new Error("createTemplateLiteral: template has no elements");
|
|
15912
16026
|
}
|
|
15913
16027
|
if (length === 1) {
|
|
15914
|
-
templateLiteral =
|
|
16028
|
+
templateLiteral = ts12.factory.createNoSubstitutionTemplateLiteral(head.cooked, head.raw);
|
|
15915
16029
|
} else {
|
|
15916
16030
|
const spans = [];
|
|
15917
16031
|
for (let i = 1;i < length - 1; i++) {
|
|
@@ -15925,7 +16039,7 @@ class TypeScriptAstFactory {
|
|
|
15925
16039
|
if (range !== null) {
|
|
15926
16040
|
this.setSourceMapRange(middle, range);
|
|
15927
16041
|
}
|
|
15928
|
-
spans.push(
|
|
16042
|
+
spans.push(ts12.factory.createTemplateSpan(expression, middle));
|
|
15929
16043
|
}
|
|
15930
16044
|
const resolvedExpression = template.expressions[length - 2];
|
|
15931
16045
|
const templatePart = template.elements[length - 1];
|
|
@@ -15936,27 +16050,27 @@ class TypeScriptAstFactory {
|
|
|
15936
16050
|
if (templatePart.range !== null) {
|
|
15937
16051
|
this.setSourceMapRange(templateTail, templatePart.range);
|
|
15938
16052
|
}
|
|
15939
|
-
spans.push(
|
|
15940
|
-
templateLiteral =
|
|
16053
|
+
spans.push(ts12.factory.createTemplateSpan(resolvedExpression, templateTail));
|
|
16054
|
+
templateLiteral = ts12.factory.createTemplateExpression(ts12.factory.createTemplateHead(head.cooked, head.raw), spans);
|
|
15941
16055
|
}
|
|
15942
16056
|
if (head.range !== null) {
|
|
15943
16057
|
this.setSourceMapRange(templateLiteral, head.range);
|
|
15944
16058
|
}
|
|
15945
16059
|
return templateLiteral;
|
|
15946
16060
|
}
|
|
15947
|
-
createThrowStatement =
|
|
15948
|
-
createTypeOfExpression =
|
|
15949
|
-
createVoidExpression =
|
|
16061
|
+
createThrowStatement = ts12.factory.createThrowStatement;
|
|
16062
|
+
createTypeOfExpression = ts12.factory.createTypeOfExpression;
|
|
16063
|
+
createVoidExpression = ts12.factory.createVoidExpression;
|
|
15950
16064
|
createUnaryExpression(operator, operand) {
|
|
15951
|
-
return
|
|
16065
|
+
return ts12.factory.createPrefixUnaryExpression(this.UNARY_OPERATORS[operator], operand);
|
|
15952
16066
|
}
|
|
15953
16067
|
createVariableDeclaration(variableName, initializer, variableType, type) {
|
|
15954
|
-
return
|
|
15955
|
-
|
|
16068
|
+
return ts12.factory.createVariableStatement(undefined, ts12.factory.createVariableDeclarationList([
|
|
16069
|
+
ts12.factory.createVariableDeclaration(variableName, undefined, type ?? undefined, initializer ?? undefined)
|
|
15956
16070
|
], this.VAR_TYPES[variableType]));
|
|
15957
16071
|
}
|
|
15958
16072
|
createRegularExpressionLiteral(body, flags) {
|
|
15959
|
-
return
|
|
16073
|
+
return ts12.factory.createRegularExpressionLiteral(`/${body}/${flags ?? ""}`);
|
|
15960
16074
|
}
|
|
15961
16075
|
setSourceMapRange(node, sourceMapRange) {
|
|
15962
16076
|
if (sourceMapRange === null) {
|
|
@@ -15964,10 +16078,10 @@ class TypeScriptAstFactory {
|
|
|
15964
16078
|
}
|
|
15965
16079
|
const url = sourceMapRange.url;
|
|
15966
16080
|
if (!this.externalSourceFiles.has(url)) {
|
|
15967
|
-
this.externalSourceFiles.set(url,
|
|
16081
|
+
this.externalSourceFiles.set(url, ts12.createSourceMapSource(url, sourceMapRange.content, (pos) => pos));
|
|
15968
16082
|
}
|
|
15969
16083
|
const source = this.externalSourceFiles.get(url);
|
|
15970
|
-
|
|
16084
|
+
ts12.setSourceMapRange(node, {
|
|
15971
16085
|
pos: sourceMapRange.start.offset,
|
|
15972
16086
|
end: sourceMapRange.end.offset,
|
|
15973
16087
|
source
|
|
@@ -15977,77 +16091,77 @@ class TypeScriptAstFactory {
|
|
|
15977
16091
|
createBuiltInType(type) {
|
|
15978
16092
|
switch (type) {
|
|
15979
16093
|
case "any":
|
|
15980
|
-
return
|
|
16094
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.AnyKeyword);
|
|
15981
16095
|
case "boolean":
|
|
15982
|
-
return
|
|
16096
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.BooleanKeyword);
|
|
15983
16097
|
case "number":
|
|
15984
|
-
return
|
|
16098
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.NumberKeyword);
|
|
15985
16099
|
case "string":
|
|
15986
|
-
return
|
|
16100
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.StringKeyword);
|
|
15987
16101
|
case "function":
|
|
15988
|
-
return
|
|
16102
|
+
return ts12.factory.createTypeReferenceNode(ts12.factory.createIdentifier("Function"));
|
|
15989
16103
|
case "never":
|
|
15990
|
-
return
|
|
16104
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.NeverKeyword);
|
|
15991
16105
|
case "unknown":
|
|
15992
|
-
return
|
|
16106
|
+
return ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.UnknownKeyword);
|
|
15993
16107
|
}
|
|
15994
16108
|
}
|
|
15995
16109
|
createExpressionType(expression, typeParams) {
|
|
15996
16110
|
const typeName = getEntityTypeFromExpression(expression);
|
|
15997
|
-
return
|
|
16111
|
+
return ts12.factory.createTypeReferenceNode(typeName, typeParams ?? undefined);
|
|
15998
16112
|
}
|
|
15999
16113
|
createArrayType(elementType) {
|
|
16000
|
-
return
|
|
16114
|
+
return ts12.factory.createArrayTypeNode(elementType);
|
|
16001
16115
|
}
|
|
16002
16116
|
createMapType(valueType) {
|
|
16003
|
-
return
|
|
16004
|
-
|
|
16005
|
-
|
|
16117
|
+
return ts12.factory.createTypeLiteralNode([
|
|
16118
|
+
ts12.factory.createIndexSignature(undefined, [
|
|
16119
|
+
ts12.factory.createParameterDeclaration(undefined, undefined, "key", undefined, ts12.factory.createKeywordTypeNode(ts12.SyntaxKind.StringKeyword))
|
|
16006
16120
|
], valueType)
|
|
16007
16121
|
]);
|
|
16008
16122
|
}
|
|
16009
16123
|
transplantType(type) {
|
|
16010
|
-
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" &&
|
|
16124
|
+
if (typeof type.kind === "number" && typeof type.getSourceFile === "function" && ts12.isTypeNode(type)) {
|
|
16011
16125
|
return type;
|
|
16012
16126
|
}
|
|
16013
16127
|
throw new Error("Attempting to transplant a type node from a non-TypeScript AST: " + type);
|
|
16014
16128
|
}
|
|
16015
16129
|
}
|
|
16016
16130
|
function createTemplateMiddle(cooked, raw) {
|
|
16017
|
-
const node =
|
|
16018
|
-
node.kind =
|
|
16131
|
+
const node = ts12.factory.createTemplateHead(cooked, raw);
|
|
16132
|
+
node.kind = ts12.SyntaxKind.TemplateMiddle;
|
|
16019
16133
|
return node;
|
|
16020
16134
|
}
|
|
16021
16135
|
function createTemplateTail(cooked, raw) {
|
|
16022
|
-
const node =
|
|
16023
|
-
node.kind =
|
|
16136
|
+
const node = ts12.factory.createTemplateHead(cooked, raw);
|
|
16137
|
+
node.kind = ts12.SyntaxKind.TemplateTail;
|
|
16024
16138
|
return node;
|
|
16025
16139
|
}
|
|
16026
16140
|
function attachComments(statement, leadingComments) {
|
|
16027
16141
|
for (const comment of leadingComments) {
|
|
16028
|
-
const commentKind = comment.multiline ?
|
|
16142
|
+
const commentKind = comment.multiline ? ts12.SyntaxKind.MultiLineCommentTrivia : ts12.SyntaxKind.SingleLineCommentTrivia;
|
|
16029
16143
|
if (comment.multiline) {
|
|
16030
|
-
|
|
16144
|
+
ts12.addSyntheticLeadingComment(statement, commentKind, comment.toString(), comment.trailingNewline);
|
|
16031
16145
|
} else {
|
|
16032
16146
|
for (const line of comment.toString().split(`
|
|
16033
16147
|
`)) {
|
|
16034
|
-
|
|
16148
|
+
ts12.addSyntheticLeadingComment(statement, commentKind, line, comment.trailingNewline);
|
|
16035
16149
|
}
|
|
16036
16150
|
}
|
|
16037
16151
|
}
|
|
16038
16152
|
}
|
|
16039
16153
|
function getEntityTypeFromExpression(expression) {
|
|
16040
|
-
if (
|
|
16154
|
+
if (ts12.isIdentifier(expression)) {
|
|
16041
16155
|
return expression;
|
|
16042
16156
|
}
|
|
16043
|
-
if (
|
|
16157
|
+
if (ts12.isPropertyAccessExpression(expression)) {
|
|
16044
16158
|
const left = getEntityTypeFromExpression(expression.expression);
|
|
16045
|
-
if (!
|
|
16159
|
+
if (!ts12.isIdentifier(expression.name)) {
|
|
16046
16160
|
throw new Error(`Unsupported property access for type reference: ${expression.name.text}`);
|
|
16047
16161
|
}
|
|
16048
|
-
return
|
|
16162
|
+
return ts12.factory.createQualifiedName(left, expression.name);
|
|
16049
16163
|
}
|
|
16050
|
-
throw new Error(`Unsupported expression for type reference: ${
|
|
16164
|
+
throw new Error(`Unsupported expression for type reference: ${ts12.SyntaxKind[expression.kind]}`);
|
|
16051
16165
|
}
|
|
16052
16166
|
var init_typescript_ast_factory = __esm(() => {
|
|
16053
16167
|
init_ts_util();
|
|
@@ -16080,9 +16194,9 @@ __export(exports_fastHmrCompiler, {
|
|
|
16080
16194
|
primeComponentFingerprint: () => primeComponentFingerprint,
|
|
16081
16195
|
invalidateFingerprintCache: () => invalidateFingerprintCache
|
|
16082
16196
|
});
|
|
16083
|
-
import { existsSync as
|
|
16084
|
-
import { dirname as
|
|
16085
|
-
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";
|
|
16086
16200
|
var fail = (reason, detail, location) => ({
|
|
16087
16201
|
ok: false,
|
|
16088
16202
|
reason,
|
|
@@ -16166,23 +16280,23 @@ var fail = (reason, detail, location) => ({
|
|
|
16166
16280
|
}
|
|
16167
16281
|
let sourceFile;
|
|
16168
16282
|
try {
|
|
16169
|
-
sourceFile =
|
|
16283
|
+
sourceFile = ts13.createSourceFile(componentFilePath, source, ts13.ScriptTarget.Latest, true, ts13.ScriptKind.TS);
|
|
16170
16284
|
} catch {
|
|
16171
16285
|
return;
|
|
16172
16286
|
}
|
|
16173
16287
|
for (const stmt of sourceFile.statements) {
|
|
16174
|
-
if (!
|
|
16288
|
+
if (!ts13.isClassDeclaration(stmt))
|
|
16175
16289
|
continue;
|
|
16176
16290
|
const className = stmt.name?.text;
|
|
16177
16291
|
if (!className)
|
|
16178
16292
|
continue;
|
|
16179
|
-
const decorators =
|
|
16293
|
+
const decorators = ts13.getDecorators(stmt) ?? [];
|
|
16180
16294
|
const decoratorName = (() => {
|
|
16181
16295
|
for (const d2 of decorators) {
|
|
16182
|
-
if (!
|
|
16296
|
+
if (!ts13.isCallExpression(d2.expression))
|
|
16183
16297
|
continue;
|
|
16184
16298
|
const expr = d2.expression.expression;
|
|
16185
|
-
if (!
|
|
16299
|
+
if (!ts13.isIdentifier(expr))
|
|
16186
16300
|
continue;
|
|
16187
16301
|
if (expr.text === "Component" || expr.text === "Directive" || expr.text === "Pipe" || expr.text === "Injectable") {
|
|
16188
16302
|
return expr.text;
|
|
@@ -16196,20 +16310,20 @@ var fail = (reason, detail, location) => ({
|
|
|
16196
16310
|
const id = encodeURIComponent(`${projectRel}@${className}`);
|
|
16197
16311
|
if (decoratorName === "Component") {
|
|
16198
16312
|
const componentDecorator = decorators.find((d2) => {
|
|
16199
|
-
if (!
|
|
16313
|
+
if (!ts13.isCallExpression(d2.expression))
|
|
16200
16314
|
return false;
|
|
16201
16315
|
const expr = d2.expression.expression;
|
|
16202
|
-
return
|
|
16316
|
+
return ts13.isIdentifier(expr) && expr.text === "Component";
|
|
16203
16317
|
});
|
|
16204
16318
|
if (!componentDecorator)
|
|
16205
16319
|
continue;
|
|
16206
16320
|
const decoratorCall = componentDecorator.expression;
|
|
16207
16321
|
const args = decoratorCall.arguments[0];
|
|
16208
|
-
if (!args || !
|
|
16322
|
+
if (!args || !ts13.isObjectLiteralExpression(args))
|
|
16209
16323
|
continue;
|
|
16210
16324
|
const decoratorMeta = readDecoratorMeta(args);
|
|
16211
16325
|
const { inputs, outputs } = extractInputsAndOutputs(stmt, null);
|
|
16212
|
-
const componentDir =
|
|
16326
|
+
const componentDir = dirname19(componentFilePath);
|
|
16213
16327
|
const fingerprint = extractFingerprint(stmt, className, decoratorMeta, inputs, outputs, sourceFile, componentDir);
|
|
16214
16328
|
fingerprintCache.set(id, fingerprint);
|
|
16215
16329
|
} else {
|
|
@@ -16239,11 +16353,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16239
16353
|
return false;
|
|
16240
16354
|
return true;
|
|
16241
16355
|
}, ENTITY_DECORATOR_NAMES, findEntityDecorator = (cls) => {
|
|
16242
|
-
for (const dec of
|
|
16356
|
+
for (const dec of ts13.getDecorators(cls) ?? []) {
|
|
16243
16357
|
const expr = dec.expression;
|
|
16244
|
-
if (!
|
|
16358
|
+
if (!ts13.isCallExpression(expr))
|
|
16245
16359
|
continue;
|
|
16246
|
-
if (!
|
|
16360
|
+
if (!ts13.isIdentifier(expr.expression))
|
|
16247
16361
|
continue;
|
|
16248
16362
|
if (ENTITY_DECORATOR_NAMES.has(expr.expression.text))
|
|
16249
16363
|
return dec;
|
|
@@ -16261,18 +16375,18 @@ var fail = (reason, detail, location) => ({
|
|
|
16261
16375
|
}
|
|
16262
16376
|
const ctorParamTypes = [];
|
|
16263
16377
|
for (const member of cls.members) {
|
|
16264
|
-
if (!
|
|
16378
|
+
if (!ts13.isConstructorDeclaration(member))
|
|
16265
16379
|
continue;
|
|
16266
16380
|
for (const param of member.parameters) {
|
|
16267
16381
|
const typeText = param.type ? param.type.getText() : "";
|
|
16268
|
-
const decorators =
|
|
16382
|
+
const decorators = ts13.getDecorators(param) ?? [];
|
|
16269
16383
|
const decoratorSig = decorators.length === 0 ? "" : decorators.map((d2) => {
|
|
16270
16384
|
const e = d2.expression;
|
|
16271
|
-
if (
|
|
16385
|
+
if (ts13.isCallExpression(e) && ts13.isIdentifier(e.expression)) {
|
|
16272
16386
|
const args = e.arguments.map((a) => a.getText()).join(",");
|
|
16273
16387
|
return `@${e.expression.text}(${args})`;
|
|
16274
16388
|
}
|
|
16275
|
-
if (
|
|
16389
|
+
if (ts13.isIdentifier(e))
|
|
16276
16390
|
return `@${e.text}`;
|
|
16277
16391
|
return "@<unknown>";
|
|
16278
16392
|
}).join("");
|
|
@@ -16294,23 +16408,23 @@ var fail = (reason, detail, location) => ({
|
|
|
16294
16408
|
const walk = (node) => {
|
|
16295
16409
|
if (found)
|
|
16296
16410
|
return;
|
|
16297
|
-
if (
|
|
16411
|
+
if (ts13.isClassDeclaration(node) && node.name?.text === className) {
|
|
16298
16412
|
found = node;
|
|
16299
16413
|
return;
|
|
16300
16414
|
}
|
|
16301
|
-
|
|
16415
|
+
ts13.forEachChild(node, walk);
|
|
16302
16416
|
};
|
|
16303
16417
|
walk(sourceFile);
|
|
16304
16418
|
return found;
|
|
16305
16419
|
}, getClassDecorators = (cls) => {
|
|
16306
|
-
const modifiers =
|
|
16420
|
+
const modifiers = ts13.getDecorators(cls) ?? [];
|
|
16307
16421
|
return [...modifiers];
|
|
16308
16422
|
}, findComponentDecorator = (cls) => {
|
|
16309
16423
|
for (const decorator of getClassDecorators(cls)) {
|
|
16310
16424
|
const expr = decorator.expression;
|
|
16311
|
-
if (
|
|
16425
|
+
if (ts13.isCallExpression(expr)) {
|
|
16312
16426
|
const fn2 = expr.expression;
|
|
16313
|
-
if (
|
|
16427
|
+
if (ts13.isIdentifier(fn2) && fn2.text === "Component") {
|
|
16314
16428
|
return decorator;
|
|
16315
16429
|
}
|
|
16316
16430
|
}
|
|
@@ -16318,15 +16432,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16318
16432
|
return null;
|
|
16319
16433
|
}, getDecoratorArgsObject = (decorator) => {
|
|
16320
16434
|
const call = decorator.expression;
|
|
16321
|
-
if (!
|
|
16435
|
+
if (!ts13.isCallExpression(call))
|
|
16322
16436
|
return null;
|
|
16323
16437
|
const arg = call.arguments[0];
|
|
16324
|
-
if (!arg || !
|
|
16438
|
+
if (!arg || !ts13.isObjectLiteralExpression(arg))
|
|
16325
16439
|
return null;
|
|
16326
16440
|
return arg;
|
|
16327
16441
|
}, getProperty = (obj, name) => {
|
|
16328
16442
|
for (const prop of obj.properties) {
|
|
16329
|
-
if (
|
|
16443
|
+
if (ts13.isPropertyAssignment(prop) && (ts13.isIdentifier(prop.name) && prop.name.text === name || ts13.isStringLiteral(prop.name) && prop.name.text === name)) {
|
|
16330
16444
|
return prop.initializer;
|
|
16331
16445
|
}
|
|
16332
16446
|
}
|
|
@@ -16335,7 +16449,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16335
16449
|
const expr = getProperty(obj, name);
|
|
16336
16450
|
if (!expr)
|
|
16337
16451
|
return null;
|
|
16338
|
-
if (
|
|
16452
|
+
if (ts13.isStringLiteral(expr) || ts13.isNoSubstitutionTemplateLiteral(expr)) {
|
|
16339
16453
|
return expr.text;
|
|
16340
16454
|
}
|
|
16341
16455
|
return null;
|
|
@@ -16343,22 +16457,22 @@ var fail = (reason, detail, location) => ({
|
|
|
16343
16457
|
const expr = getProperty(obj, name);
|
|
16344
16458
|
if (!expr)
|
|
16345
16459
|
return null;
|
|
16346
|
-
if (expr.kind ===
|
|
16460
|
+
if (expr.kind === ts13.SyntaxKind.TrueKeyword)
|
|
16347
16461
|
return true;
|
|
16348
|
-
if (expr.kind ===
|
|
16462
|
+
if (expr.kind === ts13.SyntaxKind.FalseKeyword)
|
|
16349
16463
|
return false;
|
|
16350
16464
|
return null;
|
|
16351
16465
|
}, isAngularDecoratorIdentifier = (name) => name === "Component" || name === "Directive" || name === "Pipe" || name === "Injectable", classHasAngularDecorator = (cls) => {
|
|
16352
|
-
for (const dec of
|
|
16466
|
+
for (const dec of ts13.getDecorators(cls) ?? []) {
|
|
16353
16467
|
const expr = dec.expression;
|
|
16354
|
-
if (
|
|
16468
|
+
if (ts13.isCallExpression(expr) && ts13.isIdentifier(expr.expression) && isAngularDecoratorIdentifier(expr.expression.text)) {
|
|
16355
16469
|
return true;
|
|
16356
16470
|
}
|
|
16357
16471
|
}
|
|
16358
16472
|
return false;
|
|
16359
16473
|
}, findClassInSourceFile = (sf, className) => {
|
|
16360
16474
|
for (const stmt of sf.statements) {
|
|
16361
|
-
if (
|
|
16475
|
+
if (ts13.isClassDeclaration(stmt) && stmt.name?.text === className) {
|
|
16362
16476
|
return stmt;
|
|
16363
16477
|
}
|
|
16364
16478
|
}
|
|
@@ -16368,15 +16482,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16368
16482
|
if (sameFile)
|
|
16369
16483
|
return classHasAngularDecorator(sameFile);
|
|
16370
16484
|
for (const stmt of sourceFile.statements) {
|
|
16371
|
-
if (!
|
|
16485
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
16372
16486
|
continue;
|
|
16373
|
-
if (!
|
|
16487
|
+
if (!ts13.isStringLiteral(stmt.moduleSpecifier))
|
|
16374
16488
|
continue;
|
|
16375
16489
|
const clause = stmt.importClause;
|
|
16376
16490
|
if (!clause || clause.isTypeOnly)
|
|
16377
16491
|
continue;
|
|
16378
16492
|
const named = clause.namedBindings;
|
|
16379
|
-
if (!named || !
|
|
16493
|
+
if (!named || !ts13.isNamedImports(named))
|
|
16380
16494
|
continue;
|
|
16381
16495
|
const found = named.elements.find((el) => el.name.text === parentClassName);
|
|
16382
16496
|
if (!found)
|
|
@@ -16393,15 +16507,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16393
16507
|
`${base}/index.tsx`
|
|
16394
16508
|
];
|
|
16395
16509
|
for (const candidate of candidates) {
|
|
16396
|
-
if (!
|
|
16510
|
+
if (!existsSync24(candidate))
|
|
16397
16511
|
continue;
|
|
16398
16512
|
let content;
|
|
16399
16513
|
try {
|
|
16400
|
-
content =
|
|
16514
|
+
content = readFileSync19(candidate, "utf-8");
|
|
16401
16515
|
} catch {
|
|
16402
16516
|
continue;
|
|
16403
16517
|
}
|
|
16404
|
-
const parentSf =
|
|
16518
|
+
const parentSf = ts13.createSourceFile(candidate, content, ts13.ScriptTarget.Latest, true);
|
|
16405
16519
|
const parentCls = findClassInSourceFile(parentSf, parentClassName);
|
|
16406
16520
|
if (!parentCls)
|
|
16407
16521
|
continue;
|
|
@@ -16413,11 +16527,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16413
16527
|
}, inheritsDecoratedClass = (cls, sourceFile, componentDir, projectRoot) => {
|
|
16414
16528
|
const heritage = cls.heritageClauses ?? [];
|
|
16415
16529
|
for (const clause of heritage) {
|
|
16416
|
-
if (clause.token !==
|
|
16530
|
+
if (clause.token !== ts13.SyntaxKind.ExtendsKeyword)
|
|
16417
16531
|
continue;
|
|
16418
16532
|
for (const typeNode of clause.types) {
|
|
16419
16533
|
const expr = typeNode.expression;
|
|
16420
|
-
if (!
|
|
16534
|
+
if (!ts13.isIdentifier(expr)) {
|
|
16421
16535
|
return true;
|
|
16422
16536
|
}
|
|
16423
16537
|
if (parentHasAngularDecoratorAcrossFiles(expr.text, sourceFile, componentDir, projectRoot)) {
|
|
@@ -16428,18 +16542,18 @@ var fail = (reason, detail, location) => ({
|
|
|
16428
16542
|
return false;
|
|
16429
16543
|
}, CONTROL_CREATE_METHOD_NAME = "\u0275ngControlCreate", extractControlCreate = (cls) => {
|
|
16430
16544
|
for (const member of cls.members) {
|
|
16431
|
-
if (!
|
|
16545
|
+
if (!ts13.isMethodDeclaration(member))
|
|
16432
16546
|
continue;
|
|
16433
|
-
if (member.modifiers?.some((m) => m.kind ===
|
|
16547
|
+
if (member.modifiers?.some((m) => m.kind === ts13.SyntaxKind.StaticKeyword))
|
|
16434
16548
|
continue;
|
|
16435
16549
|
const name = member.name;
|
|
16436
16550
|
if (name === undefined)
|
|
16437
16551
|
continue;
|
|
16438
|
-
const nameText =
|
|
16552
|
+
const nameText = ts13.isIdentifier(name) ? name.text : name.getText();
|
|
16439
16553
|
if (nameText !== CONTROL_CREATE_METHOD_NAME)
|
|
16440
16554
|
continue;
|
|
16441
16555
|
const firstParam = member.parameters[0];
|
|
16442
|
-
if (firstParam === undefined || firstParam.type === undefined || !
|
|
16556
|
+
if (firstParam === undefined || firstParam.type === undefined || !ts13.isTypeReferenceNode(firstParam.type)) {
|
|
16443
16557
|
return { passThroughInput: null };
|
|
16444
16558
|
}
|
|
16445
16559
|
const typeArgs = firstParam.type.typeArguments;
|
|
@@ -16447,16 +16561,16 @@ var fail = (reason, detail, location) => ({
|
|
|
16447
16561
|
return { passThroughInput: null };
|
|
16448
16562
|
}
|
|
16449
16563
|
const arg = typeArgs[0];
|
|
16450
|
-
if (arg === undefined || !
|
|
16564
|
+
if (arg === undefined || !ts13.isLiteralTypeNode(arg) || !ts13.isStringLiteral(arg.literal)) {
|
|
16451
16565
|
return { passThroughInput: null };
|
|
16452
16566
|
}
|
|
16453
16567
|
return { passThroughInput: arg.literal.text };
|
|
16454
16568
|
}
|
|
16455
16569
|
return null;
|
|
16456
16570
|
}, resolveEnumPropertyAccess = (expr, enumName, values) => {
|
|
16457
|
-
if (!
|
|
16571
|
+
if (!ts13.isPropertyAccessExpression(expr))
|
|
16458
16572
|
return null;
|
|
16459
|
-
if (!
|
|
16573
|
+
if (!ts13.isIdentifier(expr.expression))
|
|
16460
16574
|
return null;
|
|
16461
16575
|
if (expr.expression.text !== enumName)
|
|
16462
16576
|
return null;
|
|
@@ -16475,21 +16589,21 @@ var fail = (reason, detail, location) => ({
|
|
|
16475
16589
|
const hostExpr = getProperty(args, "host");
|
|
16476
16590
|
const schemasExpr = getProperty(args, "schemas");
|
|
16477
16591
|
const styleUrls = [];
|
|
16478
|
-
if (styleUrlsExpr &&
|
|
16592
|
+
if (styleUrlsExpr && ts13.isArrayLiteralExpression(styleUrlsExpr)) {
|
|
16479
16593
|
for (const el of styleUrlsExpr.elements) {
|
|
16480
|
-
if (
|
|
16594
|
+
if (ts13.isStringLiteral(el))
|
|
16481
16595
|
styleUrls.push(el.text);
|
|
16482
16596
|
}
|
|
16483
16597
|
}
|
|
16484
16598
|
const styles = [];
|
|
16485
16599
|
if (stylesExpr) {
|
|
16486
|
-
if (
|
|
16600
|
+
if (ts13.isArrayLiteralExpression(stylesExpr)) {
|
|
16487
16601
|
for (const el of stylesExpr.elements) {
|
|
16488
|
-
if (
|
|
16602
|
+
if (ts13.isStringLiteral(el) || ts13.isNoSubstitutionTemplateLiteral(el)) {
|
|
16489
16603
|
styles.push(el.text);
|
|
16490
16604
|
}
|
|
16491
16605
|
}
|
|
16492
|
-
} else if (
|
|
16606
|
+
} else if (ts13.isStringLiteral(stylesExpr) || ts13.isNoSubstitutionTemplateLiteral(stylesExpr)) {
|
|
16493
16607
|
styles.push(stylesExpr.text);
|
|
16494
16608
|
}
|
|
16495
16609
|
}
|
|
@@ -16502,15 +16616,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16502
16616
|
encapsulation,
|
|
16503
16617
|
hasProviders: getProperty(args, "providers") !== null,
|
|
16504
16618
|
hasViewProviders: getProperty(args, "viewProviders") !== null,
|
|
16505
|
-
importsExpr: importsExpr &&
|
|
16506
|
-
hostDirectivesExpr: hostDirectivesExpr &&
|
|
16507
|
-
animationsExpr: animationsExpr &&
|
|
16508
|
-
providersExpr: providersExpr &&
|
|
16509
|
-
viewProvidersExpr: viewProvidersExpr &&
|
|
16510
|
-
inputsArrayExpr: inputsArrayExpr &&
|
|
16511
|
-
outputsArrayExpr: outputsArrayExpr &&
|
|
16512
|
-
hostExpr: hostExpr &&
|
|
16513
|
-
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,
|
|
16514
16628
|
preserveWhitespaces: getBooleanProperty(args, "preserveWhitespaces") ?? projectDefaults.preserveWhitespaces ?? false,
|
|
16515
16629
|
selector: getStringProperty(args, "selector"),
|
|
16516
16630
|
standalone: getBooleanProperty(args, "standalone") ?? true,
|
|
@@ -16521,13 +16635,13 @@ var fail = (reason, detail, location) => ({
|
|
|
16521
16635
|
templateUrl: getStringProperty(args, "templateUrl")
|
|
16522
16636
|
};
|
|
16523
16637
|
}, extractDecoratorInput = (prop, compiler) => {
|
|
16524
|
-
const decorators =
|
|
16638
|
+
const decorators = ts13.getDecorators(prop) ?? [];
|
|
16525
16639
|
for (const decorator of decorators) {
|
|
16526
16640
|
const expr = decorator.expression;
|
|
16527
|
-
if (!
|
|
16641
|
+
if (!ts13.isCallExpression(expr))
|
|
16528
16642
|
continue;
|
|
16529
16643
|
const fn2 = expr.expression;
|
|
16530
|
-
if (!
|
|
16644
|
+
if (!ts13.isIdentifier(fn2) || fn2.text !== "Input")
|
|
16531
16645
|
continue;
|
|
16532
16646
|
const classPropertyName = prop.name.getText();
|
|
16533
16647
|
let bindingPropertyName = classPropertyName;
|
|
@@ -16535,9 +16649,9 @@ var fail = (reason, detail, location) => ({
|
|
|
16535
16649
|
let transformFunction = null;
|
|
16536
16650
|
const arg = expr.arguments[0];
|
|
16537
16651
|
if (arg) {
|
|
16538
|
-
if (
|
|
16652
|
+
if (ts13.isStringLiteral(arg)) {
|
|
16539
16653
|
bindingPropertyName = arg.text;
|
|
16540
|
-
} else if (
|
|
16654
|
+
} else if (ts13.isObjectLiteralExpression(arg)) {
|
|
16541
16655
|
const aliasNode = getStringProperty(arg, "alias");
|
|
16542
16656
|
if (aliasNode !== null)
|
|
16543
16657
|
bindingPropertyName = aliasNode;
|
|
@@ -16561,11 +16675,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16561
16675
|
}
|
|
16562
16676
|
return null;
|
|
16563
16677
|
}, isInputSignalCall = (init) => {
|
|
16564
|
-
if (
|
|
16678
|
+
if (ts13.isCallExpression(init)) {
|
|
16565
16679
|
const fn2 = init.expression;
|
|
16566
|
-
if (
|
|
16680
|
+
if (ts13.isIdentifier(fn2) && fn2.text === "input")
|
|
16567
16681
|
return true;
|
|
16568
|
-
if (
|
|
16682
|
+
if (ts13.isPropertyAccessExpression(fn2) && ts13.isIdentifier(fn2.expression) && fn2.expression.text === "input") {
|
|
16569
16683
|
return true;
|
|
16570
16684
|
}
|
|
16571
16685
|
}
|
|
@@ -16576,13 +16690,13 @@ var fail = (reason, detail, location) => ({
|
|
|
16576
16690
|
const classPropertyName = prop.name.getText();
|
|
16577
16691
|
const call = prop.initializer;
|
|
16578
16692
|
let required = false;
|
|
16579
|
-
if (
|
|
16693
|
+
if (ts13.isPropertyAccessExpression(call.expression) && ts13.isIdentifier(call.expression.name) && call.expression.name.text === "required") {
|
|
16580
16694
|
required = true;
|
|
16581
16695
|
}
|
|
16582
16696
|
let bindingPropertyName = classPropertyName;
|
|
16583
16697
|
let transformFunction = null;
|
|
16584
16698
|
const optsArg = call.arguments[required ? 0 : 1];
|
|
16585
|
-
if (optsArg &&
|
|
16699
|
+
if (optsArg && ts13.isObjectLiteralExpression(optsArg)) {
|
|
16586
16700
|
const aliasNode = getStringProperty(optsArg, "alias");
|
|
16587
16701
|
if (aliasNode !== null)
|
|
16588
16702
|
bindingPropertyName = aliasNode;
|
|
@@ -16602,28 +16716,28 @@ var fail = (reason, detail, location) => ({
|
|
|
16602
16716
|
}
|
|
16603
16717
|
};
|
|
16604
16718
|
}, extractDecoratorOutput = (prop) => {
|
|
16605
|
-
const decorators =
|
|
16719
|
+
const decorators = ts13.getDecorators(prop) ?? [];
|
|
16606
16720
|
for (const decorator of decorators) {
|
|
16607
16721
|
const expr = decorator.expression;
|
|
16608
|
-
if (!
|
|
16722
|
+
if (!ts13.isCallExpression(expr))
|
|
16609
16723
|
continue;
|
|
16610
16724
|
const fn2 = expr.expression;
|
|
16611
|
-
if (!
|
|
16725
|
+
if (!ts13.isIdentifier(fn2) || fn2.text !== "Output")
|
|
16612
16726
|
continue;
|
|
16613
16727
|
const classPropertyName = prop.name.getText();
|
|
16614
16728
|
let bindingName = classPropertyName;
|
|
16615
16729
|
const arg = expr.arguments[0];
|
|
16616
|
-
if (arg &&
|
|
16730
|
+
if (arg && ts13.isStringLiteral(arg))
|
|
16617
16731
|
bindingName = arg.text;
|
|
16618
16732
|
return { classPropertyName, bindingName };
|
|
16619
16733
|
}
|
|
16620
16734
|
return null;
|
|
16621
16735
|
}, isOutputSignalCall = (init) => {
|
|
16622
|
-
if (
|
|
16736
|
+
if (ts13.isCallExpression(init)) {
|
|
16623
16737
|
const fn2 = init.expression;
|
|
16624
|
-
if (
|
|
16738
|
+
if (ts13.isIdentifier(fn2) && fn2.text === "output")
|
|
16625
16739
|
return true;
|
|
16626
|
-
if (
|
|
16740
|
+
if (ts13.isPropertyAccessExpression(fn2) && ts13.isIdentifier(fn2.expression) && fn2.expression.text === "output") {
|
|
16627
16741
|
return true;
|
|
16628
16742
|
}
|
|
16629
16743
|
}
|
|
@@ -16635,7 +16749,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16635
16749
|
const call = prop.initializer;
|
|
16636
16750
|
let bindingName = classPropertyName;
|
|
16637
16751
|
const optsArg = call.arguments[0];
|
|
16638
|
-
if (optsArg &&
|
|
16752
|
+
if (optsArg && ts13.isObjectLiteralExpression(optsArg)) {
|
|
16639
16753
|
const aliasNode = getStringProperty(optsArg, "alias");
|
|
16640
16754
|
if (aliasNode !== null)
|
|
16641
16755
|
bindingName = aliasNode;
|
|
@@ -16647,7 +16761,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16647
16761
|
let hasDecoratorIO = false;
|
|
16648
16762
|
let hasSignalIO = false;
|
|
16649
16763
|
for (const member of cls.members) {
|
|
16650
|
-
if (!
|
|
16764
|
+
if (!ts13.isPropertyDeclaration(member))
|
|
16651
16765
|
continue;
|
|
16652
16766
|
const decoratorIn = extractDecoratorInput(member, compiler);
|
|
16653
16767
|
if (decoratorIn) {
|
|
@@ -16681,21 +16795,21 @@ var fail = (reason, detail, location) => ({
|
|
|
16681
16795
|
specialAttributes: {}
|
|
16682
16796
|
}), parseHostObjectInto = (host, args, hostExprNode, compiler) => {
|
|
16683
16797
|
const hostNode = getProperty(args, "host");
|
|
16684
|
-
if (!hostNode || !
|
|
16798
|
+
if (!hostNode || !ts13.isObjectLiteralExpression(hostNode)) {
|
|
16685
16799
|
if (!hostExprNode)
|
|
16686
16800
|
return;
|
|
16687
16801
|
}
|
|
16688
|
-
const obj = hostNode &&
|
|
16802
|
+
const obj = hostNode && ts13.isObjectLiteralExpression(hostNode) ? hostNode : hostExprNode;
|
|
16689
16803
|
if (!obj)
|
|
16690
16804
|
return;
|
|
16691
16805
|
for (const prop of obj.properties) {
|
|
16692
|
-
if (!
|
|
16806
|
+
if (!ts13.isPropertyAssignment(prop))
|
|
16693
16807
|
continue;
|
|
16694
16808
|
const keyNode = prop.name;
|
|
16695
16809
|
let key;
|
|
16696
|
-
if (
|
|
16810
|
+
if (ts13.isStringLiteral(keyNode) || ts13.isNoSubstitutionTemplateLiteral(keyNode)) {
|
|
16697
16811
|
key = keyNode.text;
|
|
16698
|
-
} else if (
|
|
16812
|
+
} else if (ts13.isIdentifier(keyNode)) {
|
|
16699
16813
|
key = keyNode.text;
|
|
16700
16814
|
} else {
|
|
16701
16815
|
continue;
|
|
@@ -16712,36 +16826,36 @@ var fail = (reason, detail, location) => ({
|
|
|
16712
16826
|
}
|
|
16713
16827
|
}, mergeMemberHostDecorators = (host, cls) => {
|
|
16714
16828
|
for (const member of cls.members) {
|
|
16715
|
-
if (!
|
|
16829
|
+
if (!ts13.canHaveDecorators(member))
|
|
16716
16830
|
continue;
|
|
16717
|
-
const decorators =
|
|
16831
|
+
const decorators = ts13.getDecorators(member) ?? [];
|
|
16718
16832
|
for (const dec of decorators) {
|
|
16719
16833
|
const expr = dec.expression;
|
|
16720
|
-
if (!
|
|
16834
|
+
if (!ts13.isCallExpression(expr))
|
|
16721
16835
|
continue;
|
|
16722
16836
|
const fn2 = expr.expression;
|
|
16723
|
-
if (!
|
|
16837
|
+
if (!ts13.isIdentifier(fn2))
|
|
16724
16838
|
continue;
|
|
16725
16839
|
if (fn2.text === "HostBinding") {
|
|
16726
|
-
if (!
|
|
16840
|
+
if (!ts13.isPropertyDeclaration(member) && !ts13.isGetAccessor(member))
|
|
16727
16841
|
continue;
|
|
16728
16842
|
const propertyName = member.name.text;
|
|
16729
16843
|
const target = expr.arguments[0];
|
|
16730
|
-
const key = target &&
|
|
16844
|
+
const key = target && ts13.isStringLiteral(target) ? target.text : propertyName;
|
|
16731
16845
|
host.properties[key] = propertyName;
|
|
16732
16846
|
} else if (fn2.text === "HostListener") {
|
|
16733
|
-
if (!
|
|
16847
|
+
if (!ts13.isMethodDeclaration(member))
|
|
16734
16848
|
continue;
|
|
16735
16849
|
const methodName = member.name.text;
|
|
16736
16850
|
const eventArg = expr.arguments[0];
|
|
16737
|
-
if (!eventArg || !
|
|
16851
|
+
if (!eventArg || !ts13.isStringLiteral(eventArg))
|
|
16738
16852
|
continue;
|
|
16739
16853
|
const event = eventArg.text;
|
|
16740
16854
|
const argsArg = expr.arguments[1];
|
|
16741
16855
|
let argsList = [];
|
|
16742
|
-
if (argsArg &&
|
|
16856
|
+
if (argsArg && ts13.isArrayLiteralExpression(argsArg)) {
|
|
16743
16857
|
for (const el of argsArg.elements) {
|
|
16744
|
-
if (
|
|
16858
|
+
if (ts13.isStringLiteral(el))
|
|
16745
16859
|
argsList.push(el.text);
|
|
16746
16860
|
}
|
|
16747
16861
|
}
|
|
@@ -16754,14 +16868,14 @@ var fail = (reason, detail, location) => ({
|
|
|
16754
16868
|
let descendants = true;
|
|
16755
16869
|
let emitDistinctChangesOnly = true;
|
|
16756
16870
|
const opts = args[1];
|
|
16757
|
-
if (opts &&
|
|
16871
|
+
if (opts && ts13.isObjectLiteralExpression(opts)) {
|
|
16758
16872
|
static_ = getBooleanProperty(opts, "static") ?? false;
|
|
16759
16873
|
descendants = getBooleanProperty(opts, "descendants") ?? true;
|
|
16760
16874
|
emitDistinctChangesOnly = getBooleanProperty(opts, "emitDistinctChangesOnly") ?? true;
|
|
16761
16875
|
}
|
|
16762
16876
|
return { static_, descendants, emitDistinctChangesOnly };
|
|
16763
16877
|
}, queryPredicateFromArg = (arg, compiler) => {
|
|
16764
|
-
if (
|
|
16878
|
+
if (ts13.isStringLiteral(arg)) {
|
|
16765
16879
|
return arg.text.split(",").map((s2) => s2.trim()).filter(Boolean);
|
|
16766
16880
|
}
|
|
16767
16881
|
return {
|
|
@@ -16772,15 +16886,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16772
16886
|
const contentQueries = [];
|
|
16773
16887
|
const viewQueries = [];
|
|
16774
16888
|
for (const member of cls.members) {
|
|
16775
|
-
if (!
|
|
16889
|
+
if (!ts13.isPropertyDeclaration(member))
|
|
16776
16890
|
continue;
|
|
16777
|
-
const decorators =
|
|
16891
|
+
const decorators = ts13.getDecorators(member) ?? [];
|
|
16778
16892
|
for (const dec of decorators) {
|
|
16779
16893
|
const expr = dec.expression;
|
|
16780
|
-
if (!
|
|
16894
|
+
if (!ts13.isCallExpression(expr))
|
|
16781
16895
|
continue;
|
|
16782
16896
|
const fn2 = expr.expression;
|
|
16783
|
-
if (!
|
|
16897
|
+
if (!ts13.isIdentifier(fn2) || !QUERY_DECORATORS.has(fn2.text))
|
|
16784
16898
|
continue;
|
|
16785
16899
|
const propertyName = member.name.text;
|
|
16786
16900
|
const tokenArg = expr.arguments[0];
|
|
@@ -16792,7 +16906,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16792
16906
|
const { static_, descendants, emitDistinctChangesOnly } = parseQueryDecoratorOptions(expr.arguments);
|
|
16793
16907
|
const opts = expr.arguments[1];
|
|
16794
16908
|
let read = null;
|
|
16795
|
-
if (opts &&
|
|
16909
|
+
if (opts && ts13.isObjectLiteralExpression(opts)) {
|
|
16796
16910
|
const readNode = getProperty(opts, "read");
|
|
16797
16911
|
if (readNode) {
|
|
16798
16912
|
read = new compiler.WrappedNodeExpr(readNode);
|
|
@@ -16820,15 +16934,15 @@ var fail = (reason, detail, location) => ({
|
|
|
16820
16934
|
const contentQueries = [];
|
|
16821
16935
|
const viewQueries = [];
|
|
16822
16936
|
for (const member of cls.members) {
|
|
16823
|
-
if (!
|
|
16937
|
+
if (!ts13.isPropertyDeclaration(member) || !member.initializer)
|
|
16824
16938
|
continue;
|
|
16825
16939
|
let init = member.initializer;
|
|
16826
|
-
if (!
|
|
16940
|
+
if (!ts13.isCallExpression(init))
|
|
16827
16941
|
continue;
|
|
16828
16942
|
let queryName;
|
|
16829
|
-
if (
|
|
16943
|
+
if (ts13.isIdentifier(init.expression)) {
|
|
16830
16944
|
queryName = init.expression.text;
|
|
16831
|
-
} else if (
|
|
16945
|
+
} else if (ts13.isPropertyAccessExpression(init.expression) && ts13.isIdentifier(init.expression.expression) && init.expression.name.text === "required") {
|
|
16832
16946
|
queryName = init.expression.expression.text;
|
|
16833
16947
|
} else {
|
|
16834
16948
|
continue;
|
|
@@ -16846,7 +16960,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16846
16960
|
let descendants = true;
|
|
16847
16961
|
let read = null;
|
|
16848
16962
|
const opts = init.arguments[1];
|
|
16849
|
-
if (opts &&
|
|
16963
|
+
if (opts && ts13.isObjectLiteralExpression(opts)) {
|
|
16850
16964
|
descendants = getBooleanProperty(opts, "descendants") ?? true;
|
|
16851
16965
|
const readNode = getProperty(opts, "read");
|
|
16852
16966
|
if (readNode)
|
|
@@ -16872,13 +16986,13 @@ var fail = (reason, detail, location) => ({
|
|
|
16872
16986
|
const node = getProperty(args, "exportAs");
|
|
16873
16987
|
if (!node)
|
|
16874
16988
|
return null;
|
|
16875
|
-
if (
|
|
16989
|
+
if (ts13.isStringLiteral(node)) {
|
|
16876
16990
|
return node.text.split(",").map((s2) => s2.trim()).filter(Boolean);
|
|
16877
16991
|
}
|
|
16878
|
-
if (
|
|
16992
|
+
if (ts13.isArrayLiteralExpression(node)) {
|
|
16879
16993
|
const out = [];
|
|
16880
16994
|
for (const el of node.elements) {
|
|
16881
|
-
if (
|
|
16995
|
+
if (ts13.isStringLiteral(el))
|
|
16882
16996
|
out.push(el.text);
|
|
16883
16997
|
}
|
|
16884
16998
|
return out.length > 0 ? out : null;
|
|
@@ -16886,11 +17000,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16886
17000
|
return null;
|
|
16887
17001
|
}, extractHostDirectives = (args, compiler) => {
|
|
16888
17002
|
const node = getProperty(args, "hostDirectives");
|
|
16889
|
-
if (!node || !
|
|
17003
|
+
if (!node || !ts13.isArrayLiteralExpression(node))
|
|
16890
17004
|
return null;
|
|
16891
17005
|
const out = [];
|
|
16892
17006
|
for (const el of node.elements) {
|
|
16893
|
-
if (
|
|
17007
|
+
if (ts13.isIdentifier(el)) {
|
|
16894
17008
|
out.push({
|
|
16895
17009
|
directive: {
|
|
16896
17010
|
value: new compiler.WrappedNodeExpr(el),
|
|
@@ -16902,7 +17016,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16902
17016
|
});
|
|
16903
17017
|
continue;
|
|
16904
17018
|
}
|
|
16905
|
-
if (!
|
|
17019
|
+
if (!ts13.isObjectLiteralExpression(el))
|
|
16906
17020
|
continue;
|
|
16907
17021
|
const directiveNode = getProperty(el, "directive");
|
|
16908
17022
|
if (!directiveNode)
|
|
@@ -16910,11 +17024,11 @@ var fail = (reason, detail, location) => ({
|
|
|
16910
17024
|
const inputsNode = getProperty(el, "inputs");
|
|
16911
17025
|
const outputsNode = getProperty(el, "outputs");
|
|
16912
17026
|
const collectMap = (n) => {
|
|
16913
|
-
if (!n || !
|
|
17027
|
+
if (!n || !ts13.isArrayLiteralExpression(n))
|
|
16914
17028
|
return null;
|
|
16915
17029
|
const map = {};
|
|
16916
17030
|
for (const item of n.elements) {
|
|
16917
|
-
if (!
|
|
17031
|
+
if (!ts13.isStringLiteral(item))
|
|
16918
17032
|
continue;
|
|
16919
17033
|
const [name, alias] = item.text.split(":").map((s2) => s2.trim());
|
|
16920
17034
|
if (name)
|
|
@@ -16976,7 +17090,7 @@ var fail = (reason, detail, location) => ({
|
|
|
16976
17090
|
return cached.info;
|
|
16977
17091
|
let source;
|
|
16978
17092
|
try {
|
|
16979
|
-
source =
|
|
17093
|
+
source = readFileSync19(filePath, "utf-8");
|
|
16980
17094
|
} catch {
|
|
16981
17095
|
childComponentInfoCache.set(cacheKey2, {
|
|
16982
17096
|
info: null,
|
|
@@ -16984,10 +17098,10 @@ var fail = (reason, detail, location) => ({
|
|
|
16984
17098
|
});
|
|
16985
17099
|
return null;
|
|
16986
17100
|
}
|
|
16987
|
-
const sf =
|
|
17101
|
+
const sf = ts13.createSourceFile(filePath, source, ts13.ScriptTarget.Latest, true);
|
|
16988
17102
|
let info = null;
|
|
16989
17103
|
for (const stmt of sf.statements) {
|
|
16990
|
-
if (!
|
|
17104
|
+
if (!ts13.isClassDeclaration(stmt))
|
|
16991
17105
|
continue;
|
|
16992
17106
|
if (!stmt.name || stmt.name.text !== className)
|
|
16993
17107
|
continue;
|
|
@@ -17030,7 +17144,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17030
17144
|
return cached.info;
|
|
17031
17145
|
let content;
|
|
17032
17146
|
try {
|
|
17033
|
-
content =
|
|
17147
|
+
content = readFileSync19(dtsPath, "utf-8");
|
|
17034
17148
|
} catch {
|
|
17035
17149
|
childComponentInfoCache.set(cacheKey2, {
|
|
17036
17150
|
info: null,
|
|
@@ -17122,9 +17236,9 @@ var fail = (reason, detail, location) => ({
|
|
|
17122
17236
|
}, buildClassToSpecMap = (sourceFile) => {
|
|
17123
17237
|
const result = new Map;
|
|
17124
17238
|
for (const stmt of sourceFile.statements) {
|
|
17125
|
-
if (!
|
|
17239
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
17126
17240
|
continue;
|
|
17127
|
-
if (!
|
|
17241
|
+
if (!ts13.isStringLiteral(stmt.moduleSpecifier))
|
|
17128
17242
|
continue;
|
|
17129
17243
|
const spec = stmt.moduleSpecifier.text;
|
|
17130
17244
|
const clause = stmt.importClause;
|
|
@@ -17133,7 +17247,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17133
17247
|
if (clause.name)
|
|
17134
17248
|
result.set(clause.name.text, spec);
|
|
17135
17249
|
const named = clause.namedBindings;
|
|
17136
|
-
if (named &&
|
|
17250
|
+
if (named && ts13.isNamedImports(named)) {
|
|
17137
17251
|
for (const el of named.elements) {
|
|
17138
17252
|
if (el.isTypeOnly)
|
|
17139
17253
|
continue;
|
|
@@ -17146,11 +17260,11 @@ var fail = (reason, detail, location) => ({
|
|
|
17146
17260
|
if (visited.has(startDtsPath))
|
|
17147
17261
|
return null;
|
|
17148
17262
|
visited.add(startDtsPath);
|
|
17149
|
-
if (!
|
|
17263
|
+
if (!existsSync24(startDtsPath))
|
|
17150
17264
|
return null;
|
|
17151
17265
|
let content;
|
|
17152
17266
|
try {
|
|
17153
|
-
content =
|
|
17267
|
+
content = readFileSync19(startDtsPath, "utf-8");
|
|
17154
17268
|
} catch {
|
|
17155
17269
|
return null;
|
|
17156
17270
|
}
|
|
@@ -17169,7 +17283,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17169
17283
|
});
|
|
17170
17284
|
if (!names.includes(className))
|
|
17171
17285
|
continue;
|
|
17172
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
17286
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname19(startDtsPath));
|
|
17173
17287
|
if (!nextDts)
|
|
17174
17288
|
continue;
|
|
17175
17289
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -17179,7 +17293,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17179
17293
|
const starReExportRe = /export\s*\*\s*from\s*["']([^"']+)["']/g;
|
|
17180
17294
|
while ((m = starReExportRe.exec(content)) !== null) {
|
|
17181
17295
|
const fromPath = m[1] || "";
|
|
17182
|
-
const nextDts = resolveDtsFromSpec(fromPath,
|
|
17296
|
+
const nextDts = resolveDtsFromSpec(fromPath, dirname19(startDtsPath));
|
|
17183
17297
|
if (!nextDts)
|
|
17184
17298
|
continue;
|
|
17185
17299
|
const found = findDtsContainingClass(nextDts, className, visited);
|
|
@@ -17199,16 +17313,16 @@ var fail = (reason, detail, location) => ({
|
|
|
17199
17313
|
`${base}/index.d.cts`
|
|
17200
17314
|
];
|
|
17201
17315
|
for (const c of candidates) {
|
|
17202
|
-
if (
|
|
17316
|
+
if (existsSync24(c))
|
|
17203
17317
|
return c;
|
|
17204
17318
|
}
|
|
17205
17319
|
return null;
|
|
17206
17320
|
}, findPackageDtsForJs = (jsPath) => {
|
|
17207
17321
|
const sibling = jsPath.replace(/\.[mc]?js$/, ".d.ts");
|
|
17208
|
-
if (
|
|
17322
|
+
if (existsSync24(sibling))
|
|
17209
17323
|
return sibling;
|
|
17210
17324
|
const mirror = jsPath.replace(/\/dist\//, "/dist/src/").replace(/\.[mc]?js$/, ".d.ts");
|
|
17211
|
-
if (
|
|
17325
|
+
if (existsSync24(mirror))
|
|
17212
17326
|
return mirror;
|
|
17213
17327
|
return null;
|
|
17214
17328
|
}, resolveChildComponentInfo = (className, spec, componentDir, projectRoot) => {
|
|
@@ -17221,7 +17335,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17221
17335
|
`${base}/index.tsx`
|
|
17222
17336
|
];
|
|
17223
17337
|
for (const candidate of candidates) {
|
|
17224
|
-
if (!
|
|
17338
|
+
if (!existsSync24(candidate))
|
|
17225
17339
|
continue;
|
|
17226
17340
|
const info = getChildComponentInfoFromTsSource(candidate, className);
|
|
17227
17341
|
if (info)
|
|
@@ -17246,7 +17360,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17246
17360
|
return result;
|
|
17247
17361
|
const classToSpec = buildClassToSpecMap(sourceFile);
|
|
17248
17362
|
for (const el of importsExpr.elements) {
|
|
17249
|
-
if (!
|
|
17363
|
+
if (!ts13.isIdentifier(el))
|
|
17250
17364
|
continue;
|
|
17251
17365
|
const className = el.text;
|
|
17252
17366
|
const spec = classToSpec.get(className);
|
|
@@ -17265,35 +17379,35 @@ var fail = (reason, detail, location) => ({
|
|
|
17265
17379
|
}
|
|
17266
17380
|
return (h2 >>> 0).toString(36);
|
|
17267
17381
|
}, initializerShapeIsStructural = (node) => {
|
|
17268
|
-
if (
|
|
17382
|
+
if (ts13.isArrowFunction(node) || ts13.isFunctionExpression(node) || ts13.isCallExpression(node) || ts13.isNewExpression(node)) {
|
|
17269
17383
|
return true;
|
|
17270
17384
|
}
|
|
17271
|
-
if (
|
|
17385
|
+
if (ts13.isConditionalExpression(node)) {
|
|
17272
17386
|
return initializerShapeIsStructural(node.whenTrue) || initializerShapeIsStructural(node.whenFalse);
|
|
17273
17387
|
}
|
|
17274
|
-
if (
|
|
17388
|
+
if (ts13.isParenthesizedExpression(node)) {
|
|
17275
17389
|
return initializerShapeIsStructural(node.expression);
|
|
17276
17390
|
}
|
|
17277
|
-
if (
|
|
17391
|
+
if (ts13.isAsExpression(node) || ts13.isTypeAssertionExpression(node)) {
|
|
17278
17392
|
return initializerShapeIsStructural(node.expression);
|
|
17279
17393
|
}
|
|
17280
|
-
if (
|
|
17394
|
+
if (ts13.isNonNullExpression(node)) {
|
|
17281
17395
|
return initializerShapeIsStructural(node.expression);
|
|
17282
17396
|
}
|
|
17283
|
-
if (
|
|
17397
|
+
if (ts13.isObjectLiteralExpression(node)) {
|
|
17284
17398
|
for (const prop of node.properties) {
|
|
17285
|
-
if (
|
|
17399
|
+
if (ts13.isPropertyAssignment(prop) && initializerShapeIsStructural(prop.initializer)) {
|
|
17286
17400
|
return true;
|
|
17287
17401
|
}
|
|
17288
|
-
if (
|
|
17402
|
+
if (ts13.isShorthandPropertyAssignment(prop))
|
|
17289
17403
|
continue;
|
|
17290
|
-
if (
|
|
17404
|
+
if (ts13.isSpreadAssignment(prop) && initializerShapeIsStructural(prop.expression)) {
|
|
17291
17405
|
return true;
|
|
17292
17406
|
}
|
|
17293
17407
|
}
|
|
17294
17408
|
return false;
|
|
17295
17409
|
}
|
|
17296
|
-
if (
|
|
17410
|
+
if (ts13.isArrayLiteralExpression(node)) {
|
|
17297
17411
|
for (const el of node.elements) {
|
|
17298
17412
|
if (initializerShapeIsStructural(el))
|
|
17299
17413
|
return true;
|
|
@@ -17304,7 +17418,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17304
17418
|
}, extractArrowFieldSig = (cls) => {
|
|
17305
17419
|
const entries = [];
|
|
17306
17420
|
for (const member of cls.members) {
|
|
17307
|
-
if (!
|
|
17421
|
+
if (!ts13.isPropertyDeclaration(member))
|
|
17308
17422
|
continue;
|
|
17309
17423
|
const init = member.initializer;
|
|
17310
17424
|
if (!init)
|
|
@@ -17314,12 +17428,12 @@ var fail = (reason, detail, location) => ({
|
|
|
17314
17428
|
const name = member.name.getText();
|
|
17315
17429
|
let bodyText;
|
|
17316
17430
|
try {
|
|
17317
|
-
const printer =
|
|
17318
|
-
newLine:
|
|
17431
|
+
const printer = ts13.createPrinter({
|
|
17432
|
+
newLine: ts13.NewLineKind.LineFeed,
|
|
17319
17433
|
omitTrailingSemicolon: true,
|
|
17320
17434
|
removeComments: true
|
|
17321
17435
|
});
|
|
17322
|
-
bodyText = printer.printNode(
|
|
17436
|
+
bodyText = printer.printNode(ts13.EmitHint.Unspecified, init, cls.getSourceFile());
|
|
17323
17437
|
} catch {
|
|
17324
17438
|
bodyText = init.getText();
|
|
17325
17439
|
}
|
|
@@ -17330,9 +17444,9 @@ var fail = (reason, detail, location) => ({
|
|
|
17330
17444
|
}, INPUT_OUTPUT_DECORATORS, extractMemberDecoratorSig = (cls) => {
|
|
17331
17445
|
const entries = [];
|
|
17332
17446
|
for (const member of cls.members) {
|
|
17333
|
-
if (!
|
|
17447
|
+
if (!ts13.canHaveDecorators(member))
|
|
17334
17448
|
continue;
|
|
17335
|
-
const decorators =
|
|
17449
|
+
const decorators = ts13.getDecorators(member) ?? [];
|
|
17336
17450
|
if (decorators.length === 0)
|
|
17337
17451
|
continue;
|
|
17338
17452
|
const memberName = member.name?.getText() ?? "<anon>";
|
|
@@ -17340,14 +17454,14 @@ var fail = (reason, detail, location) => ({
|
|
|
17340
17454
|
const expr = decorator.expression;
|
|
17341
17455
|
let decName = "<unknown>";
|
|
17342
17456
|
let argText = "";
|
|
17343
|
-
if (
|
|
17344
|
-
if (
|
|
17457
|
+
if (ts13.isCallExpression(expr)) {
|
|
17458
|
+
if (ts13.isIdentifier(expr.expression)) {
|
|
17345
17459
|
decName = expr.expression.text;
|
|
17346
17460
|
}
|
|
17347
17461
|
if (expr.arguments.length > 0) {
|
|
17348
17462
|
argText = expr.arguments.map((a) => a.getText()).join(",");
|
|
17349
17463
|
}
|
|
17350
|
-
} else if (
|
|
17464
|
+
} else if (ts13.isIdentifier(expr)) {
|
|
17351
17465
|
decName = expr.text;
|
|
17352
17466
|
}
|
|
17353
17467
|
if (INPUT_OUTPUT_DECORATORS.has(decName))
|
|
@@ -17368,22 +17482,22 @@ var fail = (reason, detail, location) => ({
|
|
|
17368
17482
|
return cached.hasProviders;
|
|
17369
17483
|
let source;
|
|
17370
17484
|
try {
|
|
17371
|
-
source =
|
|
17485
|
+
source = readFileSync19(filePath, "utf8");
|
|
17372
17486
|
} catch {
|
|
17373
17487
|
return true;
|
|
17374
17488
|
}
|
|
17375
|
-
const sf =
|
|
17489
|
+
const sf = ts13.createSourceFile(filePath, source, ts13.ScriptTarget.ES2022, true, ts13.ScriptKind.TS);
|
|
17376
17490
|
let hasProviders = false;
|
|
17377
17491
|
const visit = (node) => {
|
|
17378
17492
|
if (hasProviders)
|
|
17379
17493
|
return;
|
|
17380
|
-
if (
|
|
17381
|
-
for (const decorator of
|
|
17494
|
+
if (ts13.isClassDeclaration(node)) {
|
|
17495
|
+
for (const decorator of ts13.getDecorators(node) ?? []) {
|
|
17382
17496
|
const expr = decorator.expression;
|
|
17383
|
-
if (!
|
|
17497
|
+
if (!ts13.isCallExpression(expr))
|
|
17384
17498
|
continue;
|
|
17385
17499
|
const arg = expr.arguments[0];
|
|
17386
|
-
if (!arg || !
|
|
17500
|
+
if (!arg || !ts13.isObjectLiteralExpression(arg))
|
|
17387
17501
|
continue;
|
|
17388
17502
|
if (getProperty(arg, "providers") !== null) {
|
|
17389
17503
|
hasProviders = true;
|
|
@@ -17391,7 +17505,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17391
17505
|
}
|
|
17392
17506
|
}
|
|
17393
17507
|
}
|
|
17394
|
-
|
|
17508
|
+
ts13.forEachChild(node, visit);
|
|
17395
17509
|
};
|
|
17396
17510
|
visit(sf);
|
|
17397
17511
|
providerProbeCache.set(filePath, {
|
|
@@ -17401,10 +17515,10 @@ var fail = (reason, detail, location) => ({
|
|
|
17401
17515
|
return hasProviders;
|
|
17402
17516
|
}, TS_EXTENSIONS, resolveImportSource = (identifierName, sourceFile, componentDir) => {
|
|
17403
17517
|
for (const stmt of sourceFile.statements) {
|
|
17404
|
-
if (!
|
|
17518
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
17405
17519
|
continue;
|
|
17406
17520
|
const moduleSpec = stmt.moduleSpecifier;
|
|
17407
|
-
if (!
|
|
17521
|
+
if (!ts13.isStringLiteral(moduleSpec))
|
|
17408
17522
|
continue;
|
|
17409
17523
|
const spec = moduleSpec.text;
|
|
17410
17524
|
if (!spec.startsWith(".") && !spec.startsWith("/"))
|
|
@@ -17418,7 +17532,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17418
17532
|
}
|
|
17419
17533
|
if (importClause.namedBindings) {
|
|
17420
17534
|
const nb = importClause.namedBindings;
|
|
17421
|
-
if (
|
|
17535
|
+
if (ts13.isNamespaceImport(nb)) {
|
|
17422
17536
|
if (nb.name.text === identifierName)
|
|
17423
17537
|
matches = true;
|
|
17424
17538
|
} else {
|
|
@@ -17435,11 +17549,11 @@ var fail = (reason, detail, location) => ({
|
|
|
17435
17549
|
const resolved = resolve26(componentDir, spec);
|
|
17436
17550
|
for (const ext of TS_EXTENSIONS) {
|
|
17437
17551
|
const candidate = resolved + ext;
|
|
17438
|
-
if (
|
|
17552
|
+
if (existsSync24(candidate))
|
|
17439
17553
|
return candidate;
|
|
17440
17554
|
}
|
|
17441
17555
|
const indexCandidate = resolve26(resolved, "index.ts");
|
|
17442
|
-
if (
|
|
17556
|
+
if (existsSync24(indexCandidate))
|
|
17443
17557
|
return indexCandidate;
|
|
17444
17558
|
}
|
|
17445
17559
|
return null;
|
|
@@ -17448,7 +17562,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17448
17562
|
return [];
|
|
17449
17563
|
const sig = [];
|
|
17450
17564
|
for (const entry of importsExpr.elements) {
|
|
17451
|
-
if (
|
|
17565
|
+
if (ts13.isIdentifier(entry)) {
|
|
17452
17566
|
const importPath = resolveImportSource(entry.text, sourceFile, componentDir);
|
|
17453
17567
|
if (importPath) {
|
|
17454
17568
|
if (fileHasModuleProviders(importPath)) {
|
|
@@ -17467,13 +17581,13 @@ var fail = (reason, detail, location) => ({
|
|
|
17467
17581
|
}, extractPropertyFieldNames = (cls) => {
|
|
17468
17582
|
const names = [];
|
|
17469
17583
|
for (const member of cls.members) {
|
|
17470
|
-
if (!
|
|
17584
|
+
if (!ts13.isPropertyDeclaration(member) && !ts13.isMethodDeclaration(member) && !ts13.isGetAccessorDeclaration(member) && !ts13.isSetAccessorDeclaration(member)) {
|
|
17471
17585
|
continue;
|
|
17472
17586
|
}
|
|
17473
17587
|
const name = member.name;
|
|
17474
17588
|
if (name === undefined)
|
|
17475
17589
|
continue;
|
|
17476
|
-
const text =
|
|
17590
|
+
const text = ts13.isIdentifier(name) ? name.text : ts13.isStringLiteral(name) || ts13.isNoSubstitutionTemplateLiteral(name) ? name.text : name.getText();
|
|
17477
17591
|
if (text.length > 0)
|
|
17478
17592
|
names.push(text);
|
|
17479
17593
|
}
|
|
@@ -17481,7 +17595,7 @@ var fail = (reason, detail, location) => ({
|
|
|
17481
17595
|
}, extractTopLevelImports = (sourceFile) => {
|
|
17482
17596
|
const names = new Set;
|
|
17483
17597
|
for (const stmt of sourceFile.statements) {
|
|
17484
|
-
if (!
|
|
17598
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
17485
17599
|
continue;
|
|
17486
17600
|
const clause = stmt.importClause;
|
|
17487
17601
|
if (!clause)
|
|
@@ -17493,9 +17607,9 @@ var fail = (reason, detail, location) => ({
|
|
|
17493
17607
|
const bindings = clause.namedBindings;
|
|
17494
17608
|
if (!bindings)
|
|
17495
17609
|
continue;
|
|
17496
|
-
if (
|
|
17610
|
+
if (ts13.isNamespaceImport(bindings)) {
|
|
17497
17611
|
names.add(bindings.name.text);
|
|
17498
|
-
} else if (
|
|
17612
|
+
} else if (ts13.isNamedImports(bindings)) {
|
|
17499
17613
|
for (const el of bindings.elements) {
|
|
17500
17614
|
if (el.isTypeOnly)
|
|
17501
17615
|
continue;
|
|
@@ -17507,18 +17621,18 @@ var fail = (reason, detail, location) => ({
|
|
|
17507
17621
|
}, extractFingerprint = (cls, className, decoratorMeta, inputs, outputs, sourceFile, componentDir) => {
|
|
17508
17622
|
const ctorParamTypes = [];
|
|
17509
17623
|
for (const member of cls.members) {
|
|
17510
|
-
if (!
|
|
17624
|
+
if (!ts13.isConstructorDeclaration(member))
|
|
17511
17625
|
continue;
|
|
17512
17626
|
for (const param of member.parameters) {
|
|
17513
17627
|
const typeText = param.type ? param.type.getText() : "";
|
|
17514
|
-
const decorators =
|
|
17628
|
+
const decorators = ts13.getDecorators(param) ?? [];
|
|
17515
17629
|
const decoratorSig = decorators.length === 0 ? "" : decorators.map((d2) => {
|
|
17516
17630
|
const expr = d2.expression;
|
|
17517
|
-
if (
|
|
17631
|
+
if (ts13.isCallExpression(expr) && ts13.isIdentifier(expr.expression)) {
|
|
17518
17632
|
const args = expr.arguments.map((a) => a.getText()).join(",");
|
|
17519
17633
|
return `@${expr.expression.text}(${args})`;
|
|
17520
17634
|
}
|
|
17521
|
-
if (
|
|
17635
|
+
if (ts13.isIdentifier(expr)) {
|
|
17522
17636
|
return `@${expr.text}`;
|
|
17523
17637
|
}
|
|
17524
17638
|
return "@<unknown>";
|
|
@@ -17534,12 +17648,12 @@ var fail = (reason, detail, location) => ({
|
|
|
17534
17648
|
const providerImportSig = extractProviderImportSig(decoratorMeta.importsExpr, sourceFile, componentDir);
|
|
17535
17649
|
const topLevelImports = extractTopLevelImports(sourceFile);
|
|
17536
17650
|
const propertyFieldNames = extractPropertyFieldNames(cls);
|
|
17537
|
-
const printer =
|
|
17538
|
-
newLine:
|
|
17651
|
+
const printer = ts13.createPrinter({
|
|
17652
|
+
newLine: ts13.NewLineKind.LineFeed,
|
|
17539
17653
|
omitTrailingSemicolon: true,
|
|
17540
17654
|
removeComments: true
|
|
17541
17655
|
});
|
|
17542
|
-
const canonicalText = (node) => printer.printNode(
|
|
17656
|
+
const canonicalText = (node) => printer.printNode(ts13.EmitHint.Unspecified, node, sourceFile);
|
|
17543
17657
|
const importsArraySig = decoratorMeta.importsExpr ? djb2Hash(canonicalText(decoratorMeta.importsExpr)) : "";
|
|
17544
17658
|
const hostDirectivesSig = decoratorMeta.hostDirectivesExpr ? djb2Hash(canonicalText(decoratorMeta.hostDirectivesExpr)) : "";
|
|
17545
17659
|
const animationsArraySig = decoratorMeta.animationsExpr ? djb2Hash(canonicalText(decoratorMeta.animationsExpr)) : "";
|
|
@@ -17552,13 +17666,13 @@ var fail = (reason, detail, location) => ({
|
|
|
17552
17666
|
const PAGE_EXPORT_NAMES = new Set(["providers", "routes"]);
|
|
17553
17667
|
const pageExportEntries = [];
|
|
17554
17668
|
for (const stmt of sourceFile.statements) {
|
|
17555
|
-
if (!
|
|
17669
|
+
if (!ts13.isVariableStatement(stmt))
|
|
17556
17670
|
continue;
|
|
17557
|
-
const isExported = stmt.modifiers?.some((m) => m.kind ===
|
|
17671
|
+
const isExported = stmt.modifiers?.some((m) => m.kind === ts13.SyntaxKind.ExportKeyword);
|
|
17558
17672
|
if (!isExported)
|
|
17559
17673
|
continue;
|
|
17560
17674
|
for (const decl of stmt.declarationList.declarations) {
|
|
17561
|
-
if (!
|
|
17675
|
+
if (!ts13.isIdentifier(decl.name))
|
|
17562
17676
|
continue;
|
|
17563
17677
|
if (!PAGE_EXPORT_NAMES.has(decl.name.text))
|
|
17564
17678
|
continue;
|
|
@@ -17599,35 +17713,35 @@ var fail = (reason, detail, location) => ({
|
|
|
17599
17713
|
}, buildFreshClassMethodsBlock = (classNode, className) => {
|
|
17600
17714
|
const memberSources = [];
|
|
17601
17715
|
let hasStatic = false;
|
|
17602
|
-
const printer =
|
|
17716
|
+
const printer = ts13.createPrinter({ removeComments: true });
|
|
17603
17717
|
for (const member of classNode.members) {
|
|
17604
|
-
if (
|
|
17605
|
-
const modifiers = (
|
|
17606
|
-
const cleaned =
|
|
17607
|
-
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()));
|
|
17608
17722
|
continue;
|
|
17609
17723
|
}
|
|
17610
|
-
if (
|
|
17611
|
-
const cleanedParams = member.parameters.map((param) =>
|
|
17612
|
-
const cleaned =
|
|
17613
|
-
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()));
|
|
17614
17728
|
continue;
|
|
17615
17729
|
}
|
|
17616
|
-
if (
|
|
17617
|
-
const modifiers =
|
|
17618
|
-
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);
|
|
17619
17733
|
if (isStatic)
|
|
17620
17734
|
hasStatic = true;
|
|
17621
|
-
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));
|
|
17622
17736
|
let cleaned;
|
|
17623
|
-
if (
|
|
17624
|
-
cleaned =
|
|
17625
|
-
} else if (
|
|
17626
|
-
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);
|
|
17627
17741
|
} else {
|
|
17628
|
-
cleaned =
|
|
17742
|
+
cleaned = ts13.factory.createSetAccessorDeclaration(modifiers, member.name, cleanedParams, member.body);
|
|
17629
17743
|
}
|
|
17630
|
-
const printed = printer.printNode(
|
|
17744
|
+
const printed = printer.printNode(ts13.EmitHint.Unspecified, cleaned, classNode.getSourceFile());
|
|
17631
17745
|
memberSources.push(printed);
|
|
17632
17746
|
}
|
|
17633
17747
|
}
|
|
@@ -17639,10 +17753,10 @@ ${memberSources.join(`
|
|
|
17639
17753
|
}`;
|
|
17640
17754
|
let transpiled;
|
|
17641
17755
|
try {
|
|
17642
|
-
transpiled =
|
|
17756
|
+
transpiled = ts13.transpileModule(wrappedSource, {
|
|
17643
17757
|
compilerOptions: {
|
|
17644
|
-
module:
|
|
17645
|
-
target:
|
|
17758
|
+
module: ts13.ModuleKind.ES2022,
|
|
17759
|
+
target: ts13.ScriptTarget.ES2022
|
|
17646
17760
|
},
|
|
17647
17761
|
reportDiagnostics: false
|
|
17648
17762
|
}).outputText;
|
|
@@ -17672,11 +17786,11 @@ ${transpiled}
|
|
|
17672
17786
|
}${staticPatch}`;
|
|
17673
17787
|
}, STYLE_PREPROCESSED_EXT, resolveAndReadStyleResource = (componentDir, url) => {
|
|
17674
17788
|
const abs = resolve26(componentDir, url);
|
|
17675
|
-
if (!
|
|
17789
|
+
if (!existsSync24(abs))
|
|
17676
17790
|
return null;
|
|
17677
17791
|
const ext = extname6(abs).toLowerCase();
|
|
17678
17792
|
if (!STYLE_PREPROCESSED_EXT.has(ext) || ext === ".css") {
|
|
17679
|
-
return
|
|
17793
|
+
return readFileSync19(abs, "utf8");
|
|
17680
17794
|
}
|
|
17681
17795
|
try {
|
|
17682
17796
|
const { compileStyleFileIfNeededSync: compileStyleFileIfNeededSync2 } = (init_stylePreprocessor(), __toCommonJS(exports_stylePreprocessor));
|
|
@@ -17713,10 +17827,10 @@ ${block}
|
|
|
17713
17827
|
return cached;
|
|
17714
17828
|
const tsconfigPath = resolve26(projectRoot, "tsconfig.json");
|
|
17715
17829
|
const opts = {};
|
|
17716
|
-
if (
|
|
17830
|
+
if (existsSync24(tsconfigPath)) {
|
|
17717
17831
|
try {
|
|
17718
|
-
const text =
|
|
17719
|
-
const parsed =
|
|
17832
|
+
const text = readFileSync19(tsconfigPath, "utf8");
|
|
17833
|
+
const parsed = ts13.parseConfigFileTextToJson(tsconfigPath, text);
|
|
17720
17834
|
if (!parsed.error && parsed.config) {
|
|
17721
17835
|
const cfg = parsed.config;
|
|
17722
17836
|
const ang = cfg.angularCompilerOptions ?? {};
|
|
@@ -17740,7 +17854,7 @@ ${block}
|
|
|
17740
17854
|
}, tryFastHmr = async (params) => {
|
|
17741
17855
|
const { componentFilePath, className } = params;
|
|
17742
17856
|
const projectRoot = params.projectRoot ?? process.cwd();
|
|
17743
|
-
if (!
|
|
17857
|
+
if (!existsSync24(componentFilePath)) {
|
|
17744
17858
|
return fail("file-not-found", componentFilePath);
|
|
17745
17859
|
}
|
|
17746
17860
|
let compiler;
|
|
@@ -17749,8 +17863,8 @@ ${block}
|
|
|
17749
17863
|
} catch (err) {
|
|
17750
17864
|
return fail("unexpected-error", `import @angular/compiler: ${err}`);
|
|
17751
17865
|
}
|
|
17752
|
-
const tsSource =
|
|
17753
|
-
const sourceFile =
|
|
17866
|
+
const tsSource = readFileSync19(componentFilePath, "utf8");
|
|
17867
|
+
const sourceFile = ts13.createSourceFile(componentFilePath, tsSource, ts13.ScriptTarget.ES2022, true, ts13.ScriptKind.TS);
|
|
17754
17868
|
const classNode = findClassDeclaration(sourceFile, className);
|
|
17755
17869
|
if (!classNode) {
|
|
17756
17870
|
return fail("class-not-found", `${className} in ${componentFilePath}`);
|
|
@@ -17776,7 +17890,7 @@ ${block}
|
|
|
17776
17890
|
rebootstrapRequired: false
|
|
17777
17891
|
};
|
|
17778
17892
|
}
|
|
17779
|
-
if (inheritsDecoratedClass(classNode, sourceFile,
|
|
17893
|
+
if (inheritsDecoratedClass(classNode, sourceFile, dirname19(componentFilePath), projectRoot)) {
|
|
17780
17894
|
return fail("inherits-decorated-class");
|
|
17781
17895
|
}
|
|
17782
17896
|
const decorator = findComponentDecorator(classNode);
|
|
@@ -17788,7 +17902,7 @@ ${block}
|
|
|
17788
17902
|
const projectDefaults = readProjectAngularCompilerOptions(projectRoot);
|
|
17789
17903
|
const decoratorMeta = readDecoratorMeta(decoratorArgs, projectDefaults);
|
|
17790
17904
|
const advancedMetadata = extractAdvancedMetadata(classNode, decoratorArgs, compiler);
|
|
17791
|
-
const componentDir =
|
|
17905
|
+
const componentDir = dirname19(componentFilePath);
|
|
17792
17906
|
let templateText;
|
|
17793
17907
|
let templatePath;
|
|
17794
17908
|
if (decoratorMeta.template !== null) {
|
|
@@ -17796,10 +17910,10 @@ ${block}
|
|
|
17796
17910
|
templatePath = componentFilePath;
|
|
17797
17911
|
} else if (decoratorMeta.templateUrl) {
|
|
17798
17912
|
const tplAbs = resolve26(componentDir, decoratorMeta.templateUrl);
|
|
17799
|
-
if (!
|
|
17913
|
+
if (!existsSync24(tplAbs)) {
|
|
17800
17914
|
return fail("template-resource-not-found", `Template file not found: ${tplAbs}`, { file: componentFilePath });
|
|
17801
17915
|
}
|
|
17802
|
-
templateText =
|
|
17916
|
+
templateText = readFileSync19(tplAbs, "utf8");
|
|
17803
17917
|
templatePath = tplAbs;
|
|
17804
17918
|
} else {
|
|
17805
17919
|
return fail("unsupported-decorator-args", "missing template/templateUrl");
|
|
@@ -17870,7 +17984,7 @@ ${block}
|
|
|
17870
17984
|
viewQueries: advancedMetadata.viewQueries,
|
|
17871
17985
|
host: advancedMetadata.host,
|
|
17872
17986
|
lifecycle: {
|
|
17873
|
-
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")
|
|
17874
17988
|
},
|
|
17875
17989
|
inputs,
|
|
17876
17990
|
outputs,
|
|
@@ -17926,15 +18040,15 @@ ${block}
|
|
|
17926
18040
|
}
|
|
17927
18041
|
const importGenerator = createHmrImportGenerator(namespaceMap);
|
|
17928
18042
|
const tsFunctionDecl = translateStatement(sourceFile, callback, importGenerator);
|
|
17929
|
-
const exportedDecl =
|
|
17930
|
-
|
|
17931
|
-
|
|
18043
|
+
const exportedDecl = ts13.factory.updateFunctionDeclaration(tsFunctionDecl, [
|
|
18044
|
+
ts13.factory.createToken(ts13.SyntaxKind.ExportKeyword),
|
|
18045
|
+
ts13.factory.createToken(ts13.SyntaxKind.DefaultKeyword)
|
|
17932
18046
|
], tsFunctionDecl.asteriskToken, tsFunctionDecl.name, tsFunctionDecl.typeParameters, tsFunctionDecl.parameters, tsFunctionDecl.type, tsFunctionDecl.body);
|
|
17933
|
-
const printer =
|
|
17934
|
-
newLine:
|
|
18047
|
+
const printer = ts13.createPrinter({
|
|
18048
|
+
newLine: ts13.NewLineKind.LineFeed,
|
|
17935
18049
|
removeComments: false
|
|
17936
18050
|
});
|
|
17937
|
-
const fnText = printer.printNode(
|
|
18051
|
+
const fnText = printer.printNode(ts13.EmitHint.Unspecified, exportedDecl, sourceFile);
|
|
17938
18052
|
const provisionalMethodsBlock = buildFreshClassMethodsBlock(classNode, className) ?? "";
|
|
17939
18053
|
const referencedNames = new Set;
|
|
17940
18054
|
const identRe = /[A-Za-z_$][A-Za-z0-9_$]*/g;
|
|
@@ -17944,33 +18058,33 @@ ${block}
|
|
|
17944
18058
|
}
|
|
17945
18059
|
const sourceScopeNames = new Set;
|
|
17946
18060
|
for (const stmt of sourceFile.statements) {
|
|
17947
|
-
if (
|
|
17948
|
-
if (!
|
|
18061
|
+
if (ts13.isImportDeclaration(stmt)) {
|
|
18062
|
+
if (!ts13.isStringLiteral(stmt.moduleSpecifier))
|
|
17949
18063
|
continue;
|
|
17950
18064
|
const clause = stmt.importClause;
|
|
17951
18065
|
if (clause?.name)
|
|
17952
18066
|
sourceScopeNames.add(clause.name.text);
|
|
17953
|
-
if (clause?.namedBindings &&
|
|
18067
|
+
if (clause?.namedBindings && ts13.isNamedImports(clause.namedBindings)) {
|
|
17954
18068
|
for (const el of clause.namedBindings.elements) {
|
|
17955
18069
|
if (el.isTypeOnly)
|
|
17956
18070
|
continue;
|
|
17957
18071
|
sourceScopeNames.add(el.name.text);
|
|
17958
18072
|
}
|
|
17959
|
-
} else if (clause?.namedBindings &&
|
|
18073
|
+
} else if (clause?.namedBindings && ts13.isNamespaceImport(clause.namedBindings)) {
|
|
17960
18074
|
sourceScopeNames.add(clause.namedBindings.name.text);
|
|
17961
18075
|
}
|
|
17962
18076
|
continue;
|
|
17963
18077
|
}
|
|
17964
|
-
if (
|
|
18078
|
+
if (ts13.isVariableStatement(stmt) || stmt.kind === ts13.SyntaxKind.VariableStatement) {
|
|
17965
18079
|
const varStmt = stmt;
|
|
17966
18080
|
for (const decl of varStmt.declarationList.declarations) {
|
|
17967
|
-
if (
|
|
18081
|
+
if (ts13.isIdentifier(decl.name)) {
|
|
17968
18082
|
sourceScopeNames.add(decl.name.text);
|
|
17969
18083
|
}
|
|
17970
18084
|
}
|
|
17971
18085
|
continue;
|
|
17972
18086
|
}
|
|
17973
|
-
if (
|
|
18087
|
+
if (ts13.isFunctionDeclaration(stmt) || ts13.isClassDeclaration(stmt)) {
|
|
17974
18088
|
if (stmt.name)
|
|
17975
18089
|
sourceScopeNames.add(stmt.name.text);
|
|
17976
18090
|
}
|
|
@@ -17981,7 +18095,7 @@ ${block}
|
|
|
17981
18095
|
}
|
|
17982
18096
|
const allImportedNames = new Set;
|
|
17983
18097
|
for (const stmt of sourceFile.statements) {
|
|
17984
|
-
if (!
|
|
18098
|
+
if (!ts13.isImportDeclaration(stmt))
|
|
17985
18099
|
continue;
|
|
17986
18100
|
const clause = stmt.importClause;
|
|
17987
18101
|
if (!clause || clause.isTypeOnly)
|
|
@@ -17991,7 +18105,7 @@ ${block}
|
|
|
17991
18105
|
const bindings = clause.namedBindings;
|
|
17992
18106
|
if (!bindings)
|
|
17993
18107
|
continue;
|
|
17994
|
-
if (
|
|
18108
|
+
if (ts13.isNamespaceImport(bindings)) {
|
|
17995
18109
|
allImportedNames.add(bindings.name.text);
|
|
17996
18110
|
} else {
|
|
17997
18111
|
for (const el of bindings.elements) {
|
|
@@ -18003,10 +18117,10 @@ ${block}
|
|
|
18003
18117
|
}
|
|
18004
18118
|
const depsToDestructure = [...sourceScopeNames].filter((n) => referencedNames.has(n) || allImportedNames.has(n));
|
|
18005
18119
|
const tsSourceText = fnText;
|
|
18006
|
-
const transpiled =
|
|
18120
|
+
const transpiled = ts13.transpileModule(tsSourceText, {
|
|
18007
18121
|
compilerOptions: {
|
|
18008
|
-
module:
|
|
18009
|
-
target:
|
|
18122
|
+
module: ts13.ModuleKind.ES2022,
|
|
18123
|
+
target: ts13.ScriptTarget.ES2022
|
|
18010
18124
|
},
|
|
18011
18125
|
fileName: componentFilePath,
|
|
18012
18126
|
reportDiagnostics: false
|
|
@@ -18549,16 +18663,16 @@ __export(exports_compileEmber, {
|
|
|
18549
18663
|
getEmberServerCompiledDir: () => getEmberServerCompiledDir,
|
|
18550
18664
|
getEmberCompiledRoot: () => getEmberCompiledRoot,
|
|
18551
18665
|
getEmberClientCompiledDir: () => getEmberClientCompiledDir,
|
|
18552
|
-
dirname: () =>
|
|
18666
|
+
dirname: () => dirname20,
|
|
18553
18667
|
compileEmberFileSource: () => compileEmberFileSource,
|
|
18554
18668
|
compileEmberFile: () => compileEmberFile,
|
|
18555
18669
|
compileEmber: () => compileEmber,
|
|
18556
18670
|
clearEmberCompilerCache: () => clearEmberCompilerCache,
|
|
18557
18671
|
basename: () => basename10
|
|
18558
18672
|
});
|
|
18559
|
-
import { existsSync as
|
|
18673
|
+
import { existsSync as existsSync25 } from "fs";
|
|
18560
18674
|
import { mkdir as mkdir6, rm as rm4 } from "fs/promises";
|
|
18561
|
-
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";
|
|
18562
18676
|
var {build: bunBuild2, Transpiler: Transpiler4, write: write4, file: file4 } = globalThis.Bun;
|
|
18563
18677
|
var cachedPreprocessor = null, getPreprocessor = async () => {
|
|
18564
18678
|
if (cachedPreprocessor)
|
|
@@ -18654,11 +18768,11 @@ export const importSync = (specifier) => {
|
|
|
18654
18768
|
const originalImporter = stagedSourceMap.get(args.importer);
|
|
18655
18769
|
if (!originalImporter)
|
|
18656
18770
|
return;
|
|
18657
|
-
const candidateBase = resolve27(
|
|
18771
|
+
const candidateBase = resolve27(dirname20(originalImporter), args.path);
|
|
18658
18772
|
const extensionsToTry = ["", ".gts", ".gjs", ".ts", ".js"];
|
|
18659
18773
|
for (const ext of extensionsToTry) {
|
|
18660
18774
|
const candidate = candidateBase + ext;
|
|
18661
|
-
if (
|
|
18775
|
+
if (existsSync25(candidate))
|
|
18662
18776
|
return { path: candidate };
|
|
18663
18777
|
}
|
|
18664
18778
|
return;
|
|
@@ -18677,8 +18791,8 @@ export const importSync = (specifier) => {
|
|
|
18677
18791
|
build2.onResolve({ filter: /^@(?:ember|glimmer|simple-dom)\// }, (args) => {
|
|
18678
18792
|
if (standalonePackages.has(args.path))
|
|
18679
18793
|
return;
|
|
18680
|
-
const internal =
|
|
18681
|
-
if (
|
|
18794
|
+
const internal = join31(cwd, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
18795
|
+
if (existsSync25(internal))
|
|
18682
18796
|
return { path: internal };
|
|
18683
18797
|
return;
|
|
18684
18798
|
});
|
|
@@ -18725,16 +18839,16 @@ export default PageComponent;
|
|
|
18725
18839
|
}
|
|
18726
18840
|
const transpiled = transpiler5.transformSync(preprocessed);
|
|
18727
18841
|
const baseName = basename10(resolvedEntry).replace(/\.(gjs|gts|ts|js)$/, "");
|
|
18728
|
-
const tmpDir =
|
|
18729
|
-
const serverDir =
|
|
18730
|
-
const clientDir =
|
|
18842
|
+
const tmpDir = join31(compiledRoot, "_tmp");
|
|
18843
|
+
const serverDir = join31(compiledRoot, "server");
|
|
18844
|
+
const clientDir = join31(compiledRoot, "client");
|
|
18731
18845
|
await Promise.all([
|
|
18732
18846
|
mkdir6(tmpDir, { recursive: true }),
|
|
18733
18847
|
mkdir6(serverDir, { recursive: true }),
|
|
18734
18848
|
mkdir6(clientDir, { recursive: true })
|
|
18735
18849
|
]);
|
|
18736
|
-
const tmpPagePath = resolve27(
|
|
18737
|
-
const tmpHarnessPath = resolve27(
|
|
18850
|
+
const tmpPagePath = resolve27(join31(tmpDir, `${baseName}.module.js`));
|
|
18851
|
+
const tmpHarnessPath = resolve27(join31(tmpDir, `${baseName}.harness.js`));
|
|
18738
18852
|
await Promise.all([
|
|
18739
18853
|
write4(tmpPagePath, transpiled),
|
|
18740
18854
|
write4(tmpHarnessPath, generateServerHarness(tmpPagePath))
|
|
@@ -18742,7 +18856,7 @@ export default PageComponent;
|
|
|
18742
18856
|
const stagedSourceMap = new Map([
|
|
18743
18857
|
[tmpPagePath, resolvedEntry]
|
|
18744
18858
|
]);
|
|
18745
|
-
const serverPath =
|
|
18859
|
+
const serverPath = join31(serverDir, `${baseName}.js`);
|
|
18746
18860
|
const buildResult = await bunBuild2({
|
|
18747
18861
|
entrypoints: [tmpHarnessPath],
|
|
18748
18862
|
format: "esm",
|
|
@@ -18759,7 +18873,7 @@ export default PageComponent;
|
|
|
18759
18873
|
console.warn(`\u26A0\uFE0F Ember server build for ${baseName} had errors:`, buildResult.logs);
|
|
18760
18874
|
}
|
|
18761
18875
|
await rm4(tmpDir, { force: true, recursive: true });
|
|
18762
|
-
const clientPath =
|
|
18876
|
+
const clientPath = join31(clientDir, `${baseName}.js`);
|
|
18763
18877
|
await write4(clientPath, transpiled);
|
|
18764
18878
|
return { clientPath, serverPath };
|
|
18765
18879
|
}, compileEmber = async (entries, emberDir, cwd = process.cwd(), _hmr = false) => {
|
|
@@ -18787,7 +18901,7 @@ export default PageComponent;
|
|
|
18787
18901
|
preprocessed = rewriteTemplateEvalToScope(result.code);
|
|
18788
18902
|
}
|
|
18789
18903
|
return transpiler5.transformSync(preprocessed);
|
|
18790
|
-
}, 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");
|
|
18791
18905
|
var init_compileEmber = __esm(() => {
|
|
18792
18906
|
init_generatedDir();
|
|
18793
18907
|
transpiler5 = new Transpiler4({
|
|
@@ -18808,8 +18922,8 @@ __export(exports_buildReactVendor, {
|
|
|
18808
18922
|
computeVendorPaths: () => computeVendorPaths,
|
|
18809
18923
|
buildReactVendor: () => buildReactVendor
|
|
18810
18924
|
});
|
|
18811
|
-
import { existsSync as
|
|
18812
|
-
import { join as
|
|
18925
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync10 } from "fs";
|
|
18926
|
+
import { join as join32, resolve as resolve28 } from "path";
|
|
18813
18927
|
import { rm as rm5 } from "fs/promises";
|
|
18814
18928
|
var {build: bunBuild3 } = globalThis.Bun;
|
|
18815
18929
|
var resolveJsxDevRuntimeCompatPath = () => {
|
|
@@ -18822,7 +18936,7 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
18822
18936
|
resolve28(import.meta.dir, "..", "..", "src", "react", "jsxDevRuntimeCompat.ts")
|
|
18823
18937
|
];
|
|
18824
18938
|
for (const candidate of candidates) {
|
|
18825
|
-
if (
|
|
18939
|
+
if (existsSync26(candidate)) {
|
|
18826
18940
|
return candidate.replace(/\\/g, "/");
|
|
18827
18941
|
}
|
|
18828
18942
|
}
|
|
@@ -18863,14 +18977,14 @@ var resolveJsxDevRuntimeCompatPath = () => {
|
|
|
18863
18977
|
`)}
|
|
18864
18978
|
`;
|
|
18865
18979
|
}, buildReactVendor = async (buildDir) => {
|
|
18866
|
-
const vendorDir =
|
|
18980
|
+
const vendorDir = join32(buildDir, "react", "vendor");
|
|
18867
18981
|
mkdirSync10(vendorDir, { recursive: true });
|
|
18868
|
-
const tmpDir =
|
|
18982
|
+
const tmpDir = join32(buildDir, "_vendor_tmp");
|
|
18869
18983
|
mkdirSync10(tmpDir, { recursive: true });
|
|
18870
18984
|
const specifiers = resolveVendorSpecifiers();
|
|
18871
18985
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
18872
18986
|
const safeName = toSafeFileName(specifier);
|
|
18873
|
-
const entryPath =
|
|
18987
|
+
const entryPath = join32(tmpDir, `${safeName}.ts`);
|
|
18874
18988
|
const source = await generateEntrySource(specifier);
|
|
18875
18989
|
await Bun.write(entryPath, source);
|
|
18876
18990
|
return entryPath;
|
|
@@ -18935,7 +19049,7 @@ __export(exports_buildAngularVendor, {
|
|
|
18935
19049
|
buildAngularServerVendor: () => buildAngularServerVendor
|
|
18936
19050
|
});
|
|
18937
19051
|
import { mkdirSync as mkdirSync11 } from "fs";
|
|
18938
|
-
import { join as
|
|
19052
|
+
import { join as join33 } from "path";
|
|
18939
19053
|
import { rm as rm6 } from "fs/promises";
|
|
18940
19054
|
var {build: bunBuild4, Glob: Glob7 } = globalThis.Bun;
|
|
18941
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) => {
|
|
@@ -18972,7 +19086,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
18972
19086
|
}
|
|
18973
19087
|
return { angular, transitiveRoots };
|
|
18974
19088
|
}, PARTIAL_DECL_MARKERS, containsPartialDeclarations = (source) => PARTIAL_DECL_MARKERS.some((marker) => source.includes(marker)), collectTransitiveAngularSpecs = async (roots, angularFound) => {
|
|
18975
|
-
const { readFileSync:
|
|
19089
|
+
const { readFileSync: readFileSync20 } = await import("fs");
|
|
18976
19090
|
const transpiler6 = new Bun.Transpiler({ loader: "js" });
|
|
18977
19091
|
const visited = new Set;
|
|
18978
19092
|
const frontier = [];
|
|
@@ -18993,7 +19107,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
18993
19107
|
}
|
|
18994
19108
|
let content;
|
|
18995
19109
|
try {
|
|
18996
|
-
content =
|
|
19110
|
+
content = readFileSync20(resolved, "utf-8");
|
|
18997
19111
|
} catch {
|
|
18998
19112
|
continue;
|
|
18999
19113
|
}
|
|
@@ -19032,14 +19146,14 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
19032
19146
|
await collectTransitiveAngularSpecs([...angular, ...transitiveRoots], angular);
|
|
19033
19147
|
return Array.from(angular).filter(isResolvable2);
|
|
19034
19148
|
}, buildAngularVendor = async (buildDir, directories = [], linkerJitMode = false, depVendorSpecifiers = []) => {
|
|
19035
|
-
const vendorDir =
|
|
19149
|
+
const vendorDir = join33(buildDir, "angular", "vendor");
|
|
19036
19150
|
mkdirSync11(vendorDir, { recursive: true });
|
|
19037
|
-
const tmpDir =
|
|
19151
|
+
const tmpDir = join33(buildDir, "_angular_vendor_tmp");
|
|
19038
19152
|
mkdirSync11(tmpDir, { recursive: true });
|
|
19039
19153
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
19040
19154
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
19041
19155
|
const safeName = toSafeFileName2(specifier);
|
|
19042
|
-
const entryPath =
|
|
19156
|
+
const entryPath = join33(tmpDir, `${safeName}.ts`);
|
|
19043
19157
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
19044
19158
|
return entryPath;
|
|
19045
19159
|
}));
|
|
@@ -19070,9 +19184,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
19070
19184
|
const specifiers = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
19071
19185
|
return computeAngularVendorPaths(specifiers);
|
|
19072
19186
|
}, buildAngularServerVendor = async (buildDir, directories = [], linkerJitMode = false) => {
|
|
19073
|
-
const vendorDir =
|
|
19187
|
+
const vendorDir = join33(buildDir, "angular", "vendor", "server");
|
|
19074
19188
|
mkdirSync11(vendorDir, { recursive: true });
|
|
19075
|
-
const tmpDir =
|
|
19189
|
+
const tmpDir = join33(buildDir, "_angular_server_vendor_tmp");
|
|
19076
19190
|
mkdirSync11(tmpDir, { recursive: true });
|
|
19077
19191
|
const browserSpecs = await resolveAngularSpecifiers(directories, linkerJitMode);
|
|
19078
19192
|
const allSpecs = new Set(browserSpecs);
|
|
@@ -19083,7 +19197,7 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
19083
19197
|
const specifiers = Array.from(allSpecs);
|
|
19084
19198
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
19085
19199
|
const safeName = toSafeFileName2(specifier);
|
|
19086
|
-
const entryPath =
|
|
19200
|
+
const entryPath = join33(tmpDir, `${safeName}.ts`);
|
|
19087
19201
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
19088
19202
|
return entryPath;
|
|
19089
19203
|
}));
|
|
@@ -19105,9 +19219,9 @@ var REQUIRED_ANGULAR_SPECIFIERS_BASE, requiredAngularSpecifiers = (jitMode) => j
|
|
|
19105
19219
|
return specifiers;
|
|
19106
19220
|
}, computeAngularServerVendorPaths = (buildDir, specifiers) => {
|
|
19107
19221
|
const paths = {};
|
|
19108
|
-
const vendorDir =
|
|
19222
|
+
const vendorDir = join33(buildDir, "angular", "vendor", "server");
|
|
19109
19223
|
for (const specifier of specifiers) {
|
|
19110
|
-
paths[specifier] =
|
|
19224
|
+
paths[specifier] = join33(vendorDir, `${toSafeFileName2(specifier)}.js`);
|
|
19111
19225
|
}
|
|
19112
19226
|
return paths;
|
|
19113
19227
|
}, computeAngularServerVendorPathsAsync = async (buildDir, directories = [], linkerJitMode = true) => {
|
|
@@ -19163,17 +19277,17 @@ __export(exports_buildVueVendor, {
|
|
|
19163
19277
|
buildVueVendor: () => buildVueVendor
|
|
19164
19278
|
});
|
|
19165
19279
|
import { mkdirSync as mkdirSync12 } from "fs";
|
|
19166
|
-
import { join as
|
|
19280
|
+
import { join as join34 } from "path";
|
|
19167
19281
|
import { rm as rm7 } from "fs/promises";
|
|
19168
19282
|
var {build: bunBuild5 } = globalThis.Bun;
|
|
19169
19283
|
var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"), buildVueVendor = async (buildDir) => {
|
|
19170
|
-
const vendorDir =
|
|
19284
|
+
const vendorDir = join34(buildDir, "vue", "vendor");
|
|
19171
19285
|
mkdirSync12(vendorDir, { recursive: true });
|
|
19172
|
-
const tmpDir =
|
|
19286
|
+
const tmpDir = join34(buildDir, "_vue_vendor_tmp");
|
|
19173
19287
|
mkdirSync12(tmpDir, { recursive: true });
|
|
19174
19288
|
const entrypoints = await Promise.all(vueSpecifiers.map(async (specifier) => {
|
|
19175
19289
|
const safeName = toSafeFileName3(specifier);
|
|
19176
|
-
const entryPath =
|
|
19290
|
+
const entryPath = join34(tmpDir, `${safeName}.ts`);
|
|
19177
19291
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
19178
19292
|
`);
|
|
19179
19293
|
return entryPath;
|
|
@@ -19198,11 +19312,11 @@ var vueSpecifiers, toSafeFileName3 = (specifier) => specifier.replace(/\//g, "_"
|
|
|
19198
19312
|
console.warn("\u26A0\uFE0F Vue vendor build had errors:", result.logs);
|
|
19199
19313
|
return;
|
|
19200
19314
|
}
|
|
19201
|
-
const { readFileSync:
|
|
19315
|
+
const { readFileSync: readFileSync20, writeFileSync: writeFileSync11, readdirSync: readdirSync4 } = await import("fs");
|
|
19202
19316
|
const files = readdirSync4(vendorDir).filter((f2) => f2.endsWith(".js"));
|
|
19203
19317
|
for (const file5 of files) {
|
|
19204
|
-
const filePath =
|
|
19205
|
-
const content =
|
|
19318
|
+
const filePath = join34(vendorDir, file5);
|
|
19319
|
+
const content = readFileSync20(filePath, "utf-8");
|
|
19206
19320
|
if (!content.includes("__VUE_HMR_RUNTIME__"))
|
|
19207
19321
|
continue;
|
|
19208
19322
|
const patched = content.replace(/getGlobalThis\(\)\.__VUE_HMR_RUNTIME__\s*=\s*\{/, "getGlobalThis().__VUE_HMR_RUNTIME__ = getGlobalThis().__VUE_HMR_RUNTIME__ || {");
|
|
@@ -19228,7 +19342,7 @@ __export(exports_buildSvelteVendor, {
|
|
|
19228
19342
|
buildSvelteVendor: () => buildSvelteVendor
|
|
19229
19343
|
});
|
|
19230
19344
|
import { mkdirSync as mkdirSync13 } from "fs";
|
|
19231
|
-
import { join as
|
|
19345
|
+
import { join as join35 } from "path";
|
|
19232
19346
|
import { rm as rm8 } from "fs/promises";
|
|
19233
19347
|
var {build: bunBuild6 } = globalThis.Bun;
|
|
19234
19348
|
var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
@@ -19242,13 +19356,13 @@ var svelteSpecifiers, isResolvable3 = (specifier) => {
|
|
|
19242
19356
|
const specifiers = resolveVendorSpecifiers2();
|
|
19243
19357
|
if (specifiers.length === 0)
|
|
19244
19358
|
return;
|
|
19245
|
-
const vendorDir =
|
|
19359
|
+
const vendorDir = join35(buildDir, "svelte", "vendor");
|
|
19246
19360
|
mkdirSync13(vendorDir, { recursive: true });
|
|
19247
|
-
const tmpDir =
|
|
19361
|
+
const tmpDir = join35(buildDir, "_svelte_vendor_tmp");
|
|
19248
19362
|
mkdirSync13(tmpDir, { recursive: true });
|
|
19249
19363
|
const entrypoints = await Promise.all(specifiers.map(async (specifier) => {
|
|
19250
19364
|
const safeName = toSafeFileName4(specifier);
|
|
19251
|
-
const entryPath =
|
|
19365
|
+
const entryPath = join35(tmpDir, `${safeName}.ts`);
|
|
19252
19366
|
await Bun.write(entryPath, `export * from '${specifier}';
|
|
19253
19367
|
`);
|
|
19254
19368
|
return entryPath;
|
|
@@ -19298,7 +19412,7 @@ __export(exports_rewriteImportsPlugin, {
|
|
|
19298
19412
|
buildWithImportRewrite: () => buildWithImportRewrite
|
|
19299
19413
|
});
|
|
19300
19414
|
import { readdir as readdir3 } from "fs/promises";
|
|
19301
|
-
import { join as
|
|
19415
|
+
import { join as join36 } from "path";
|
|
19302
19416
|
var escapeRegex2 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), jsRewriteImports = (content, replacements) => {
|
|
19303
19417
|
let result = content;
|
|
19304
19418
|
for (const [specifier, webPath] of replacements) {
|
|
@@ -19427,7 +19541,7 @@ ${content}`;
|
|
|
19427
19541
|
const entries = await readdir3(dir);
|
|
19428
19542
|
for (const entry of entries) {
|
|
19429
19543
|
if (entry.endsWith(".js"))
|
|
19430
|
-
allFiles.push(
|
|
19544
|
+
allFiles.push(join36(dir, entry));
|
|
19431
19545
|
}
|
|
19432
19546
|
} catch {}
|
|
19433
19547
|
}
|
|
@@ -19469,14 +19583,14 @@ var init_rewriteImportsPlugin = __esm(() => {
|
|
|
19469
19583
|
import {
|
|
19470
19584
|
copyFileSync as copyFileSync2,
|
|
19471
19585
|
cpSync,
|
|
19472
|
-
existsSync as
|
|
19586
|
+
existsSync as existsSync27,
|
|
19473
19587
|
mkdirSync as mkdirSync14,
|
|
19474
|
-
readFileSync as
|
|
19588
|
+
readFileSync as readFileSync20,
|
|
19475
19589
|
rmSync as rmSync2,
|
|
19476
19590
|
statSync as statSync3,
|
|
19477
19591
|
writeFileSync as writeFileSync11
|
|
19478
19592
|
} from "fs";
|
|
19479
|
-
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";
|
|
19480
19594
|
import { cwd, env as env3, exit } from "process";
|
|
19481
19595
|
var {build: bunBuild7, Glob: Glob8 } = globalThis.Bun;
|
|
19482
19596
|
var isDev2, isBuildTraceEnabled = () => {
|
|
@@ -19554,8 +19668,8 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
19554
19668
|
mkdirSync14(htmxDestDir, { recursive: true });
|
|
19555
19669
|
const glob = new Glob8("htmx*.min.js");
|
|
19556
19670
|
for (const relPath of glob.scanSync({ cwd: htmxDir })) {
|
|
19557
|
-
const src =
|
|
19558
|
-
const dest =
|
|
19671
|
+
const src = join37(htmxDir, relPath);
|
|
19672
|
+
const dest = join37(htmxDestDir, "htmx.min.js");
|
|
19559
19673
|
copyFileSync2(src, dest);
|
|
19560
19674
|
return;
|
|
19561
19675
|
}
|
|
@@ -19599,7 +19713,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
19599
19713
|
addWorkerPathIfExists(file5, relPath, workerPaths);
|
|
19600
19714
|
}
|
|
19601
19715
|
}, collectWorkerPathsFromFile = (file5, patterns, workerPaths) => {
|
|
19602
|
-
const content =
|
|
19716
|
+
const content = readFileSync20(file5, "utf-8");
|
|
19603
19717
|
for (const pattern of patterns) {
|
|
19604
19718
|
collectWorkerPathsFromContent(content, pattern, file5, workerPaths);
|
|
19605
19719
|
}
|
|
@@ -19630,7 +19744,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
19630
19744
|
vuePagesPath
|
|
19631
19745
|
}) => {
|
|
19632
19746
|
const { readdirSync: readDir } = await import("fs");
|
|
19633
|
-
const devIndexDir =
|
|
19747
|
+
const devIndexDir = join37(buildPath, "_src_indexes");
|
|
19634
19748
|
mkdirSync14(devIndexDir, { recursive: true });
|
|
19635
19749
|
if (reactIndexesPath && reactPagesPath) {
|
|
19636
19750
|
copyReactDevIndexes(reactIndexesPath, reactPagesPath, devIndexDir, readDir);
|
|
@@ -19642,41 +19756,41 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
19642
19756
|
copyVueDevIndexes(vueDir, vuePagesPath, vueEntries, devIndexDir);
|
|
19643
19757
|
}
|
|
19644
19758
|
}, copyReactDevIndexes = (reactIndexesPath, reactPagesPath, devIndexDir, readDir) => {
|
|
19645
|
-
if (!
|
|
19759
|
+
if (!existsSync27(reactIndexesPath)) {
|
|
19646
19760
|
return;
|
|
19647
19761
|
}
|
|
19648
19762
|
const indexFiles = readDir(reactIndexesPath).filter((file5) => file5.endsWith(".tsx"));
|
|
19649
19763
|
const pagesRel = relative15(process.cwd(), resolve29(reactPagesPath)).replace(/\\/g, "/");
|
|
19650
19764
|
for (const file5 of indexFiles) {
|
|
19651
|
-
let content =
|
|
19765
|
+
let content = readFileSync20(join37(reactIndexesPath, file5), "utf-8");
|
|
19652
19766
|
content = content.replace(/from\s*['"]([^'"]*\/pages\/([^'"]+))['"]/g, (_match, _fullPath, componentName) => `from '/@src/${pagesRel}/${componentName}'`);
|
|
19653
|
-
writeFileSync11(
|
|
19767
|
+
writeFileSync11(join37(devIndexDir, file5), content);
|
|
19654
19768
|
}
|
|
19655
19769
|
}, copySvelteDevIndexes = (svelteDir, sveltePagesPath, svelteEntries, devIndexDir) => {
|
|
19656
|
-
const svelteIndexDir =
|
|
19770
|
+
const svelteIndexDir = join37(getFrameworkGeneratedDir("svelte"), "indexes");
|
|
19657
19771
|
const sveltePageEntries = svelteEntries.filter((file5) => resolve29(file5).startsWith(resolve29(sveltePagesPath)));
|
|
19658
19772
|
for (const entry of sveltePageEntries) {
|
|
19659
19773
|
const name = basename11(entry).replace(/\.svelte(\.(ts|js))?$/, "");
|
|
19660
|
-
const indexFile =
|
|
19661
|
-
if (!
|
|
19774
|
+
const indexFile = join37(svelteIndexDir, "pages", `${name}.js`);
|
|
19775
|
+
if (!existsSync27(indexFile))
|
|
19662
19776
|
continue;
|
|
19663
|
-
let content =
|
|
19777
|
+
let content = readFileSync20(indexFile, "utf-8");
|
|
19664
19778
|
const srcRel = relative15(process.cwd(), resolve29(entry)).replace(/\\/g, "/");
|
|
19665
19779
|
content = content.replace(/import\s+Component\s+from\s+['"]([^'"]+)['"]/, `import Component from "/@src/${srcRel}"`);
|
|
19666
|
-
writeFileSync11(
|
|
19780
|
+
writeFileSync11(join37(devIndexDir, `${name}.svelte.js`), content);
|
|
19667
19781
|
}
|
|
19668
19782
|
}, copyVueDevIndexes = (vueDir, vuePagesPath, vueEntries, devIndexDir) => {
|
|
19669
|
-
const vueIndexDir =
|
|
19783
|
+
const vueIndexDir = join37(getFrameworkGeneratedDir("vue"), "indexes");
|
|
19670
19784
|
const vuePageEntries = vueEntries.filter((file5) => resolve29(file5).startsWith(resolve29(vuePagesPath)));
|
|
19671
19785
|
for (const entry of vuePageEntries) {
|
|
19672
19786
|
const name = basename11(entry, ".vue");
|
|
19673
|
-
const indexFile =
|
|
19674
|
-
if (!
|
|
19787
|
+
const indexFile = join37(vueIndexDir, `${name}.js`);
|
|
19788
|
+
if (!existsSync27(indexFile))
|
|
19675
19789
|
continue;
|
|
19676
|
-
let content =
|
|
19790
|
+
let content = readFileSync20(indexFile, "utf-8");
|
|
19677
19791
|
const srcRel = relative15(process.cwd(), resolve29(entry)).replace(/\\/g, "/");
|
|
19678
19792
|
content = content.replace(/import\s+Comp(?:\s*,\s*\*\s+as\s+\w+)?\s+from\s+['"]([^'"]+)['"]/, (match) => match.replace(/from\s+['"][^'"]+['"]/, `from "/@src/${srcRel}"`));
|
|
19679
|
-
writeFileSync11(
|
|
19793
|
+
writeFileSync11(join37(devIndexDir, `${name}.vue.js`), content);
|
|
19680
19794
|
}
|
|
19681
19795
|
}, resolveVueRuntimeId = (content, firstUseName, outputPath, projectRoot) => {
|
|
19682
19796
|
const varIdx = content.indexOf(`var ${firstUseName} =`);
|
|
@@ -19724,7 +19838,7 @@ var isDev2, isBuildTraceEnabled = () => {
|
|
|
19724
19838
|
}
|
|
19725
19839
|
return result;
|
|
19726
19840
|
}, VUE_HMR_RUNTIME, injectVueComposableTracking = (outputPath, projectRoot) => {
|
|
19727
|
-
let content =
|
|
19841
|
+
let content = readFileSync20(outputPath, "utf-8");
|
|
19728
19842
|
const usePattern = /^var\s+(use[A-Z]\w*)\s*=/gm;
|
|
19729
19843
|
const useNames = [];
|
|
19730
19844
|
let match;
|
|
@@ -19774,7 +19888,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19774
19888
|
}, rewriteUrlReferences = (outputPaths, urlFileMap) => {
|
|
19775
19889
|
const urlPattern = /new\s+URL\(\s*["'](\.\.?\/[^"']+)["']\s*,\s*import\.meta\.url\s*\)/g;
|
|
19776
19890
|
for (const outputPath of outputPaths) {
|
|
19777
|
-
let content =
|
|
19891
|
+
let content = readFileSync20(outputPath, "utf-8");
|
|
19778
19892
|
let changed = false;
|
|
19779
19893
|
content = content.replace(urlPattern, (_match, relPath) => {
|
|
19780
19894
|
const targetName = basename11(relPath);
|
|
@@ -19899,10 +20013,10 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19899
20013
|
restoreTracePhase();
|
|
19900
20014
|
return;
|
|
19901
20015
|
}
|
|
19902
|
-
const traceDir =
|
|
20016
|
+
const traceDir = join37(buildPath2, ".absolute-trace");
|
|
19903
20017
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
|
|
19904
20018
|
mkdirSync14(traceDir, { recursive: true });
|
|
19905
|
-
writeFileSync11(
|
|
20019
|
+
writeFileSync11(join37(traceDir, `build-trace-${timestamp}.json`), JSON.stringify({
|
|
19906
20020
|
events: traceEvents,
|
|
19907
20021
|
frameworks: traceFrameworkNames,
|
|
19908
20022
|
generatedAt: new Date().toISOString(),
|
|
@@ -19933,15 +20047,15 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19933
20047
|
const stylesPath = typeof stylesConfig === "string" ? stylesConfig : stylesConfig?.path;
|
|
19934
20048
|
const stylesIgnore = typeof stylesConfig === "object" ? stylesConfig.ignore : undefined;
|
|
19935
20049
|
const stylesDir = stylesPath && validateSafePath(stylesPath, projectRoot);
|
|
19936
|
-
const reactIndexesPath = reactDir &&
|
|
19937
|
-
const reactPagesPath = reactDir &&
|
|
19938
|
-
const htmlPagesPath = htmlDir &&
|
|
19939
|
-
const htmlScriptsPath = htmlDir &&
|
|
19940
|
-
const sveltePagesPath = svelteDir &&
|
|
19941
|
-
const vuePagesPath = vueDir &&
|
|
19942
|
-
const htmxPagesPath = htmxDir &&
|
|
19943
|
-
const angularPagesPath = angularDir &&
|
|
19944
|
-
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");
|
|
19945
20059
|
const frontends = [
|
|
19946
20060
|
reactDir,
|
|
19947
20061
|
htmlDir,
|
|
@@ -19972,7 +20086,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
19972
20086
|
const sourceClientRoots = [
|
|
19973
20087
|
htmlDir,
|
|
19974
20088
|
htmxDir,
|
|
19975
|
-
islandBootstrapPath &&
|
|
20089
|
+
islandBootstrapPath && dirname21(islandBootstrapPath)
|
|
19976
20090
|
].filter((dir) => Boolean(dir));
|
|
19977
20091
|
const usesGenerated = Boolean(reactDir) || Boolean(svelteDir) || Boolean(vueDir) || Boolean(angularDir);
|
|
19978
20092
|
if (usesGenerated)
|
|
@@ -20000,8 +20114,8 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20000
20114
|
const [firstEntry] = serverDirMap;
|
|
20001
20115
|
if (!firstEntry)
|
|
20002
20116
|
throw new Error("Expected at least one server directory entry");
|
|
20003
|
-
serverRoot =
|
|
20004
|
-
serverOutDir =
|
|
20117
|
+
serverRoot = join37(firstEntry.dir, firstEntry.subdir);
|
|
20118
|
+
serverOutDir = join37(buildPath, basename11(firstEntry.dir));
|
|
20005
20119
|
} else if (serverDirMap.length > 1) {
|
|
20006
20120
|
serverRoot = commonAncestor(serverDirMap.map((entry) => entry.dir), projectRoot);
|
|
20007
20121
|
serverOutDir = buildPath;
|
|
@@ -20029,7 +20143,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20029
20143
|
await tracePhase("react/index-generation", () => generateReactIndexFiles(reactPagesPath, reactIndexesPath, hmr));
|
|
20030
20144
|
}
|
|
20031
20145
|
if (assetsPath && (!isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/assets/")))) {
|
|
20032
|
-
await tracePhase("assets/copy", () => cpSync(assetsPath,
|
|
20146
|
+
await tracePhase("assets/copy", () => cpSync(assetsPath, join37(buildPath, "assets"), {
|
|
20033
20147
|
force: true,
|
|
20034
20148
|
recursive: true
|
|
20035
20149
|
}));
|
|
@@ -20139,11 +20253,11 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20139
20253
|
}
|
|
20140
20254
|
}
|
|
20141
20255
|
if (htmlDefaults.error || htmlDefaults.notFound || htmlDefaults.loading || Object.keys(htmlPages).length > 0) {
|
|
20142
|
-
const htmlConventionsOutDir =
|
|
20256
|
+
const htmlConventionsOutDir = join37(buildPath, "conventions", "html");
|
|
20143
20257
|
mkdirSync14(htmlConventionsOutDir, { recursive: true });
|
|
20144
20258
|
const htmlPathRemap = new Map;
|
|
20145
20259
|
for (const sourcePath of htmlConventionSources) {
|
|
20146
|
-
const dest =
|
|
20260
|
+
const dest = join37(htmlConventionsOutDir, basename11(sourcePath));
|
|
20147
20261
|
cpSync(sourcePath, dest, { force: true });
|
|
20148
20262
|
htmlPathRemap.set(sourcePath, dest);
|
|
20149
20263
|
}
|
|
@@ -20186,7 +20300,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20186
20300
|
const reactEntries = isIncremental && reactIndexesPath && reactPagesPath ? filterToIncrementalEntries(allReactEntries, (entry) => {
|
|
20187
20301
|
if (entry.startsWith(resolve29(reactIndexesPath))) {
|
|
20188
20302
|
const pageName = basename11(entry, ".tsx");
|
|
20189
|
-
return
|
|
20303
|
+
return join37(reactPagesPath, `${pageName}.tsx`);
|
|
20190
20304
|
}
|
|
20191
20305
|
return null;
|
|
20192
20306
|
}) : allReactEntries;
|
|
@@ -20252,14 +20366,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20252
20366
|
try {
|
|
20253
20367
|
const { primeComponentFingerprint: primeComponentFingerprint2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
20254
20368
|
const { readdir: readdir4 } = await import("fs/promises");
|
|
20255
|
-
const { join:
|
|
20369
|
+
const { join: join38 } = await import("path");
|
|
20256
20370
|
const walk = async (dir) => {
|
|
20257
20371
|
const entries = await readdir4(dir, {
|
|
20258
20372
|
withFileTypes: true
|
|
20259
20373
|
});
|
|
20260
20374
|
const out = [];
|
|
20261
20375
|
for (const entry of entries) {
|
|
20262
|
-
const full =
|
|
20376
|
+
const full = join38(dir, entry.name);
|
|
20263
20377
|
if (entry.isDirectory()) {
|
|
20264
20378
|
out.push(...await walk(full));
|
|
20265
20379
|
} else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
|
|
@@ -20324,7 +20438,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20324
20438
|
const compileReactConventions = async () => {
|
|
20325
20439
|
if (reactConventionSources.length === 0)
|
|
20326
20440
|
return emptyStringArray;
|
|
20327
|
-
const destDir =
|
|
20441
|
+
const destDir = join37(buildPath, "conventions", "react");
|
|
20328
20442
|
rmSync2(destDir, { force: true, recursive: true });
|
|
20329
20443
|
mkdirSync14(destDir, { recursive: true });
|
|
20330
20444
|
const destPaths = [];
|
|
@@ -20340,7 +20454,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20340
20454
|
naming: `${idx}-[name].[ext]`,
|
|
20341
20455
|
outdir: destDir,
|
|
20342
20456
|
plugins: [stylePreprocessorPlugin2],
|
|
20343
|
-
root:
|
|
20457
|
+
root: dirname21(source),
|
|
20344
20458
|
target: "bun",
|
|
20345
20459
|
throw: false,
|
|
20346
20460
|
tsconfig: "./tsconfig.json"
|
|
@@ -20368,7 +20482,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20368
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 }
|
|
20369
20483
|
]);
|
|
20370
20484
|
const bundleConventionFiles = async (framework, compiledPaths) => {
|
|
20371
|
-
const destDir =
|
|
20485
|
+
const destDir = join37(buildPath, "conventions", framework);
|
|
20372
20486
|
rmSync2(destDir, { force: true, recursive: true });
|
|
20373
20487
|
mkdirSync14(destDir, { recursive: true });
|
|
20374
20488
|
const destPaths = [];
|
|
@@ -20442,7 +20556,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20442
20556
|
}
|
|
20443
20557
|
})) : {
|
|
20444
20558
|
entries: [],
|
|
20445
|
-
generatedRoot:
|
|
20559
|
+
generatedRoot: join37(buildPath, "_island_entries")
|
|
20446
20560
|
};
|
|
20447
20561
|
const islandClientEntryPoints = islandEntryResult.entries.map((entry) => entry.entryPath);
|
|
20448
20562
|
if (serverEntryPoints.length === 0 && reactClientEntryPoints.length === 0 && nonReactClientEntryPoints.length === 0 && islandClientEntryPoints.length === 0 && htmxDir === undefined && htmlDir === undefined) {
|
|
@@ -20478,7 +20592,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20478
20592
|
return {};
|
|
20479
20593
|
}
|
|
20480
20594
|
if (hmr && reactIndexesPath && reactClientEntryPoints.length > 0) {
|
|
20481
|
-
const refreshEntry =
|
|
20595
|
+
const refreshEntry = join37(reactIndexesPath, "_refresh.tsx");
|
|
20482
20596
|
if (!reactClientEntryPoints.includes(refreshEntry))
|
|
20483
20597
|
reactClientEntryPoints.push(refreshEntry);
|
|
20484
20598
|
}
|
|
@@ -20580,19 +20694,19 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20580
20694
|
throw: false
|
|
20581
20695
|
}, resolveBunBuildOverride(bunBuildConfig, "reactClient")) : undefined;
|
|
20582
20696
|
if (reactDir && reactClientEntryPoints.length > 0) {
|
|
20583
|
-
rmSync2(
|
|
20697
|
+
rmSync2(join37(buildPath, "react", "generated", "indexes"), {
|
|
20584
20698
|
force: true,
|
|
20585
20699
|
recursive: true
|
|
20586
20700
|
});
|
|
20587
20701
|
}
|
|
20588
20702
|
if (angularDir && angularClientPaths.length > 0) {
|
|
20589
|
-
rmSync2(
|
|
20703
|
+
rmSync2(join37(buildPath, "angular", "indexes"), {
|
|
20590
20704
|
force: true,
|
|
20591
20705
|
recursive: true
|
|
20592
20706
|
});
|
|
20593
20707
|
}
|
|
20594
20708
|
if (islandClientEntryPoints.length > 0) {
|
|
20595
|
-
rmSync2(
|
|
20709
|
+
rmSync2(join37(buildPath, "islands"), {
|
|
20596
20710
|
force: true,
|
|
20597
20711
|
recursive: true
|
|
20598
20712
|
});
|
|
@@ -20681,7 +20795,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20681
20795
|
globalCssEntries.length > 0 ? tracePhase("bun/global-css", () => bunBuild7(mergeBunBuildConfig({
|
|
20682
20796
|
entrypoints: globalCssEntries,
|
|
20683
20797
|
naming: `[dir]/[name].[hash].[ext]`,
|
|
20684
|
-
outdir: stylesDir ?
|
|
20798
|
+
outdir: stylesDir ? join37(buildPath, basename11(stylesDir)) : buildPath,
|
|
20685
20799
|
plugins: [stylePreprocessorPlugin2],
|
|
20686
20800
|
root: stylesDir || clientRoot,
|
|
20687
20801
|
target: "browser",
|
|
@@ -20690,7 +20804,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20690
20804
|
vueCssPaths.length > 0 ? tracePhase("bun/vue-css", () => bunBuild7(mergeBunBuildConfig({
|
|
20691
20805
|
entrypoints: vueCssPaths,
|
|
20692
20806
|
naming: `[name].[hash].[ext]`,
|
|
20693
|
-
outdir:
|
|
20807
|
+
outdir: join37(buildPath, assetsPath ? basename11(assetsPath) : "assets", "css"),
|
|
20694
20808
|
target: "browser",
|
|
20695
20809
|
throw: false
|
|
20696
20810
|
}, resolveBunBuildOverride(bunBuildConfig, "vueCss")))) : undefined
|
|
@@ -20764,7 +20878,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20764
20878
|
if (serverOutputs.length > 0 && angularServerVendorPaths2 && Object.keys(angularServerVendorPaths2).length > 0) {
|
|
20765
20879
|
const { rewriteBuildOutputsWith: rewriteBuildOutputsWith2 } = await Promise.resolve().then(() => (init_rewriteImportsPlugin(), exports_rewriteImportsPlugin));
|
|
20766
20880
|
await tracePhase("postprocess/server-angular-vendor-imports", () => rewriteBuildOutputsWith2(serverOutputs, (artifact) => {
|
|
20767
|
-
const fileDir =
|
|
20881
|
+
const fileDir = dirname21(artifact.path);
|
|
20768
20882
|
const relativePaths = {};
|
|
20769
20883
|
for (const [specifier, absolute] of Object.entries(angularServerVendorPaths2)) {
|
|
20770
20884
|
const rel = relative15(fileDir, absolute);
|
|
@@ -20850,7 +20964,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20850
20964
|
const injectHMRIntoHTMLFile = (filePath, framework) => {
|
|
20851
20965
|
if (!hmrClientBundle)
|
|
20852
20966
|
return;
|
|
20853
|
-
let html =
|
|
20967
|
+
let html = readFileSync20(filePath, "utf-8");
|
|
20854
20968
|
if (html.includes("data-hmr-client"))
|
|
20855
20969
|
return;
|
|
20856
20970
|
const tag = `<script>window.__HMR_FRAMEWORK__="${framework}";</script><script data-hmr-client>${hmrClientBundle}</script>`;
|
|
@@ -20861,7 +20975,7 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20861
20975
|
const processHtmlPages = async () => {
|
|
20862
20976
|
if (!(htmlDir && htmlPagesPath))
|
|
20863
20977
|
return;
|
|
20864
|
-
const outputHtmlPages = isSingle ?
|
|
20978
|
+
const outputHtmlPages = isSingle ? join37(buildPath, "pages") : join37(buildPath, basename11(htmlDir), "pages");
|
|
20865
20979
|
mkdirSync14(outputHtmlPages, { recursive: true });
|
|
20866
20980
|
cpSync(htmlPagesPath, outputHtmlPages, {
|
|
20867
20981
|
force: true,
|
|
@@ -20886,14 +21000,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20886
21000
|
const processHtmxPages = async () => {
|
|
20887
21001
|
if (!(htmxDir && htmxPagesPath))
|
|
20888
21002
|
return;
|
|
20889
|
-
const outputHtmxPages = isSingle ?
|
|
21003
|
+
const outputHtmxPages = isSingle ? join37(buildPath, "pages") : join37(buildPath, basename11(htmxDir), "pages");
|
|
20890
21004
|
mkdirSync14(outputHtmxPages, { recursive: true });
|
|
20891
21005
|
cpSync(htmxPagesPath, outputHtmxPages, {
|
|
20892
21006
|
force: true,
|
|
20893
21007
|
recursive: true
|
|
20894
21008
|
});
|
|
20895
21009
|
if (shouldCopyHtmx) {
|
|
20896
|
-
const htmxDestDir = isSingle ? buildPath :
|
|
21010
|
+
const htmxDestDir = isSingle ? buildPath : join37(buildPath, basename11(htmxDir));
|
|
20897
21011
|
copyHtmxVendor(htmxDir, htmxDestDir);
|
|
20898
21012
|
}
|
|
20899
21013
|
if (shouldUpdateHtmxAssetPaths) {
|
|
@@ -20958,9 +21072,9 @@ ${content.slice(firstUseIdx)}`;
|
|
|
20958
21072
|
writeBuildTrace(buildPath);
|
|
20959
21073
|
return { conventions: conventionsMap, manifest };
|
|
20960
21074
|
}
|
|
20961
|
-
writeFileSync11(
|
|
21075
|
+
writeFileSync11(join37(buildPath, "manifest.json"), JSON.stringify(manifest, null, "\t"));
|
|
20962
21076
|
if (Object.keys(conventionsMap).length > 0) {
|
|
20963
|
-
writeFileSync11(
|
|
21077
|
+
writeFileSync11(join37(buildPath, "conventions.json"), JSON.stringify(conventionsMap, null, "\t"));
|
|
20964
21078
|
}
|
|
20965
21079
|
writeBuildTrace(buildPath);
|
|
20966
21080
|
if (mode === "production") {
|
|
@@ -21081,8 +21195,8 @@ var init_build = __esm(() => {
|
|
|
21081
21195
|
});
|
|
21082
21196
|
|
|
21083
21197
|
// src/build/buildEmberVendor.ts
|
|
21084
|
-
import { mkdirSync as mkdirSync15, existsSync as
|
|
21085
|
-
import { join as
|
|
21198
|
+
import { mkdirSync as mkdirSync15, existsSync as existsSync28 } from "fs";
|
|
21199
|
+
import { join as join38 } from "path";
|
|
21086
21200
|
import { rm as rm9 } from "fs/promises";
|
|
21087
21201
|
var {build: bunBuild8 } = globalThis.Bun;
|
|
21088
21202
|
var toSafeFileName5 = (specifier) => specifier.replace(/^@/, "").replace(/\//g, "_"), generateMacrosShim = () => `// Generated shim for @embroider/macros \u2014 provides minimal runtime
|
|
@@ -21134,8 +21248,8 @@ export const importSync = (specifier) => {
|
|
|
21134
21248
|
if (standaloneSpecifiers.has(specifier)) {
|
|
21135
21249
|
return { resolveTo: specifier, specifier };
|
|
21136
21250
|
}
|
|
21137
|
-
const emberInternalPath =
|
|
21138
|
-
if (!
|
|
21251
|
+
const emberInternalPath = join38(cwd2, "node_modules/ember-source/dist/packages", specifier, "index.js");
|
|
21252
|
+
if (!existsSync28(emberInternalPath)) {
|
|
21139
21253
|
throw new Error(`Ember vendor build: cannot find ${specifier} at ${emberInternalPath}. ` + `Is ember-source installed and at least 6.12?`);
|
|
21140
21254
|
}
|
|
21141
21255
|
return { resolveTo: emberInternalPath, specifier };
|
|
@@ -21166,24 +21280,24 @@ export const importSync = (specifier) => {
|
|
|
21166
21280
|
if (standalonePackages.has(args.path)) {
|
|
21167
21281
|
return;
|
|
21168
21282
|
}
|
|
21169
|
-
const internal =
|
|
21170
|
-
if (
|
|
21283
|
+
const internal = join38(cwd2, "node_modules/ember-source/dist/packages", args.path, "index.js");
|
|
21284
|
+
if (existsSync28(internal)) {
|
|
21171
21285
|
return { path: internal };
|
|
21172
21286
|
}
|
|
21173
21287
|
return;
|
|
21174
21288
|
});
|
|
21175
21289
|
}
|
|
21176
21290
|
}), buildEmberVendor = async (buildDir, cwd2 = process.cwd()) => {
|
|
21177
|
-
const vendorDir =
|
|
21291
|
+
const vendorDir = join38(buildDir, "ember", "vendor");
|
|
21178
21292
|
mkdirSync15(vendorDir, { recursive: true });
|
|
21179
|
-
const tmpDir =
|
|
21293
|
+
const tmpDir = join38(buildDir, "_ember_vendor_tmp");
|
|
21180
21294
|
mkdirSync15(tmpDir, { recursive: true });
|
|
21181
|
-
const macrosShimPath =
|
|
21295
|
+
const macrosShimPath = join38(tmpDir, "embroider_macros_shim.js");
|
|
21182
21296
|
await Bun.write(macrosShimPath, generateMacrosShim());
|
|
21183
21297
|
const resolutions = REQUIRED_EMBER_SPECIFIERS.map((specifier) => resolveEmberSpecifier(specifier, cwd2));
|
|
21184
21298
|
const entrypoints = await Promise.all(resolutions.map(async (resolution) => {
|
|
21185
21299
|
const safeName = toSafeFileName5(resolution.specifier);
|
|
21186
|
-
const entryPath =
|
|
21300
|
+
const entryPath = join38(tmpDir, `${safeName}.js`);
|
|
21187
21301
|
const source = resolution.specifier === "@embroider/macros" ? `export * from ${JSON.stringify(macrosShimPath)};
|
|
21188
21302
|
` : generateVendorEntrySource2(resolution);
|
|
21189
21303
|
await Bun.write(entryPath, source);
|
|
@@ -21236,7 +21350,7 @@ __export(exports_dependencyGraph, {
|
|
|
21236
21350
|
buildInitialDependencyGraph: () => buildInitialDependencyGraph,
|
|
21237
21351
|
addFileToGraph: () => addFileToGraph
|
|
21238
21352
|
});
|
|
21239
|
-
import { existsSync as
|
|
21353
|
+
import { existsSync as existsSync29, readFileSync as readFileSync21 } from "fs";
|
|
21240
21354
|
var {Glob: Glob9 } = globalThis.Bun;
|
|
21241
21355
|
import { resolve as resolve30 } from "path";
|
|
21242
21356
|
var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath) => {
|
|
@@ -21266,10 +21380,10 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
21266
21380
|
];
|
|
21267
21381
|
for (const ext of extensions) {
|
|
21268
21382
|
const withExt = normalized + ext;
|
|
21269
|
-
if (
|
|
21383
|
+
if (existsSync29(withExt))
|
|
21270
21384
|
return withExt;
|
|
21271
21385
|
}
|
|
21272
|
-
if (
|
|
21386
|
+
if (existsSync29(normalized))
|
|
21273
21387
|
return normalized;
|
|
21274
21388
|
return null;
|
|
21275
21389
|
}, clearExistingDependents = (graph, normalizedPath) => {
|
|
@@ -21284,7 +21398,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
21284
21398
|
}
|
|
21285
21399
|
}, addFileToGraph = (graph, filePath) => {
|
|
21286
21400
|
const normalizedPath = resolve30(filePath);
|
|
21287
|
-
if (!
|
|
21401
|
+
if (!existsSync29(normalizedPath))
|
|
21288
21402
|
return;
|
|
21289
21403
|
const dependencies = extractDependencies(normalizedPath);
|
|
21290
21404
|
clearExistingDependents(graph, normalizedPath);
|
|
@@ -21310,7 +21424,7 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
21310
21424
|
}, IGNORED_SEGMENTS, buildInitialDependencyGraph = (graph, directories) => {
|
|
21311
21425
|
const processedFiles = new Set;
|
|
21312
21426
|
const glob = new Glob9("**/*.{ts,tsx,js,jsx,vue,svelte,html,htm}");
|
|
21313
|
-
const resolvedDirs = directories.map((dir) => resolve30(dir)).filter((dir) =>
|
|
21427
|
+
const resolvedDirs = directories.map((dir) => resolve30(dir)).filter((dir) => existsSync29(dir));
|
|
21314
21428
|
const allFiles = resolvedDirs.flatMap((dir) => Array.from(glob.scanSync({ absolute: true, cwd: dir })));
|
|
21315
21429
|
for (const file5 of allFiles) {
|
|
21316
21430
|
const fullPath = resolve30(file5);
|
|
@@ -21407,15 +21521,15 @@ var emptyDependencyGraph, tsTranspiler, jsTranspiler, loaderForFile = (filePath)
|
|
|
21407
21521
|
const lowerPath = filePath.toLowerCase();
|
|
21408
21522
|
const isSvelteOrVue = lowerPath.endsWith(".svelte") || lowerPath.endsWith(".vue");
|
|
21409
21523
|
if (loader === "html") {
|
|
21410
|
-
const content =
|
|
21524
|
+
const content = readFileSync21(filePath, "utf-8");
|
|
21411
21525
|
return extractHtmlDependencies(filePath, content);
|
|
21412
21526
|
}
|
|
21413
21527
|
if (loader === "tsx" || loader === "js") {
|
|
21414
|
-
const content =
|
|
21528
|
+
const content = readFileSync21(filePath, "utf-8");
|
|
21415
21529
|
return extractJsDependencies(filePath, content, loader);
|
|
21416
21530
|
}
|
|
21417
21531
|
if (isSvelteOrVue) {
|
|
21418
|
-
const content =
|
|
21532
|
+
const content = readFileSync21(filePath, "utf-8");
|
|
21419
21533
|
return extractSvelteVueDependencies(filePath, content);
|
|
21420
21534
|
}
|
|
21421
21535
|
return [];
|
|
@@ -21558,8 +21672,8 @@ var init_clientManager = __esm(() => {
|
|
|
21558
21672
|
});
|
|
21559
21673
|
|
|
21560
21674
|
// src/dev/pathUtils.ts
|
|
21561
|
-
import { existsSync as
|
|
21562
|
-
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";
|
|
21563
21677
|
var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
21564
21678
|
if (shouldIgnorePath(filePath, resolved)) {
|
|
21565
21679
|
return "ignored";
|
|
@@ -21658,7 +21772,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
21658
21772
|
}
|
|
21659
21773
|
let source;
|
|
21660
21774
|
try {
|
|
21661
|
-
source =
|
|
21775
|
+
source = readFileSync22(full, "utf8");
|
|
21662
21776
|
} catch {
|
|
21663
21777
|
continue;
|
|
21664
21778
|
}
|
|
@@ -21687,10 +21801,10 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
21687
21801
|
refs.push(strMatch[1]);
|
|
21688
21802
|
}
|
|
21689
21803
|
}
|
|
21690
|
-
const componentDir =
|
|
21804
|
+
const componentDir = dirname22(full);
|
|
21691
21805
|
for (const ref of refs) {
|
|
21692
21806
|
const refAbs = normalizePath(resolve32(componentDir, ref));
|
|
21693
|
-
const refDir = normalizePath(
|
|
21807
|
+
const refDir = normalizePath(dirname22(refAbs));
|
|
21694
21808
|
if (refDir === angularRootNormalized || refDir.startsWith(angularRootNormalized + "/")) {
|
|
21695
21809
|
continue;
|
|
21696
21810
|
}
|
|
@@ -21732,7 +21846,7 @@ var STYLE_EXTENSION_PATTERN2, detectFramework = (filePath, resolved) => {
|
|
|
21732
21846
|
push(cfg.stylesDir);
|
|
21733
21847
|
for (const candidate of ["src", "db", "assets", "styles"]) {
|
|
21734
21848
|
const abs = normalizePath(resolve32(cwd2, candidate));
|
|
21735
|
-
if (
|
|
21849
|
+
if (existsSync30(abs) && !roots.includes(abs))
|
|
21736
21850
|
roots.push(abs);
|
|
21737
21851
|
}
|
|
21738
21852
|
try {
|
|
@@ -21817,8 +21931,8 @@ var init_pathUtils = __esm(() => {
|
|
|
21817
21931
|
|
|
21818
21932
|
// src/dev/fileWatcher.ts
|
|
21819
21933
|
import { watch } from "fs";
|
|
21820
|
-
import { existsSync as
|
|
21821
|
-
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";
|
|
21822
21936
|
var safeRemoveFromGraph = (graph, fullPath) => {
|
|
21823
21937
|
try {
|
|
21824
21938
|
removeFileFromGraph(graph, fullPath);
|
|
@@ -21851,7 +21965,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
21851
21965
|
for (const name of entries) {
|
|
21852
21966
|
if (shouldSkipFilename(name, isStylesDir))
|
|
21853
21967
|
continue;
|
|
21854
|
-
const child =
|
|
21968
|
+
const child = join39(eventDir, name).replace(/\\/g, "/");
|
|
21855
21969
|
let st2;
|
|
21856
21970
|
try {
|
|
21857
21971
|
st2 = statSync4(child);
|
|
@@ -21876,21 +21990,21 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
21876
21990
|
return;
|
|
21877
21991
|
if (shouldSkipFilename(filename, isStylesDir)) {
|
|
21878
21992
|
if (event === "rename") {
|
|
21879
|
-
const eventDir =
|
|
21993
|
+
const eventDir = dirname23(join39(absolutePath, filename)).replace(/\\/g, "/");
|
|
21880
21994
|
atomicRecoveryScan(eventDir);
|
|
21881
21995
|
}
|
|
21882
21996
|
return;
|
|
21883
21997
|
}
|
|
21884
|
-
const fullPath =
|
|
21998
|
+
const fullPath = join39(absolutePath, filename).replace(/\\/g, "/");
|
|
21885
21999
|
if (shouldIgnorePath(fullPath, state.resolvedPaths)) {
|
|
21886
22000
|
return;
|
|
21887
22001
|
}
|
|
21888
|
-
if (event === "rename" && !
|
|
22002
|
+
if (event === "rename" && !existsSync31(fullPath)) {
|
|
21889
22003
|
safeRemoveFromGraph(state.dependencyGraph, fullPath);
|
|
21890
22004
|
onFileChange(fullPath);
|
|
21891
22005
|
return;
|
|
21892
22006
|
}
|
|
21893
|
-
if (
|
|
22007
|
+
if (existsSync31(fullPath)) {
|
|
21894
22008
|
onFileChange(fullPath);
|
|
21895
22009
|
safeAddToGraph(state.dependencyGraph, fullPath);
|
|
21896
22010
|
}
|
|
@@ -21900,7 +22014,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
21900
22014
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
21901
22015
|
paths.forEach((path) => {
|
|
21902
22016
|
const absolutePath = resolve33(path).replace(/\\/g, "/");
|
|
21903
|
-
if (!
|
|
22017
|
+
if (!existsSync31(absolutePath)) {
|
|
21904
22018
|
return;
|
|
21905
22019
|
}
|
|
21906
22020
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -21911,7 +22025,7 @@ var safeRemoveFromGraph = (graph, fullPath) => {
|
|
|
21911
22025
|
const stylesDir = state.resolvedPaths?.stylesDir;
|
|
21912
22026
|
watchPaths.forEach((path) => {
|
|
21913
22027
|
const absolutePath = resolve33(path).replace(/\\/g, "/");
|
|
21914
|
-
if (!
|
|
22028
|
+
if (!existsSync31(absolutePath)) {
|
|
21915
22029
|
return;
|
|
21916
22030
|
}
|
|
21917
22031
|
const isStylesDir = Boolean(stylesDir && absolutePath.startsWith(stylesDir));
|
|
@@ -22033,10 +22147,10 @@ var init_assetStore = __esm(() => {
|
|
|
22033
22147
|
});
|
|
22034
22148
|
|
|
22035
22149
|
// src/dev/fileHashTracker.ts
|
|
22036
|
-
import { readFileSync as
|
|
22150
|
+
import { readFileSync as readFileSync23 } from "fs";
|
|
22037
22151
|
var computeFileHash = (filePath) => {
|
|
22038
22152
|
try {
|
|
22039
|
-
const fileContent =
|
|
22153
|
+
const fileContent = readFileSync23(filePath);
|
|
22040
22154
|
return Number(Bun.hash(fileContent));
|
|
22041
22155
|
} catch {
|
|
22042
22156
|
return UNFOUND_INDEX;
|
|
@@ -22250,9 +22364,9 @@ __export(exports_resolveOwningComponents, {
|
|
|
22250
22364
|
resolveDescendantsOfParent: () => resolveDescendantsOfParent,
|
|
22251
22365
|
invalidateResourceIndex: () => invalidateResourceIndex
|
|
22252
22366
|
});
|
|
22253
|
-
import { readdirSync as readdirSync6, readFileSync as
|
|
22254
|
-
import { dirname as
|
|
22255
|
-
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";
|
|
22256
22370
|
var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") || file5.endsWith(".tsx"), walkAngularSourceFiles = (root) => {
|
|
22257
22371
|
const out = [];
|
|
22258
22372
|
const visit = (dir) => {
|
|
@@ -22266,7 +22380,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
22266
22380
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
22267
22381
|
continue;
|
|
22268
22382
|
}
|
|
22269
|
-
const full =
|
|
22383
|
+
const full = join40(dir, entry.name);
|
|
22270
22384
|
if (entry.isDirectory()) {
|
|
22271
22385
|
visit(full);
|
|
22272
22386
|
} else if (entry.isFile() && isAngularSourceFile(entry.name)) {
|
|
@@ -22278,13 +22392,13 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
22278
22392
|
return out;
|
|
22279
22393
|
}, getStringPropertyValue = (obj, name) => {
|
|
22280
22394
|
for (const prop of obj.properties) {
|
|
22281
|
-
if (!
|
|
22395
|
+
if (!ts14.isPropertyAssignment(prop))
|
|
22282
22396
|
continue;
|
|
22283
|
-
const propName =
|
|
22397
|
+
const propName = ts14.isIdentifier(prop.name) ? prop.name.text : ts14.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
22284
22398
|
if (propName !== name)
|
|
22285
22399
|
continue;
|
|
22286
22400
|
const init = prop.initializer;
|
|
22287
|
-
if (
|
|
22401
|
+
if (ts14.isStringLiteral(init) || ts14.isNoSubstitutionTemplateLiteral(init)) {
|
|
22288
22402
|
return init.text;
|
|
22289
22403
|
}
|
|
22290
22404
|
}
|
|
@@ -22292,16 +22406,16 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
22292
22406
|
}, getStringArrayProperty = (obj, name) => {
|
|
22293
22407
|
const out = [];
|
|
22294
22408
|
for (const prop of obj.properties) {
|
|
22295
|
-
if (!
|
|
22409
|
+
if (!ts14.isPropertyAssignment(prop))
|
|
22296
22410
|
continue;
|
|
22297
|
-
const propName =
|
|
22411
|
+
const propName = ts14.isIdentifier(prop.name) ? prop.name.text : ts14.isStringLiteral(prop.name) ? prop.name.text : null;
|
|
22298
22412
|
if (propName !== name)
|
|
22299
22413
|
continue;
|
|
22300
22414
|
const init = prop.initializer;
|
|
22301
|
-
if (!
|
|
22415
|
+
if (!ts14.isArrayLiteralExpression(init))
|
|
22302
22416
|
continue;
|
|
22303
22417
|
for (const element of init.elements) {
|
|
22304
|
-
if (
|
|
22418
|
+
if (ts14.isStringLiteral(element) || ts14.isNoSubstitutionTemplateLiteral(element)) {
|
|
22305
22419
|
out.push(element.text);
|
|
22306
22420
|
}
|
|
22307
22421
|
}
|
|
@@ -22310,31 +22424,31 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
22310
22424
|
}, parseDecoratedClasses = (filePath) => {
|
|
22311
22425
|
let source;
|
|
22312
22426
|
try {
|
|
22313
|
-
source =
|
|
22427
|
+
source = readFileSync24(filePath, "utf8");
|
|
22314
22428
|
} catch {
|
|
22315
22429
|
return [];
|
|
22316
22430
|
}
|
|
22317
|
-
const sourceFile =
|
|
22431
|
+
const sourceFile = ts14.createSourceFile(filePath, source, ts14.ScriptTarget.ES2022, true, ts14.ScriptKind.TS);
|
|
22318
22432
|
const out = [];
|
|
22319
22433
|
const visit = (node) => {
|
|
22320
|
-
if (
|
|
22321
|
-
for (const decorator of
|
|
22434
|
+
if (ts14.isClassDeclaration(node) && node.name) {
|
|
22435
|
+
for (const decorator of ts14.getDecorators(node) ?? []) {
|
|
22322
22436
|
const expr = decorator.expression;
|
|
22323
|
-
if (!
|
|
22437
|
+
if (!ts14.isCallExpression(expr))
|
|
22324
22438
|
continue;
|
|
22325
22439
|
const fn2 = expr.expression;
|
|
22326
|
-
if (!
|
|
22440
|
+
if (!ts14.isIdentifier(fn2))
|
|
22327
22441
|
continue;
|
|
22328
22442
|
const kind = ENTITY_DECORATORS[fn2.text];
|
|
22329
22443
|
if (!kind)
|
|
22330
22444
|
continue;
|
|
22331
22445
|
let extendsName = null;
|
|
22332
22446
|
for (const heritage of node.heritageClauses ?? []) {
|
|
22333
|
-
if (heritage.token !==
|
|
22447
|
+
if (heritage.token !== ts14.SyntaxKind.ExtendsKeyword) {
|
|
22334
22448
|
continue;
|
|
22335
22449
|
}
|
|
22336
22450
|
const first = heritage.types[0];
|
|
22337
|
-
if (first &&
|
|
22451
|
+
if (first && ts14.isIdentifier(first.expression)) {
|
|
22338
22452
|
extendsName = first.expression.text;
|
|
22339
22453
|
}
|
|
22340
22454
|
break;
|
|
@@ -22347,7 +22461,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
22347
22461
|
extendsName
|
|
22348
22462
|
};
|
|
22349
22463
|
const arg = expr.arguments[0];
|
|
22350
|
-
if (arg &&
|
|
22464
|
+
if (arg && ts14.isObjectLiteralExpression(arg) && kind === "component") {
|
|
22351
22465
|
const tplUrl = getStringPropertyValue(arg, "templateUrl");
|
|
22352
22466
|
if (tplUrl)
|
|
22353
22467
|
entry.templateUrls.push(tplUrl);
|
|
@@ -22360,7 +22474,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
22360
22474
|
break;
|
|
22361
22475
|
}
|
|
22362
22476
|
}
|
|
22363
|
-
|
|
22477
|
+
ts14.forEachChild(node, visit);
|
|
22364
22478
|
};
|
|
22365
22479
|
visit(sourceFile);
|
|
22366
22480
|
return out;
|
|
@@ -22400,16 +22514,16 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
22400
22514
|
}, indexByRoot, resolveParentClassFile = (parentName, childFilePath, angularRoot) => {
|
|
22401
22515
|
let source;
|
|
22402
22516
|
try {
|
|
22403
|
-
source =
|
|
22517
|
+
source = readFileSync24(childFilePath, "utf8");
|
|
22404
22518
|
} catch {
|
|
22405
22519
|
return null;
|
|
22406
22520
|
}
|
|
22407
|
-
const sf =
|
|
22408
|
-
const childDir =
|
|
22521
|
+
const sf = ts14.createSourceFile(childFilePath, source, ts14.ScriptTarget.ES2022, true, ts14.ScriptKind.TS);
|
|
22522
|
+
const childDir = dirname24(childFilePath);
|
|
22409
22523
|
for (const stmt of sf.statements) {
|
|
22410
|
-
if (!
|
|
22524
|
+
if (!ts14.isImportDeclaration(stmt))
|
|
22411
22525
|
continue;
|
|
22412
|
-
if (!
|
|
22526
|
+
if (!ts14.isStringLiteral(stmt.moduleSpecifier))
|
|
22413
22527
|
continue;
|
|
22414
22528
|
const clause = stmt.importClause;
|
|
22415
22529
|
if (!clause || clause.isTypeOnly)
|
|
@@ -22417,7 +22531,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
22417
22531
|
let matchesName = false;
|
|
22418
22532
|
if (clause.name && clause.name.text === parentName)
|
|
22419
22533
|
matchesName = true;
|
|
22420
|
-
if (!matchesName && clause.namedBindings &&
|
|
22534
|
+
if (!matchesName && clause.namedBindings && ts14.isNamedImports(clause.namedBindings)) {
|
|
22421
22535
|
for (const el of clause.namedBindings.elements) {
|
|
22422
22536
|
if (el.isTypeOnly)
|
|
22423
22537
|
continue;
|
|
@@ -22462,7 +22576,7 @@ var ENTITY_DECORATORS, isAngularSourceFile = (file5) => file5.endsWith(".ts") ||
|
|
|
22462
22576
|
const parentFile = new Map;
|
|
22463
22577
|
for (const tsPath of walkAngularSourceFiles(userAngularRoot)) {
|
|
22464
22578
|
const classes = parseDecoratedClasses(tsPath);
|
|
22465
|
-
const componentDir =
|
|
22579
|
+
const componentDir = dirname24(tsPath);
|
|
22466
22580
|
for (const cls of classes) {
|
|
22467
22581
|
const entity = {
|
|
22468
22582
|
className: cls.className,
|
|
@@ -22638,8 +22752,8 @@ __export(exports_moduleServer, {
|
|
|
22638
22752
|
createModuleServer: () => createModuleServer,
|
|
22639
22753
|
SRC_URL_PREFIX: () => SRC_URL_PREFIX
|
|
22640
22754
|
});
|
|
22641
|
-
import { existsSync as
|
|
22642
|
-
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";
|
|
22643
22757
|
var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPILABLE, ALL_EXPORTS_RE, STRING_CONTENTS_RE, preserveTypeExports = (originalSource, transpiled, valueExports) => {
|
|
22644
22758
|
const codeOnly = originalSource.replace(STRING_CONTENTS_RE, '""');
|
|
22645
22759
|
const allExports = [];
|
|
@@ -22659,7 +22773,7 @@ var SRC_PREFIX = "/@src/", jsTranspiler2, tsTranspiler2, tsxTranspiler, TRANSPIL
|
|
|
22659
22773
|
${stubs}
|
|
22660
22774
|
`;
|
|
22661
22775
|
}, resolveRelativeExtension = (srcPath, projectRoot, extensions) => {
|
|
22662
|
-
const found = extensions.find((ext) =>
|
|
22776
|
+
const found = extensions.find((ext) => existsSync32(resolve38(projectRoot, srcPath + ext)));
|
|
22663
22777
|
return found ? srcPath + found : srcPath;
|
|
22664
22778
|
}, IMPORT_EXTENSIONS, SIDE_EFFECT_EXTENSIONS, MODULE_EXTENSIONS, RESOLVED_MODULE_EXTENSIONS, REACT_EXTENSIONS, escapeRegex3 = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), buildImportRewriter = (vendorPaths) => {
|
|
22665
22779
|
const entries = Object.entries(vendorPaths).sort(([a], [b2]) => b2.length - a.length);
|
|
@@ -22711,13 +22825,13 @@ ${stubs}
|
|
|
22711
22825
|
const subpath = isScoped ? parts.slice(2).join("/") : parts.slice(1).join("/");
|
|
22712
22826
|
if (!subpath) {
|
|
22713
22827
|
const pkgDir = resolve38(projectRoot, "node_modules", packageName ?? "");
|
|
22714
|
-
const pkgJsonPath =
|
|
22715
|
-
if (
|
|
22716
|
-
const pkg = JSON.parse(
|
|
22828
|
+
const pkgJsonPath = join41(pkgDir, "package.json");
|
|
22829
|
+
if (existsSync32(pkgJsonPath)) {
|
|
22830
|
+
const pkg = JSON.parse(readFileSync25(pkgJsonPath, "utf-8"));
|
|
22717
22831
|
const esmEntry = typeof pkg.module === "string" && pkg.module || typeof pkg.browser === "string" && pkg.browser;
|
|
22718
22832
|
if (esmEntry) {
|
|
22719
22833
|
const resolved = resolve38(pkgDir, esmEntry);
|
|
22720
|
-
if (
|
|
22834
|
+
if (existsSync32(resolved))
|
|
22721
22835
|
return relative16(projectRoot, resolved);
|
|
22722
22836
|
}
|
|
22723
22837
|
}
|
|
@@ -22748,7 +22862,7 @@ ${stubs}
|
|
|
22748
22862
|
};
|
|
22749
22863
|
result = result.replace(/^((?:import\s+[\s\S]+?\s+from|export\s+[\s\S]+?\s+from|import)\s*["'])([^"'./][^"']*)(["'])/gm, stubReplace);
|
|
22750
22864
|
result = result.replace(/(import\s*\(\s*["'])([^"'./][^"']*)(["']\s*\))/g, stubReplace);
|
|
22751
|
-
const fileDir =
|
|
22865
|
+
const fileDir = dirname25(filePath);
|
|
22752
22866
|
result = result.replace(/(from\s*["'])(\.\.?\/[^"']+)(["'])/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
22753
22867
|
result = result.replace(/(import\s*\(\s*["'])(\.\.?\/[^"']+)(["']\s*\))/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, IMPORT_EXTENSIONS)}${suffix}`);
|
|
22754
22868
|
result = result.replace(/(import\s*["'])(\.\.?\/[^"']+)(["']\s*;?)/g, (_match, prefix, relPath, suffix) => `${prefix}${resolveRelativeImport(relPath, fileDir, projectRoot, SIDE_EFFECT_EXTENSIONS)}${suffix}`);
|
|
@@ -22814,7 +22928,7 @@ ${code}`;
|
|
|
22814
22928
|
reactFastRefreshWarningEmitted = true;
|
|
22815
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.");
|
|
22816
22930
|
}, transformReactFile = (filePath, projectRoot, rewriter) => {
|
|
22817
|
-
const raw =
|
|
22931
|
+
const raw = readFileSync25(filePath, "utf-8");
|
|
22818
22932
|
const valueExports = tsxTranspiler.scan(raw).exports;
|
|
22819
22933
|
let transpiled = reactTranspiler.transformSync(raw);
|
|
22820
22934
|
transpiled = preserveTypeExports(raw, transpiled, valueExports);
|
|
@@ -22830,7 +22944,7 @@ ${transpiled}`;
|
|
|
22830
22944
|
transpiled += buildIslandMetadataExports(raw);
|
|
22831
22945
|
return rewriteImports(transpiled, filePath, projectRoot, rewriter);
|
|
22832
22946
|
}, transformPlainFile = (filePath, projectRoot, rewriter, vueDir) => {
|
|
22833
|
-
const raw =
|
|
22947
|
+
const raw = readFileSync25(filePath, "utf-8");
|
|
22834
22948
|
const ext = extname10(filePath);
|
|
22835
22949
|
const isTS = ext === ".ts" || ext === ".tsx";
|
|
22836
22950
|
const isTSX = ext === ".tsx" || ext === ".jsx";
|
|
@@ -22996,7 +23110,7 @@ ${code}`;
|
|
|
22996
23110
|
` + ` var __hmr_accept = function(cb) { window.__SVELTE_HMR_ACCEPT__[${JSON.stringify(moduleUrl)}] = cb; };`);
|
|
22997
23111
|
return code.replace(/import\.meta\.hot\.accept\(/g, "__hmr_accept(");
|
|
22998
23112
|
}, transformSvelteFile = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
22999
|
-
const raw =
|
|
23113
|
+
const raw = readFileSync25(filePath, "utf-8");
|
|
23000
23114
|
if (!svelteCompiler) {
|
|
23001
23115
|
svelteCompiler = await import("svelte/compiler");
|
|
23002
23116
|
}
|
|
@@ -23058,7 +23172,7 @@ export default __script__;`;
|
|
|
23058
23172
|
return `${cssInjection}
|
|
23059
23173
|
${code}`;
|
|
23060
23174
|
}, transformVueFile = async (filePath, projectRoot, rewriter, vueDir, stylePreprocessors) => {
|
|
23061
|
-
const rawSource =
|
|
23175
|
+
const rawSource = readFileSync25(filePath, "utf-8");
|
|
23062
23176
|
const raw = addAutoRouterSetupApp(rawSource);
|
|
23063
23177
|
if (!vueCompiler) {
|
|
23064
23178
|
vueCompiler = await import("@vue/compiler-sfc");
|
|
@@ -23096,11 +23210,11 @@ ${code}`;
|
|
|
23096
23210
|
`);
|
|
23097
23211
|
return result;
|
|
23098
23212
|
}, resolveSvelteModulePath = (path) => {
|
|
23099
|
-
if (
|
|
23213
|
+
if (existsSync32(path))
|
|
23100
23214
|
return path;
|
|
23101
|
-
if (
|
|
23215
|
+
if (existsSync32(`${path}.ts`))
|
|
23102
23216
|
return `${path}.ts`;
|
|
23103
|
-
if (
|
|
23217
|
+
if (existsSync32(`${path}.js`))
|
|
23104
23218
|
return `${path}.js`;
|
|
23105
23219
|
return path;
|
|
23106
23220
|
}, jsResponse = (body) => {
|
|
@@ -23113,7 +23227,7 @@ ${code}`;
|
|
|
23113
23227
|
}
|
|
23114
23228
|
});
|
|
23115
23229
|
}, handleCssRequest = (filePath) => {
|
|
23116
|
-
const raw =
|
|
23230
|
+
const raw = readFileSync25(filePath, "utf-8");
|
|
23117
23231
|
const escaped = raw.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$");
|
|
23118
23232
|
return [
|
|
23119
23233
|
`const style = document.createElement('style');`,
|
|
@@ -23251,7 +23365,7 @@ export default {};
|
|
|
23251
23365
|
return { ext, filePath: resolveSvelteModulePath(filePath) };
|
|
23252
23366
|
if (ext)
|
|
23253
23367
|
return { ext, filePath };
|
|
23254
|
-
const found = MODULE_EXTENSIONS.find((candidate) =>
|
|
23368
|
+
const found = MODULE_EXTENSIONS.find((candidate) => existsSync32(filePath + candidate));
|
|
23255
23369
|
if (!found)
|
|
23256
23370
|
return { ext, filePath };
|
|
23257
23371
|
const resolved = filePath + found;
|
|
@@ -23544,7 +23658,7 @@ __export(exports_hmrCompiler, {
|
|
|
23544
23658
|
getApplyMetadataModule: () => getApplyMetadataModule,
|
|
23545
23659
|
encodeHmrComponentId: () => encodeHmrComponentId
|
|
23546
23660
|
});
|
|
23547
|
-
import { dirname as
|
|
23661
|
+
import { dirname as dirname26, relative as relative17, resolve as resolve39 } from "path";
|
|
23548
23662
|
import { performance as performance2 } from "perf_hooks";
|
|
23549
23663
|
var getApplyMetadataModule = async (encodedId) => {
|
|
23550
23664
|
const decoded = decodeURIComponent(encodedId);
|
|
@@ -23564,7 +23678,7 @@ var getApplyMetadataModule = async (encodedId) => {
|
|
|
23564
23678
|
const { resolveOwningComponents: resolveOwningComponents2 } = await Promise.resolve().then(() => (init_resolveOwningComponents(), exports_resolveOwningComponents));
|
|
23565
23679
|
const owners = resolveOwningComponents2({
|
|
23566
23680
|
changedFilePath: componentFilePath,
|
|
23567
|
-
userAngularRoot:
|
|
23681
|
+
userAngularRoot: dirname26(componentFilePath)
|
|
23568
23682
|
});
|
|
23569
23683
|
const owner = owners.find((o3) => o3.className === className);
|
|
23570
23684
|
const kind = owner?.kind ?? "component";
|
|
@@ -23771,8 +23885,8 @@ var handleHTMXUpdate = async (htmxFilePath) => {
|
|
|
23771
23885
|
var init_simpleHTMXHMR = () => {};
|
|
23772
23886
|
|
|
23773
23887
|
// src/dev/rebuildTrigger.ts
|
|
23774
|
-
import { existsSync as
|
|
23775
|
-
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";
|
|
23776
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) => {
|
|
23777
23891
|
if (!config.tailwind)
|
|
23778
23892
|
return;
|
|
@@ -23871,7 +23985,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23871
23985
|
detectedFw = detected !== "ignored" ? detected : affectedFrameworks[0];
|
|
23872
23986
|
}
|
|
23873
23987
|
return { ...parsed, framework: detectedFw };
|
|
23874
|
-
}, 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) => {
|
|
23875
23989
|
const config = state.config;
|
|
23876
23990
|
const cwd2 = process.cwd();
|
|
23877
23991
|
const absDeleted = resolve42(deletedFile).replace(/\\/g, "/");
|
|
@@ -23889,8 +24003,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23889
24003
|
const relJs = `${rel.slice(0, -ext[0].length)}.js`;
|
|
23890
24004
|
const generatedDir = getFrameworkGeneratedDir(framework, cwd2);
|
|
23891
24005
|
for (const candidate of [
|
|
23892
|
-
|
|
23893
|
-
`${
|
|
24006
|
+
join42(generatedDir, relJs),
|
|
24007
|
+
`${join42(generatedDir, relJs)}.map`
|
|
23894
24008
|
]) {
|
|
23895
24009
|
try {
|
|
23896
24010
|
rmSync3(candidate, { force: true });
|
|
@@ -23917,7 +24031,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23917
24031
|
if (!dependents || dependents.size === 0) {
|
|
23918
24032
|
return;
|
|
23919
24033
|
}
|
|
23920
|
-
const dependentFiles = Array.from(dependents).filter((file5) =>
|
|
24034
|
+
const dependentFiles = Array.from(dependents).filter((file5) => existsSync33(file5));
|
|
23921
24035
|
if (dependentFiles.length === 0) {
|
|
23922
24036
|
return;
|
|
23923
24037
|
}
|
|
@@ -23933,7 +24047,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23933
24047
|
try {
|
|
23934
24048
|
const affectedFiles = getAffectedFiles(state.dependencyGraph, normalizedFilePath);
|
|
23935
24049
|
affectedFiles.forEach((affectedFile) => {
|
|
23936
|
-
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath &&
|
|
24050
|
+
if (!processedFiles.has(affectedFile) && affectedFile !== normalizedFilePath && existsSync33(affectedFile)) {
|
|
23937
24051
|
validFiles.push(affectedFile);
|
|
23938
24052
|
processedFiles.add(affectedFile);
|
|
23939
24053
|
}
|
|
@@ -23958,7 +24072,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
23958
24072
|
collectChangedFileAffected(state, normalizedFilePath, processedFiles, validFiles);
|
|
23959
24073
|
}, processFilePathSet = (state, filePathSet, processedFiles, validFiles) => {
|
|
23960
24074
|
filePathSet.forEach((filePathInSet) => {
|
|
23961
|
-
if (!
|
|
24075
|
+
if (!existsSync33(filePathInSet)) {
|
|
23962
24076
|
collectDeletedFileAffected(state, filePathInSet, processedFiles, validFiles);
|
|
23963
24077
|
return;
|
|
23964
24078
|
}
|
|
@@ -24095,8 +24209,8 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24095
24209
|
const buildDir = state.resolvedPaths.buildDir;
|
|
24096
24210
|
const destPath = resolve42(buildDir, urlPrefix ? `${urlPrefix}/${relFromDir}` : relFromDir);
|
|
24097
24211
|
const { mkdir: mkdir7, copyFile, readFile: readFile6 } = await import("fs/promises");
|
|
24098
|
-
const { dirname:
|
|
24099
|
-
await mkdir7(
|
|
24212
|
+
const { dirname: dirname28 } = await import("path");
|
|
24213
|
+
await mkdir7(dirname28(destPath), { recursive: true });
|
|
24100
24214
|
await copyFile(absSource, destPath);
|
|
24101
24215
|
const bytes = await readFile6(destPath);
|
|
24102
24216
|
const webPath = urlPrefix ? `/${urlPrefix}/${relFromDir}` : `/${relFromDir}`;
|
|
@@ -24212,7 +24326,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24212
24326
|
return componentFile;
|
|
24213
24327
|
}
|
|
24214
24328
|
const tsCounterpart = componentFile.replace(/\.html$/, ".ts");
|
|
24215
|
-
if (
|
|
24329
|
+
if (existsSync33(tsCounterpart)) {
|
|
24216
24330
|
return tsCounterpart;
|
|
24217
24331
|
}
|
|
24218
24332
|
if (!graph)
|
|
@@ -24298,7 +24412,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24298
24412
|
const keepByDir = new Map;
|
|
24299
24413
|
const prefixByDir = new Map;
|
|
24300
24414
|
for (const artifact of freshOutputs) {
|
|
24301
|
-
const dir =
|
|
24415
|
+
const dir = dirname27(artifact.path);
|
|
24302
24416
|
const name = basename14(artifact.path);
|
|
24303
24417
|
const [prefix] = name.split(".");
|
|
24304
24418
|
if (!prefix)
|
|
@@ -24728,12 +24842,12 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
24728
24842
|
try {
|
|
24729
24843
|
const { primeComponentFingerprint: primeComponentFingerprint2 } = await Promise.resolve().then(() => (init_fastHmrCompiler(), exports_fastHmrCompiler));
|
|
24730
24844
|
const { readdir: readdir5 } = await import("fs/promises");
|
|
24731
|
-
const { join:
|
|
24845
|
+
const { join: join43 } = await import("path");
|
|
24732
24846
|
const walk = async (dir) => {
|
|
24733
24847
|
const entries = await readdir5(dir, { withFileTypes: true });
|
|
24734
24848
|
const files = [];
|
|
24735
24849
|
for (const entry of entries) {
|
|
24736
|
-
const full =
|
|
24850
|
+
const full = join43(dir, entry.name);
|
|
24737
24851
|
if (entry.isDirectory()) {
|
|
24738
24852
|
files.push(...await walk(full));
|
|
24739
24853
|
} else if (entry.isFile() && entry.name.endsWith(".ts") && !entry.name.endsWith(".d.ts")) {
|
|
@@ -25176,7 +25290,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
25176
25290
|
const { vueServerPaths, vueIndexPaths, vueClientPaths, vueCssPaths } = await compileVue2(vueFiles, vueDir, true, getStyleTransformConfig(state.config));
|
|
25177
25291
|
const serverEntries = [...vueServerPaths];
|
|
25178
25292
|
const clientEntries = [...vueIndexPaths, ...vueClientPaths];
|
|
25179
|
-
const cssOutDir =
|
|
25293
|
+
const cssOutDir = join42(buildDir, state.resolvedPaths.assetsDir ? basename14(state.resolvedPaths.assetsDir) : "assets", "css");
|
|
25180
25294
|
const { serverRoot, serverOutDir } = await computeServerOutPaths(state.resolvedPaths, "vue");
|
|
25181
25295
|
const [serverResult, clientResult, cssResult] = await Promise.all([
|
|
25182
25296
|
serverEntries.length > 0 ? bunBuild9({
|
|
@@ -25417,7 +25531,7 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
25417
25531
|
if (!buildReference?.source) {
|
|
25418
25532
|
return;
|
|
25419
25533
|
}
|
|
25420
|
-
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);
|
|
25421
25535
|
islandFiles.add(resolve42(sourcePath));
|
|
25422
25536
|
}, resolveIslandSourceFiles = async (config) => {
|
|
25423
25537
|
const registryPath = config.islands?.registry;
|
|
@@ -26171,7 +26285,7 @@ __export(exports_buildDepVendor, {
|
|
|
26171
26285
|
buildDepVendor: () => buildDepVendor
|
|
26172
26286
|
});
|
|
26173
26287
|
import { mkdirSync as mkdirSync16 } from "fs";
|
|
26174
|
-
import { join as
|
|
26288
|
+
import { join as join43 } from "path";
|
|
26175
26289
|
import { rm as rm10 } from "fs/promises";
|
|
26176
26290
|
var {build: bunBuild9, Glob: Glob10 } = globalThis.Bun;
|
|
26177
26291
|
var toSafeFileName6 = (specifier) => {
|
|
@@ -26225,7 +26339,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
26225
26339
|
framework: Array.from(framework).filter(isResolvable4)
|
|
26226
26340
|
};
|
|
26227
26341
|
}, collectTransitiveImports = async (specs, alreadyVendored, alreadyScanned) => {
|
|
26228
|
-
const { readFileSync:
|
|
26342
|
+
const { readFileSync: readFileSync26 } = await import("fs");
|
|
26229
26343
|
const transpiler6 = new Bun.Transpiler({ loader: "js" });
|
|
26230
26344
|
const newSpecs = new Set;
|
|
26231
26345
|
for (const spec of specs) {
|
|
@@ -26240,7 +26354,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
26240
26354
|
}
|
|
26241
26355
|
let content;
|
|
26242
26356
|
try {
|
|
26243
|
-
content =
|
|
26357
|
+
content = readFileSync26(resolved, "utf-8");
|
|
26244
26358
|
} catch {
|
|
26245
26359
|
continue;
|
|
26246
26360
|
}
|
|
@@ -26282,7 +26396,7 @@ var toSafeFileName6 = (specifier) => {
|
|
|
26282
26396
|
}), buildDepVendorPass = async (specifiers, vendorDir, tmpDir) => {
|
|
26283
26397
|
const entries = await Promise.all(specifiers.map(async (specifier) => {
|
|
26284
26398
|
const safeName = toSafeFileName6(specifier);
|
|
26285
|
-
const entryPath =
|
|
26399
|
+
const entryPath = join43(tmpDir, `${safeName}.ts`);
|
|
26286
26400
|
await Bun.write(entryPath, await generateVendorEntrySource(specifier));
|
|
26287
26401
|
return { entryPath, specifier };
|
|
26288
26402
|
}));
|
|
@@ -26343,9 +26457,9 @@ var toSafeFileName6 = (specifier) => {
|
|
|
26343
26457
|
const { dep: initialSpecs, framework: frameworkRoots } = await scanBareImports(directories);
|
|
26344
26458
|
if (initialSpecs.length === 0 && frameworkRoots.length === 0)
|
|
26345
26459
|
return {};
|
|
26346
|
-
const vendorDir =
|
|
26460
|
+
const vendorDir = join43(buildDir, "vendor");
|
|
26347
26461
|
mkdirSync16(vendorDir, { recursive: true });
|
|
26348
|
-
const tmpDir =
|
|
26462
|
+
const tmpDir = join43(buildDir, "_dep_vendor_tmp");
|
|
26349
26463
|
mkdirSync16(tmpDir, { recursive: true });
|
|
26350
26464
|
const allSpecs = new Set(initialSpecs);
|
|
26351
26465
|
const alreadyScanned = new Set;
|
|
@@ -27046,17 +27160,17 @@ __export(exports_devtoolsJson, {
|
|
|
27046
27160
|
normalizeDevtoolsWorkspaceRoot: () => normalizeDevtoolsWorkspaceRoot,
|
|
27047
27161
|
devtoolsJson: () => devtoolsJson
|
|
27048
27162
|
});
|
|
27049
|
-
import { existsSync as
|
|
27050
|
-
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";
|
|
27051
27165
|
import { Elysia as Elysia3 } from "elysia";
|
|
27052
27166
|
var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_KEY = "__absoluteDevtoolsWorkspaceUuid", getGlobalUuid = () => Reflect.get(globalThis, UUID_CACHE_KEY), setGlobalUuid = (uuid) => {
|
|
27053
27167
|
Reflect.set(globalThis, UUID_CACHE_KEY, uuid);
|
|
27054
27168
|
return uuid;
|
|
27055
|
-
}, 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 ??
|
|
27056
|
-
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))
|
|
27057
27171
|
return null;
|
|
27058
27172
|
try {
|
|
27059
|
-
const value =
|
|
27173
|
+
const value = readFileSync26(cachePath, "utf-8").trim();
|
|
27060
27174
|
return isUuidV4(value) ? value : null;
|
|
27061
27175
|
} catch {
|
|
27062
27176
|
return null;
|
|
@@ -27074,7 +27188,7 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
27074
27188
|
if (cachedUuid)
|
|
27075
27189
|
return setGlobalUuid(cachedUuid);
|
|
27076
27190
|
const uuid = crypto.randomUUID();
|
|
27077
|
-
mkdirSync17(
|
|
27191
|
+
mkdirSync17(dirname28(cachePath), { recursive: true });
|
|
27078
27192
|
writeFileSync12(cachePath, uuid, "utf-8");
|
|
27079
27193
|
return setGlobalUuid(uuid);
|
|
27080
27194
|
}, devtoolsJson = (buildDir, options = {}) => {
|
|
@@ -27091,11 +27205,11 @@ var ENDPOINT = "/.well-known/appspecific/com.chrome.devtools.json", UUID_CACHE_K
|
|
|
27091
27205
|
if (process.env.WSL_DISTRO_NAME) {
|
|
27092
27206
|
const distro = process.env.WSL_DISTRO_NAME;
|
|
27093
27207
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
27094
|
-
return
|
|
27208
|
+
return join44("\\\\wsl.localhost", distro, withoutLeadingSlash).replace(/\//g, "\\");
|
|
27095
27209
|
}
|
|
27096
27210
|
if (process.env.DOCKER_DESKTOP && !root.startsWith("\\\\")) {
|
|
27097
27211
|
const withoutLeadingSlash = root.replace(/^\//, "");
|
|
27098
|
-
return
|
|
27212
|
+
return join44("\\\\wsl.localhost", "docker-desktop-data", withoutLeadingSlash).replace(/\//g, "\\");
|
|
27099
27213
|
}
|
|
27100
27214
|
return root;
|
|
27101
27215
|
};
|
|
@@ -27106,13 +27220,13 @@ var exports_imageOptimizer = {};
|
|
|
27106
27220
|
__export(exports_imageOptimizer, {
|
|
27107
27221
|
imageOptimizer: () => imageOptimizer
|
|
27108
27222
|
});
|
|
27109
|
-
import { existsSync as
|
|
27223
|
+
import { existsSync as existsSync35 } from "fs";
|
|
27110
27224
|
import { resolve as resolve45 } from "path";
|
|
27111
27225
|
import { Elysia as Elysia4 } from "elysia";
|
|
27112
27226
|
var DEFAULT_CACHE_TTL_SECONDS = 60, MS_PER_SECOND = 1000, MAX_QUALITY = 100, avifInProgress, safeResolve = (path, baseDir) => {
|
|
27113
27227
|
try {
|
|
27114
27228
|
const resolved = validateSafePath(path, baseDir);
|
|
27115
|
-
if (
|
|
27229
|
+
if (existsSync35(resolved))
|
|
27116
27230
|
return resolved;
|
|
27117
27231
|
return null;
|
|
27118
27232
|
} catch {
|
|
@@ -27326,15 +27440,15 @@ __export(exports_prerender, {
|
|
|
27326
27440
|
prerender: () => prerender,
|
|
27327
27441
|
PRERENDER_BYPASS_HEADER: () => PRERENDER_BYPASS_HEADER
|
|
27328
27442
|
});
|
|
27329
|
-
import { mkdirSync as mkdirSync18, readFileSync as
|
|
27330
|
-
import { join as
|
|
27443
|
+
import { mkdirSync as mkdirSync18, readFileSync as readFileSync27 } from "fs";
|
|
27444
|
+
import { join as join45 } from "path";
|
|
27331
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) => {
|
|
27332
27446
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
27333
27447
|
await Bun.write(metaPath, String(Date.now()));
|
|
27334
27448
|
}, readTimestamp = (htmlPath) => {
|
|
27335
27449
|
const metaPath = htmlPath.replace(/\.html$/, ".meta");
|
|
27336
27450
|
try {
|
|
27337
|
-
const content =
|
|
27451
|
+
const content = readFileSync27(metaPath, "utf-8");
|
|
27338
27452
|
return Number(content) || 0;
|
|
27339
27453
|
} catch {
|
|
27340
27454
|
return 0;
|
|
@@ -27393,7 +27507,7 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
27393
27507
|
return false;
|
|
27394
27508
|
const html = await res.text();
|
|
27395
27509
|
const fileName = routeToFilename(route);
|
|
27396
|
-
const filePath =
|
|
27510
|
+
const filePath = join45(prerenderDir, fileName);
|
|
27397
27511
|
await Bun.write(filePath, html);
|
|
27398
27512
|
await writeTimestamp(filePath);
|
|
27399
27513
|
return true;
|
|
@@ -27419,13 +27533,13 @@ var SERVER_OUTPUT_LIMIT = 4000, STARTUP_POLL_INTERVAL_MS = 100, DEFAULT_STARTUP_
|
|
|
27419
27533
|
}
|
|
27420
27534
|
const html = await res.text();
|
|
27421
27535
|
const fileName = routeToFilename(route);
|
|
27422
|
-
const filePath =
|
|
27536
|
+
const filePath = join45(prerenderDir, fileName);
|
|
27423
27537
|
await Bun.write(filePath, html);
|
|
27424
27538
|
await writeTimestamp(filePath);
|
|
27425
27539
|
result.routes.set(route, filePath);
|
|
27426
27540
|
log2?.(` Pre-rendered ${route} \u2192 ${fileName} (${html.length} bytes)`);
|
|
27427
27541
|
}, prerender = async (port, outDir, staticConfig, log2) => {
|
|
27428
|
-
const prerenderDir =
|
|
27542
|
+
const prerenderDir = join45(outDir, "_prerendered");
|
|
27429
27543
|
mkdirSync18(prerenderDir, { recursive: true });
|
|
27430
27544
|
const baseUrl = `http://localhost:${port}`;
|
|
27431
27545
|
let routes;
|
|
@@ -27525,21 +27639,21 @@ __export(exports_serverEntryWatcher, {
|
|
|
27525
27639
|
startServerEntryWatcher: () => startServerEntryWatcher,
|
|
27526
27640
|
isAtomicWriteTemp: () => isAtomicWriteTemp
|
|
27527
27641
|
});
|
|
27528
|
-
import { existsSync as
|
|
27642
|
+
import { existsSync as existsSync38, statSync as statSync8, watch as watch2 } from "fs";
|
|
27529
27643
|
import { createRequire as createRequire2 } from "module";
|
|
27530
|
-
import { dirname as
|
|
27644
|
+
import { dirname as dirname29, join as join48, resolve as resolve47 } from "path";
|
|
27531
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 = () => {
|
|
27532
27646
|
if (globalThis.__absoluteEntryWatcherStarted)
|
|
27533
27647
|
return;
|
|
27534
27648
|
const main = Bun.main;
|
|
27535
|
-
if (!main || !
|
|
27649
|
+
if (!main || !existsSync38(main))
|
|
27536
27650
|
return;
|
|
27537
27651
|
globalThis.__absoluteEntryWatcherStarted = true;
|
|
27538
27652
|
const entryPath = resolve47(main);
|
|
27539
|
-
const entryDir =
|
|
27653
|
+
const entryDir = dirname29(entryPath);
|
|
27540
27654
|
const entryBase = entryPath.slice(entryDir.length + 1);
|
|
27541
27655
|
const configPath2 = resolve47(process.env.ABSOLUTE_CONFIG ?? "absolute.config.ts");
|
|
27542
|
-
const configDir2 =
|
|
27656
|
+
const configDir2 = dirname29(configPath2);
|
|
27543
27657
|
const configBase = configPath2.slice(configDir2.length + 1);
|
|
27544
27658
|
const recentlyHandled = new Map;
|
|
27545
27659
|
let entryReloadTimer = null;
|
|
@@ -27630,7 +27744,7 @@ var ATOMIC_RECOVERY_WINDOW_MS = 1000, RELOAD_DEBOUNCE_MS = 80, ATOMIC_WRITE_TEMP
|
|
|
27630
27744
|
continue;
|
|
27631
27745
|
let st2;
|
|
27632
27746
|
try {
|
|
27633
|
-
st2 = statSync8(
|
|
27747
|
+
st2 = statSync8(join48(dir, entry.name));
|
|
27634
27748
|
} catch {
|
|
27635
27749
|
continue;
|
|
27636
27750
|
}
|
|
@@ -28185,8 +28299,8 @@ var handleHTMXPageRequest = async (pagePath) => {
|
|
|
28185
28299
|
};
|
|
28186
28300
|
// src/core/prepare.ts
|
|
28187
28301
|
init_loadConfig();
|
|
28188
|
-
import { existsSync as
|
|
28189
|
-
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";
|
|
28190
28304
|
import { Elysia as Elysia5 } from "elysia";
|
|
28191
28305
|
|
|
28192
28306
|
// src/core/loadIslandRegistry.ts
|
|
@@ -28585,7 +28699,7 @@ var patchManifestIndexes = (manifest, devIndexDir, SRC_URL_PREFIX2) => {
|
|
|
28585
28699
|
if (!fileName)
|
|
28586
28700
|
continue;
|
|
28587
28701
|
const srcPath = resolve46(devIndexDir, fileName);
|
|
28588
|
-
if (!
|
|
28702
|
+
if (!existsSync36(srcPath))
|
|
28589
28703
|
continue;
|
|
28590
28704
|
const rel = relative19(process.cwd(), srcPath).replace(/\\/g, "/");
|
|
28591
28705
|
manifest[key] = `${SRC_URL_PREFIX2}${rel}`;
|
|
@@ -28693,7 +28807,7 @@ var prepareDev = async (config, buildDir) => {
|
|
|
28693
28807
|
};
|
|
28694
28808
|
var loadPrerenderMap = (prerenderDir) => {
|
|
28695
28809
|
const map = new Map;
|
|
28696
|
-
if (!
|
|
28810
|
+
if (!existsSync36(prerenderDir))
|
|
28697
28811
|
return map;
|
|
28698
28812
|
let entries;
|
|
28699
28813
|
try {
|
|
@@ -28706,7 +28820,7 @@ var loadPrerenderMap = (prerenderDir) => {
|
|
|
28706
28820
|
continue;
|
|
28707
28821
|
const name = basename15(entry, ".html");
|
|
28708
28822
|
const route = name === "index" ? "/" : `/${name}`;
|
|
28709
|
-
map.set(route,
|
|
28823
|
+
map.set(route, join46(prerenderDir, entry));
|
|
28710
28824
|
}
|
|
28711
28825
|
return map;
|
|
28712
28826
|
};
|
|
@@ -28758,7 +28872,7 @@ var prepare = async (configOrPath) => {
|
|
|
28758
28872
|
return result;
|
|
28759
28873
|
}
|
|
28760
28874
|
stepStartedAt = performance.now();
|
|
28761
|
-
const manifest = JSON.parse(
|
|
28875
|
+
const manifest = JSON.parse(readFileSync28(`${buildDir}/manifest.json`, "utf-8"));
|
|
28762
28876
|
setCurrentIslandManifest(manifest);
|
|
28763
28877
|
if (config.islands?.registry) {
|
|
28764
28878
|
setCurrentIslandRegistry(await loadIslandRegistry(config.islands.registry));
|
|
@@ -28766,9 +28880,9 @@ var prepare = async (configOrPath) => {
|
|
|
28766
28880
|
setCurrentPageIslandMetadata(await loadPageIslandMetadata(config));
|
|
28767
28881
|
recordStep("load production manifest and island metadata", stepStartedAt);
|
|
28768
28882
|
stepStartedAt = performance.now();
|
|
28769
|
-
const conventionsPath =
|
|
28770
|
-
if (
|
|
28771
|
-
const conventions2 = JSON.parse(
|
|
28883
|
+
const conventionsPath = join46(buildDir, "conventions.json");
|
|
28884
|
+
if (existsSync36(conventionsPath)) {
|
|
28885
|
+
const conventions2 = JSON.parse(readFileSync28(conventionsPath, "utf-8"));
|
|
28772
28886
|
setConventions(conventions2);
|
|
28773
28887
|
}
|
|
28774
28888
|
recordStep("load production conventions", stepStartedAt);
|
|
@@ -28782,7 +28896,7 @@ var prepare = async (configOrPath) => {
|
|
|
28782
28896
|
});
|
|
28783
28897
|
recordStep("create static plugin", stepStartedAt);
|
|
28784
28898
|
stepStartedAt = performance.now();
|
|
28785
|
-
const prerenderDir =
|
|
28899
|
+
const prerenderDir = join46(buildDir, "_prerendered");
|
|
28786
28900
|
const prerenderMap = loadPrerenderMap(prerenderDir);
|
|
28787
28901
|
recordStep("load prerender map", stepStartedAt);
|
|
28788
28902
|
if (prerenderMap.size > 0) {
|
|
@@ -28840,18 +28954,18 @@ import { argv } from "process";
|
|
|
28840
28954
|
var {env: env4 } = globalThis.Bun;
|
|
28841
28955
|
|
|
28842
28956
|
// src/dev/devCert.ts
|
|
28843
|
-
import { existsSync as
|
|
28844
|
-
import { join as
|
|
28845
|
-
var CERT_DIR =
|
|
28846
|
-
var CERT_PATH =
|
|
28847
|
-
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");
|
|
28848
28962
|
var CERT_VALIDITY_DAYS = 365;
|
|
28849
28963
|
var devLog = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[36m[dev]\x1B[0m ${msg}`);
|
|
28850
28964
|
var devWarn = (msg) => console.log(`\x1B[2m${new Date().toLocaleTimeString()}\x1B[0m \x1B[33m[dev]\x1B[0m \x1B[33m${msg}\x1B[0m`);
|
|
28851
|
-
var certFilesExist = () =>
|
|
28965
|
+
var certFilesExist = () => existsSync37(CERT_PATH) && existsSync37(KEY_PATH);
|
|
28852
28966
|
var isCertExpired = () => {
|
|
28853
28967
|
try {
|
|
28854
|
-
const certPem =
|
|
28968
|
+
const certPem = readFileSync29(CERT_PATH, "utf-8");
|
|
28855
28969
|
const proc = Bun.spawnSync(["openssl", "x509", "-enddate", "-noout"], {
|
|
28856
28970
|
stdin: new TextEncoder().encode(certPem)
|
|
28857
28971
|
});
|
|
@@ -28947,8 +29061,8 @@ var loadDevCert = () => {
|
|
|
28947
29061
|
return null;
|
|
28948
29062
|
try {
|
|
28949
29063
|
return {
|
|
28950
|
-
cert:
|
|
28951
|
-
key:
|
|
29064
|
+
cert: readFileSync29(paths.cert, "utf-8"),
|
|
29065
|
+
key: readFileSync29(paths.key, "utf-8")
|
|
28952
29066
|
};
|
|
28953
29067
|
} catch {
|
|
28954
29068
|
return null;
|
|
@@ -29223,7 +29337,7 @@ var generateHeadElement = ({
|
|
|
29223
29337
|
};
|
|
29224
29338
|
// src/utils/defineEnv.ts
|
|
29225
29339
|
var {env: bunEnv } = globalThis.Bun;
|
|
29226
|
-
import { existsSync as
|
|
29340
|
+
import { existsSync as existsSync39, readFileSync as readFileSync30 } from "fs";
|
|
29227
29341
|
import { resolve as resolve48 } from "path";
|
|
29228
29342
|
|
|
29229
29343
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
@@ -35260,18 +35374,18 @@ ${lines.join(`
|
|
|
35260
35374
|
var checkEnvFileSecurity = (properties) => {
|
|
35261
35375
|
const cwd2 = process.cwd();
|
|
35262
35376
|
const envPath = resolve48(cwd2, ".env");
|
|
35263
|
-
if (!
|
|
35377
|
+
if (!existsSync39(envPath))
|
|
35264
35378
|
return;
|
|
35265
35379
|
const sensitiveKeys = Object.keys(properties).filter(isSensitive);
|
|
35266
35380
|
if (sensitiveKeys.length === 0)
|
|
35267
35381
|
return;
|
|
35268
|
-
const envContent =
|
|
35382
|
+
const envContent = readFileSync30(envPath, "utf-8");
|
|
35269
35383
|
const presentKeys = sensitiveKeys.filter((key) => envContent.includes(`${key}=`));
|
|
35270
35384
|
if (presentKeys.length === 0)
|
|
35271
35385
|
return;
|
|
35272
35386
|
const gitignorePath = resolve48(cwd2, ".gitignore");
|
|
35273
|
-
if (
|
|
35274
|
-
const gitignore =
|
|
35387
|
+
if (existsSync39(gitignorePath)) {
|
|
35388
|
+
const gitignore = readFileSync30(gitignorePath, "utf-8");
|
|
35275
35389
|
if (gitignore.split(`
|
|
35276
35390
|
`).some((line) => line.trim() === ".env"))
|
|
35277
35391
|
return;
|
|
@@ -35512,5 +35626,5 @@ export {
|
|
|
35512
35626
|
ANGULAR_INIT_TIMEOUT_MS
|
|
35513
35627
|
};
|
|
35514
35628
|
|
|
35515
|
-
//# debugId=
|
|
35629
|
+
//# debugId=B66D4EB3D82B66BA64756E2164756E21
|
|
35516
35630
|
//# sourceMappingURL=index.js.map
|