@absolutejs/absolute 0.19.0-beta.886 → 0.19.0-beta.888
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/build.js +88 -48
- package/dist/build.js.map +6 -6
- package/dist/index.js +88 -48
- package/dist/index.js.map +6 -6
- package/dist/src/dev/angular/hmrInjectionPlugin.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9829,7 +9829,8 @@ var init_angularLinkerPlugin = __esm(() => {
|
|
|
9829
9829
|
// src/dev/angular/hmrInjectionPlugin.ts
|
|
9830
9830
|
var exports_hmrInjectionPlugin = {};
|
|
9831
9831
|
__export(exports_hmrInjectionPlugin, {
|
|
9832
|
-
createAngularHmrInjectionPlugin: () => createAngularHmrInjectionPlugin
|
|
9832
|
+
createAngularHmrInjectionPlugin: () => createAngularHmrInjectionPlugin,
|
|
9833
|
+
applyAngularHmrInjection: () => applyAngularHmrInjection
|
|
9833
9834
|
});
|
|
9834
9835
|
import { readFile as readFile5 } from "fs/promises";
|
|
9835
9836
|
import { relative as relative6, resolve as resolve15 } from "path";
|
|
@@ -9993,50 +9994,53 @@ var ENTITY_DECORATOR_RE, IMPORT_RE, TOP_LEVEL_DECL_RE, extractAllTopLevelNames =
|
|
|
9993
9994
|
});
|
|
9994
9995
|
}
|
|
9995
9996
|
}
|
|
9996
|
-
`,
|
|
9997
|
+
`, applyAngularHmrInjection = (jsSource, componentJsAbsPath, params) => {
|
|
9997
9998
|
const { generatedAngularRoot, userAngularRoot, projectRoot } = params;
|
|
9998
9999
|
const normalizedGenRoot = resolve15(generatedAngularRoot).replace(/\\/g, "/");
|
|
9999
|
-
|
|
10000
|
-
|
|
10001
|
-
|
|
10002
|
-
|
|
10003
|
-
|
|
10004
|
-
|
|
10005
|
-
|
|
10006
|
-
|
|
10007
|
-
|
|
10008
|
-
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10012
|
-
|
|
10013
|
-
|
|
10014
|
-
|
|
10015
|
-
|
|
10016
|
-
|
|
10017
|
-
|
|
10018
|
-
|
|
10019
|
-
|
|
10020
|
-
|
|
10021
|
-
|
|
10022
|
-
|
|
10023
|
-
|
|
10024
|
-
|
|
10025
|
-
return buildHmrTail(className, JSON.stringify(id));
|
|
10026
|
-
}).join("");
|
|
10027
|
-
const topLevelNames = extractAllTopLevelNames(text);
|
|
10028
|
-
const depsKeys = topLevelNames.filter((n) => !classNames.includes(n)).join(", ");
|
|
10029
|
-
const depsBlock = classNames.length > 0 && depsKeys ? `
|
|
10000
|
+
const normalizedPath = componentJsAbsPath.replace(/\\/g, "/");
|
|
10001
|
+
if (!normalizedPath.startsWith(normalizedGenRoot + "/"))
|
|
10002
|
+
return;
|
|
10003
|
+
const seen = new Set;
|
|
10004
|
+
const classNames = [];
|
|
10005
|
+
let match;
|
|
10006
|
+
const re2 = new RegExp(ENTITY_DECORATOR_RE.source, ENTITY_DECORATOR_RE.flags);
|
|
10007
|
+
while ((match = re2.exec(jsSource)) !== null) {
|
|
10008
|
+
const className = match[1];
|
|
10009
|
+
if (className && !seen.has(className)) {
|
|
10010
|
+
seen.add(className);
|
|
10011
|
+
classNames.push(className);
|
|
10012
|
+
}
|
|
10013
|
+
}
|
|
10014
|
+
if (classNames.length === 0)
|
|
10015
|
+
return;
|
|
10016
|
+
const relFromGenRoot = relative6(generatedAngularRoot, componentJsAbsPath).replace(/\\/g, "/");
|
|
10017
|
+
const userTsPath = resolve15(userAngularRoot, relFromGenRoot.replace(/\.js$/, ".ts"));
|
|
10018
|
+
const projectRel = relative6(projectRoot, userTsPath).replace(/\\/g, "/");
|
|
10019
|
+
const tail = classNames.map((className) => {
|
|
10020
|
+
const id = `${projectRel}@${className}`;
|
|
10021
|
+
return buildHmrTail(className, JSON.stringify(id));
|
|
10022
|
+
}).join("");
|
|
10023
|
+
const topLevelNames = extractAllTopLevelNames(jsSource);
|
|
10024
|
+
const depsKeys = topLevelNames.filter((n) => !classNames.includes(n)).join(", ");
|
|
10025
|
+
const depsBlock = classNames.length > 0 && depsKeys ? `
|
|
10030
10026
|
|
|
10031
10027
|
// absolutejs HMR \u2014 Tier 1a class-deps registry
|
|
10032
10028
|
` + classNames.map((c) => `try { ${c}.__abs_deps = { ${depsKeys} }; } catch {}`).join(`
|
|
10033
10029
|
`) + `
|
|
10034
10030
|
` : "";
|
|
10035
|
-
|
|
10036
|
-
|
|
10037
|
-
|
|
10038
|
-
|
|
10039
|
-
}
|
|
10031
|
+
return jsSource + tail + depsBlock;
|
|
10032
|
+
}, createAngularHmrInjectionPlugin = (params) => ({
|
|
10033
|
+
name: "absolute-angular-hmr-injection",
|
|
10034
|
+
setup(build2) {
|
|
10035
|
+
build2.onLoad({ filter: /\.component\.js$/ }, async (args) => {
|
|
10036
|
+
const text = await readFile5(args.path, "utf8");
|
|
10037
|
+
const transformed = applyAngularHmrInjection(text, args.path, params);
|
|
10038
|
+
if (transformed === undefined)
|
|
10039
|
+
return;
|
|
10040
|
+
return { contents: transformed, loader: "js" };
|
|
10041
|
+
});
|
|
10042
|
+
}
|
|
10043
|
+
});
|
|
10040
10044
|
var init_hmrInjectionPlugin = __esm(() => {
|
|
10041
10045
|
ENTITY_DECORATOR_RE = /([A-Z][A-Za-z0-9_$]*)\s*=\s*__legacyDecorateClassTS[A-Za-z0-9_$]*\s*\(\s*\[[\s\S]*?\b(?:Component|Directive|Pipe|Injectable)[A-Za-z0-9_$]*\s*\(/g;
|
|
10042
10046
|
IMPORT_RE = /^\s*import\s+(?:(?:(\*)\s+as\s+([A-Za-z_$][\w$]*)\s+from)|(?:([A-Za-z_$][\w$]*)(?:\s*,\s*\{([^}]*)\})?\s+from)|(?:\{([^}]*)\}\s+from))\s*['"][^'"]+['"]/gm;
|
|
@@ -15040,13 +15044,14 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15040
15044
|
];
|
|
15041
15045
|
const reactClientEntryPoints = [...reactEntries];
|
|
15042
15046
|
const urlReferencedFiles = await urlReferencedFilesPromise;
|
|
15047
|
+
const skipAngularClientBundle = hmr && angularClientPaths.length > 0;
|
|
15043
15048
|
const nonReactClientEntryPoints = [
|
|
15044
15049
|
...svelteIndexPaths,
|
|
15045
15050
|
...svelteClientPaths,
|
|
15046
15051
|
...htmlEntries,
|
|
15047
15052
|
...vueIndexPaths,
|
|
15048
15053
|
...vueClientPaths,
|
|
15049
|
-
...angularClientPaths,
|
|
15054
|
+
...skipAngularClientBundle ? [] : angularClientPaths,
|
|
15050
15055
|
...islandBootstrapPath ? [islandBootstrapPath] : [],
|
|
15051
15056
|
...urlReferencedFiles
|
|
15052
15057
|
];
|
|
@@ -15432,6 +15437,13 @@ ${content.slice(firstUseIdx)}`;
|
|
|
15432
15437
|
const fileBase = basename9(serverPath, ".js");
|
|
15433
15438
|
manifest[toPascal(fileBase)] = serverPath;
|
|
15434
15439
|
}
|
|
15440
|
+
if (skipAngularClientBundle) {
|
|
15441
|
+
for (const clientPath of angularClientPaths) {
|
|
15442
|
+
const fileBase = basename9(clientPath, ".js");
|
|
15443
|
+
const relFromCwd = relative11(projectRoot, clientPath).replace(/\\/g, "/");
|
|
15444
|
+
manifest[`${toPascal(fileBase)}Index`] = `/@src/${relFromCwd}`;
|
|
15445
|
+
}
|
|
15446
|
+
}
|
|
15435
15447
|
const shouldCopyHtmx = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/htmx/") && f2.endsWith(".html"));
|
|
15436
15448
|
const shouldUpdateHtmlAssetPaths = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/html/") && (f2.endsWith(".html") || isStylePath(f2)));
|
|
15437
15449
|
const shouldUpdateHtmxAssetPaths = !isIncremental || normalizedIncrementalFiles?.some((f2) => f2.includes("/htmx/") && (f2.endsWith(".html") || isStylePath(f2)));
|
|
@@ -17469,10 +17481,31 @@ export default {};
|
|
|
17469
17481
|
return;
|
|
17470
17482
|
const stat3 = statSync2(filePath);
|
|
17471
17483
|
const resolvedVueDir = vueDir ? resolve31(vueDir) : undefined;
|
|
17472
|
-
|
|
17484
|
+
let content = REACT_EXTENSIONS.has(ext) ? transformReactFile(filePath, projectRoot, rewriter) : transformPlainFile(filePath, projectRoot, rewriter, resolvedVueDir);
|
|
17485
|
+
const isComponentJs = ext === ".js" && filePath.endsWith(".component.js") && filePath.replace(/\\/g, "/").includes("/.absolutejs/generated/angular/");
|
|
17486
|
+
if (isComponentJs) {
|
|
17487
|
+
const userAngularRoot = await getAngularUserRoot(projectRoot);
|
|
17488
|
+
if (userAngularRoot) {
|
|
17489
|
+
const { applyAngularHmrInjection: applyAngularHmrInjection2 } = await Promise.resolve().then(() => (init_hmrInjectionPlugin(), exports_hmrInjectionPlugin));
|
|
17490
|
+
const { getFrameworkGeneratedDir: getFrameworkGeneratedDir2 } = await Promise.resolve().then(() => (init_generatedDir(), exports_generatedDir));
|
|
17491
|
+
const generatedAngularRoot = getFrameworkGeneratedDir2("angular");
|
|
17492
|
+
const transformed = applyAngularHmrInjection2(content, filePath, {
|
|
17493
|
+
generatedAngularRoot,
|
|
17494
|
+
projectRoot,
|
|
17495
|
+
userAngularRoot
|
|
17496
|
+
});
|
|
17497
|
+
if (transformed !== undefined)
|
|
17498
|
+
content = transformed;
|
|
17499
|
+
}
|
|
17500
|
+
}
|
|
17473
17501
|
setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
17474
17502
|
return jsResponse(content);
|
|
17475
|
-
},
|
|
17503
|
+
}, cachedAngularUserRoot, getAngularUserRoot = async (_projectRoot) => {
|
|
17504
|
+
if (cachedAngularUserRoot !== undefined)
|
|
17505
|
+
return cachedAngularUserRoot;
|
|
17506
|
+
cachedAngularUserRoot = configuredAngularUserRoot ?? null;
|
|
17507
|
+
return cachedAngularUserRoot;
|
|
17508
|
+
}, configuredAngularUserRoot, transformAndCacheSvelte = async (filePath, projectRoot, rewriter, stylePreprocessors) => {
|
|
17476
17509
|
const stat3 = statSync2(filePath);
|
|
17477
17510
|
const content = await transformSvelteFile(filePath, projectRoot, rewriter, stylePreprocessors);
|
|
17478
17511
|
setTransformed(filePath, content, stat3.mtimeMs, extractImportedFiles(content, projectRoot));
|
|
@@ -17491,6 +17524,10 @@ export default {};
|
|
|
17491
17524
|
}, createModuleServer = (config) => {
|
|
17492
17525
|
const { projectRoot, vendorPaths, frameworkDirs, stylePreprocessors } = config;
|
|
17493
17526
|
const rewriter = buildImportRewriter(vendorPaths);
|
|
17527
|
+
if (frameworkDirs?.angular) {
|
|
17528
|
+
configuredAngularUserRoot = frameworkDirs.angular;
|
|
17529
|
+
cachedAngularUserRoot = undefined;
|
|
17530
|
+
}
|
|
17494
17531
|
return async (pathname) => {
|
|
17495
17532
|
if (pathname.startsWith("/@stub/"))
|
|
17496
17533
|
return handleStubRequest(pathname);
|
|
@@ -20307,6 +20344,13 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20307
20344
|
}
|
|
20308
20345
|
return ctx.debouncedPromise;
|
|
20309
20346
|
};
|
|
20347
|
+
}, runAngularHmrIncremental = async (state) => {
|
|
20348
|
+
try {
|
|
20349
|
+
const { compileAngularForHmr: compileAngularForHmr2 } = await Promise.resolve().then(() => (init_hmrCompiler(), exports_hmrCompiler));
|
|
20350
|
+
await compileAngularForHmr2([], state.resolvedPaths.buildDir, state.lastUserEditedFiles ?? null);
|
|
20351
|
+
} catch (err) {
|
|
20352
|
+
logWarn(`[hmr] surgical-HMR shadow compile skipped: ${err instanceof Error ? err.message : String(err)}`);
|
|
20353
|
+
}
|
|
20310
20354
|
}, compileAndBundleAngular = async (state, pageEntries, angularDir) => {
|
|
20311
20355
|
const { compileAngular: compileAngular2 } = await Promise.resolve().then(() => (init_compileAngular(), exports_compileAngular));
|
|
20312
20356
|
const { clientPaths, serverPaths } = await compileAngular2(pageEntries, angularDir, true, getStyleTransformConfig(state.config));
|
|
@@ -20352,19 +20396,15 @@ var moduleServerPromise, getModuleServer = () => moduleServerPromise, runSequent
|
|
|
20352
20396
|
const runBundle = scheduleAngularBundleRebuild(state, pageEntries, angularDir);
|
|
20353
20397
|
const queueDescription = (queue) => queue.map((e) => e.className).join(", ");
|
|
20354
20398
|
if (verdict.tier === 0) {
|
|
20399
|
+
await runAngularHmrIncremental(state);
|
|
20355
20400
|
broadcastSurgical(state, verdict.queue);
|
|
20356
20401
|
const b2 = verdict.breakdown;
|
|
20357
20402
|
logInfo(`[ng-hmr] tier-0 ${queueDescription(verdict.queue)} (server ${tierMs}ms: imports ${b2.importsMs}/resolve ${b2.resolveMs}/compile ${b2.compileMs}; awaiting client apply)`);
|
|
20358
|
-
runBundle().catch((err) => {
|
|
20359
|
-
logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
20360
|
-
});
|
|
20361
20403
|
} else if (verdict.tier === 1 && verdict.kind === "remount") {
|
|
20404
|
+
await runAngularHmrIncremental(state);
|
|
20362
20405
|
broadcastRemount(state, verdict.queue);
|
|
20363
20406
|
const b2 = verdict.breakdown;
|
|
20364
20407
|
logInfo(`[ng-hmr] tier-1a remount ${queueDescription(verdict.queue)} (server ${tierMs}ms: imports ${b2.importsMs}/resolve ${b2.resolveMs}/compile ${b2.compileMs}; awaiting client apply)`);
|
|
20365
|
-
runBundle().catch((err) => {
|
|
20366
|
-
logWarn(`[ng-hmr async bundle] rebuild failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
20367
|
-
});
|
|
20368
20408
|
} else if (verdict.tier === 1 && verdict.kind === "rebootstrap") {
|
|
20369
20409
|
await runBundle({ immediate: true });
|
|
20370
20410
|
await broadcastRebootstrap(state, verdict.reason);
|
|
@@ -30670,5 +30710,5 @@ export {
|
|
|
30670
30710
|
ANGULAR_INIT_TIMEOUT_MS
|
|
30671
30711
|
};
|
|
30672
30712
|
|
|
30673
|
-
//# debugId=
|
|
30713
|
+
//# debugId=4D0BEC65366DBDA064756E2164756E21
|
|
30674
30714
|
//# sourceMappingURL=index.js.map
|