@absolutejs/absolute 0.19.0-beta.693 → 0.19.0-beta.694
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/index.js +247 -47
- package/dist/angular/index.js.map +3 -3
- package/dist/angular/server.js +247 -47
- package/dist/angular/server.js.map +3 -3
- package/dist/build.js +386 -186
- package/dist/build.js.map +5 -5
- package/dist/index.js +433 -233
- package/dist/index.js.map +5 -5
- package/dist/islands/index.js +219 -19
- package/dist/islands/index.js.map +3 -3
- package/dist/react/index.js +219 -19
- package/dist/react/index.js.map +3 -3
- package/dist/svelte/index.js +229 -29
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +224 -24
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/build.d.ts +17 -0
- package/dist/vue/index.js +219 -19
- package/dist/vue/index.js.map +3 -3
- package/package.json +12 -7
package/dist/svelte/index.js
CHANGED
|
@@ -359,10 +359,12 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
359
359
|
});
|
|
360
360
|
|
|
361
361
|
// src/build/stylePreprocessor.ts
|
|
362
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
362
363
|
import { readFile } from "fs/promises";
|
|
363
364
|
import { createRequire } from "module";
|
|
364
|
-
import { dirname, extname, join as join2, resolve as resolve2 } from "path";
|
|
365
|
-
|
|
365
|
+
import { dirname, extname, isAbsolute, join as join2, relative, resolve as resolve2 } from "path";
|
|
366
|
+
import { fileURLToPath } from "url";
|
|
367
|
+
var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATTERN, importOptionalPeer, requireOptionalPeer, requireFromCwd, isPreprocessableStylePath = (filePath) => STYLE_EXTENSION_PATTERN.test(filePath), isStyleModulePath = (filePath) => STYLE_MODULE_EXTENSION_PATTERN.test(filePath), isStylePath = (filePath) => /\.(css|s[ac]ss|less|styl(?:us)?)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less|styl(?:us)?)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
|
|
366
368
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
367
369
|
if (normalized === "scss" || normalized.endsWith(".scss"))
|
|
368
370
|
return "scss";
|
|
@@ -370,16 +372,196 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
370
372
|
return "sass";
|
|
371
373
|
if (normalized === "less" || normalized.endsWith(".less"))
|
|
372
374
|
return "less";
|
|
375
|
+
if (normalized === "styl" || normalized === "stylus" || normalized.endsWith(".styl") || normalized.endsWith(".stylus"))
|
|
376
|
+
return "stylus";
|
|
373
377
|
return null;
|
|
374
378
|
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), normalizeLoadPaths = (filePath, paths = []) => [
|
|
375
379
|
dirname(filePath),
|
|
376
380
|
process.cwd(),
|
|
377
381
|
...paths.map((path) => resolve2(process.cwd(), path))
|
|
378
|
-
],
|
|
382
|
+
], tsconfigAliasCache, stripJsonComments = (source) => source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1"), normalizeAliasEntries = (aliases) => Object.entries(aliases ?? {}).map(([pattern, value]) => ({
|
|
383
|
+
pattern,
|
|
384
|
+
replacements: Array.isArray(value) ? value : [value]
|
|
385
|
+
})), readTsconfigAliases = () => {
|
|
386
|
+
const cwd = process.cwd();
|
|
387
|
+
if (tsconfigAliasCache?.cwd === cwd)
|
|
388
|
+
return tsconfigAliasCache;
|
|
389
|
+
const tsconfigPath = resolve2(cwd, "tsconfig.json");
|
|
390
|
+
const empty = { aliases: [], baseUrl: cwd, cwd };
|
|
391
|
+
if (!existsSync2(tsconfigPath)) {
|
|
392
|
+
tsconfigAliasCache = empty;
|
|
393
|
+
return empty;
|
|
394
|
+
}
|
|
395
|
+
try {
|
|
396
|
+
const parsed = JSON.parse(stripJsonComments(readFileSync2(tsconfigPath, "utf-8")));
|
|
397
|
+
const compilerOptions = parsed.compilerOptions ?? {};
|
|
398
|
+
const baseUrl = resolve2(cwd, compilerOptions.baseUrl ?? ".");
|
|
399
|
+
tsconfigAliasCache = {
|
|
400
|
+
aliases: normalizeAliasEntries(compilerOptions.paths),
|
|
401
|
+
baseUrl,
|
|
402
|
+
cwd
|
|
403
|
+
};
|
|
404
|
+
} catch {
|
|
405
|
+
tsconfigAliasCache = empty;
|
|
406
|
+
}
|
|
407
|
+
return tsconfigAliasCache;
|
|
408
|
+
}, getAliasEntries = (config) => {
|
|
409
|
+
const tsconfig = readTsconfigAliases();
|
|
410
|
+
return {
|
|
411
|
+
aliases: [...normalizeAliasEntries(config?.aliases), ...tsconfig.aliases],
|
|
412
|
+
baseUrl: tsconfig.baseUrl
|
|
413
|
+
};
|
|
414
|
+
}, aliasPatternToRegExp = (pattern) => new RegExp(`^${pattern.split("*").map((part) => part.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("(.+)")}$`), resolveAliasTargets = (specifier, config) => {
|
|
415
|
+
const { aliases, baseUrl } = getAliasEntries(config);
|
|
416
|
+
const targets = [];
|
|
417
|
+
for (const alias of aliases) {
|
|
418
|
+
const match = specifier.match(aliasPatternToRegExp(alias.pattern));
|
|
419
|
+
if (!match)
|
|
420
|
+
continue;
|
|
421
|
+
const wildcard = match[1] ?? "";
|
|
422
|
+
for (const replacement of alias.replacements) {
|
|
423
|
+
targets.push(resolve2(baseUrl, replacement.replace("*", wildcard)));
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return targets;
|
|
427
|
+
}, getLanguageExtensions = (language) => {
|
|
428
|
+
if (language === "less")
|
|
429
|
+
return [".less", ".css"];
|
|
430
|
+
if (language === "stylus")
|
|
431
|
+
return [".styl", ".stylus", ".css"];
|
|
432
|
+
return [".scss", ".sass", ".css"];
|
|
433
|
+
}, getCandidatePaths = (basePath, language) => {
|
|
434
|
+
const ext = extname(basePath);
|
|
435
|
+
const paths = ext ? [basePath] : getLanguageExtensions(language).flatMap((extension) => [
|
|
436
|
+
`${basePath}${extension}`,
|
|
437
|
+
join2(basePath, `index${extension}`)
|
|
438
|
+
]);
|
|
439
|
+
if (language === "scss" || language === "sass") {
|
|
440
|
+
return paths.flatMap((path) => {
|
|
441
|
+
const dir = dirname(path);
|
|
442
|
+
const base = path.slice(dir.length + 1);
|
|
443
|
+
return [path, join2(dir, `_${base}`)];
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
return paths;
|
|
447
|
+
}, resolveImportPath = (specifier, fromDirectory, loadPaths, language, config) => {
|
|
448
|
+
const rawCandidates = [
|
|
449
|
+
...resolveAliasTargets(specifier, config),
|
|
450
|
+
isAbsolute(specifier) ? specifier : resolve2(fromDirectory, specifier),
|
|
451
|
+
...loadPaths.map((path) => resolve2(path, specifier))
|
|
452
|
+
];
|
|
453
|
+
for (const candidate of rawCandidates.flatMap((path) => getCandidatePaths(path, language))) {
|
|
454
|
+
if (existsSync2(candidate))
|
|
455
|
+
return candidate;
|
|
456
|
+
}
|
|
457
|
+
return null;
|
|
458
|
+
}, isExternalCssUrl = (url) => /^(?:[a-z][a-z0-9+.-]*:|\/\/|#|\/)/i.test(url), splitCssUrl = (url) => {
|
|
459
|
+
const markerIndex = url.search(/[?#]/);
|
|
460
|
+
if (markerIndex === -1)
|
|
461
|
+
return { marker: "", path: url };
|
|
462
|
+
return {
|
|
463
|
+
marker: url.slice(markerIndex),
|
|
464
|
+
path: url.slice(0, markerIndex)
|
|
465
|
+
};
|
|
466
|
+
}, rebaseCssUrls = (contents, sourceFile, entryFile) => {
|
|
467
|
+
const sourceDir = dirname(sourceFile);
|
|
468
|
+
const entryDir = dirname(entryFile);
|
|
469
|
+
if (sourceDir === entryDir)
|
|
470
|
+
return contents;
|
|
471
|
+
return contents.replace(/url\(\s*(['"]?)([^'")]+)\1\s*\)/gi, (match, quote, rawUrl) => {
|
|
472
|
+
const trimmedUrl = rawUrl.trim();
|
|
473
|
+
if (!trimmedUrl || isExternalCssUrl(trimmedUrl))
|
|
474
|
+
return match;
|
|
475
|
+
const { marker, path } = splitCssUrl(trimmedUrl);
|
|
476
|
+
const rebased = relative(entryDir, resolve2(sourceDir, path)).replace(/\\/g, "/");
|
|
477
|
+
const normalized = rebased.startsWith(".") ? rebased : `./${rebased}`;
|
|
478
|
+
const nextQuote = quote || '"';
|
|
479
|
+
return `url(${nextQuote}${normalized}${marker}${nextQuote})`;
|
|
480
|
+
});
|
|
481
|
+
}, rewriteAliasedStyleImports = (contents, sourceFile, loadPaths, language, config) => contents.replace(/(@(?:use|forward|import|require)\s+)(["'])([^"']+)\2/g, (match, prefix, quote, specifier) => {
|
|
482
|
+
if (specifier.startsWith(".") || isAbsolute(specifier) || isExternalCssUrl(specifier))
|
|
483
|
+
return match;
|
|
484
|
+
const resolved = resolveImportPath(specifier, dirname(sourceFile), loadPaths, language, config);
|
|
485
|
+
return resolved ? `${prefix}${quote}${resolved}${quote}` : match;
|
|
486
|
+
}), preprocessLoadedStyle = (contents, sourceFile, entryFile, loadPaths = [], language, config) => {
|
|
487
|
+
const rebased = rebaseCssUrls(contents, sourceFile, entryFile);
|
|
488
|
+
return language ? rewriteAliasedStyleImports(rebased, sourceFile, loadPaths, language, config) : rebased;
|
|
489
|
+
}, extractCssModuleExports = (css) => {
|
|
490
|
+
const exports = {};
|
|
491
|
+
const nextCss = css.replace(/:export\s*\{([^}]*)\}/g, (_, body) => {
|
|
492
|
+
for (const declaration of body.split(";")) {
|
|
493
|
+
const separator = declaration.indexOf(":");
|
|
494
|
+
if (separator === -1)
|
|
495
|
+
continue;
|
|
496
|
+
const key = declaration.slice(0, separator).trim();
|
|
497
|
+
const value = declaration.slice(separator + 1).trim();
|
|
498
|
+
if (key && value)
|
|
499
|
+
exports[key] = value;
|
|
500
|
+
}
|
|
501
|
+
return "";
|
|
502
|
+
});
|
|
503
|
+
return { css: nextCss, exports };
|
|
504
|
+
}, getSassOptions = (config, language) => ({
|
|
379
505
|
...config?.sass ?? {},
|
|
380
506
|
...language === "scss" ? config?.scss ?? {} : {}
|
|
381
|
-
}), getLessOptions = (config) => config?.less ?? {}, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
382
|
-
${contents}` : contents,
|
|
507
|
+
}), getLessOptions = (config) => config?.less ?? {}, getStylusOptions = (config) => config?.stylus ?? {}, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
508
|
+
${contents}` : contents, createSassImporter = (entryFile, loadPaths, language, config) => ({
|
|
509
|
+
canonicalize(specifier, options) {
|
|
510
|
+
const fromDirectory = options.containingUrl ? dirname(fileURLToPath(options.containingUrl)) : dirname(entryFile);
|
|
511
|
+
const resolved = resolveImportPath(specifier, fromDirectory, loadPaths, language, config);
|
|
512
|
+
return resolved ? new URL(`file://${resolved}`) : null;
|
|
513
|
+
},
|
|
514
|
+
load(canonicalUrl) {
|
|
515
|
+
const filePath = fileURLToPath(canonicalUrl);
|
|
516
|
+
const fileLanguage = getStyleLanguage(filePath);
|
|
517
|
+
if (fileLanguage !== "scss" && fileLanguage !== "sass" && fileLanguage !== null)
|
|
518
|
+
return null;
|
|
519
|
+
return {
|
|
520
|
+
contents: preprocessLoadedStyle(readFileSync2(filePath, "utf-8"), filePath, entryFile, loadPaths, language, config),
|
|
521
|
+
syntax: filePath.endsWith(".sass") ? "indented" : "scss"
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
}), createLessFileManager = (entryFile, loadPaths, config) => ({
|
|
525
|
+
install(less, pluginManager) {
|
|
526
|
+
const baseManager = new less.FileManager;
|
|
527
|
+
const manager = Object.create(baseManager);
|
|
528
|
+
manager.supports = (filename, currentDirectory) => Boolean(resolveImportPath(filename, resolve2(currentDirectory), loadPaths, "less", config));
|
|
529
|
+
manager.loadFile = async (filename, currentDirectory) => {
|
|
530
|
+
const resolved = resolveImportPath(filename, resolve2(currentDirectory), loadPaths, "less", config);
|
|
531
|
+
if (!resolved) {
|
|
532
|
+
throw new Error(`Unable to resolve Less import "${filename}"`);
|
|
533
|
+
}
|
|
534
|
+
return {
|
|
535
|
+
contents: preprocessLoadedStyle(await readFile(resolved, "utf-8"), resolved, entryFile, loadPaths, "less", config),
|
|
536
|
+
filename: resolved
|
|
537
|
+
};
|
|
538
|
+
};
|
|
539
|
+
pluginManager.addFileManager(manager);
|
|
540
|
+
}
|
|
541
|
+
}), renderStylus = async (contents, filePath, loadPaths, options) => {
|
|
542
|
+
let stylus;
|
|
543
|
+
try {
|
|
544
|
+
const stylusModule = await importOptionalPeer("stylus");
|
|
545
|
+
stylus = stylusModule.default ?? stylusModule;
|
|
546
|
+
} catch {
|
|
547
|
+
throw missingDependencyError("stylus", filePath);
|
|
548
|
+
}
|
|
549
|
+
return new Promise((resolveCss, reject) => {
|
|
550
|
+
const renderer = stylus(contents);
|
|
551
|
+
renderer.set("filename", filePath);
|
|
552
|
+
for (const [key, value] of Object.entries(options.options ?? {})) {
|
|
553
|
+
renderer.set(key, value);
|
|
554
|
+
}
|
|
555
|
+
for (const path of loadPaths)
|
|
556
|
+
renderer.include(path);
|
|
557
|
+
renderer.render((error, css) => {
|
|
558
|
+
if (error)
|
|
559
|
+
reject(error);
|
|
560
|
+
else
|
|
561
|
+
resolveCss(css ?? "");
|
|
562
|
+
});
|
|
563
|
+
});
|
|
564
|
+
}, compileStyleSource = async (filePath, source, languageHint, config) => {
|
|
383
565
|
const language = getStyleLanguage(languageHint ?? filePath);
|
|
384
566
|
const rawContents = source ?? await readFile(filePath, "utf-8");
|
|
385
567
|
if (language === "scss" || language === "sass") {
|
|
@@ -392,8 +574,12 @@ ${contents}` : contents, compileStyleSource = async (filePath, source, languageH
|
|
|
392
574
|
throw missingDependencyError(packageName, filePath);
|
|
393
575
|
}
|
|
394
576
|
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
577
|
+
const loadPaths = normalizeLoadPaths(filePath, options.loadPaths);
|
|
395
578
|
const result = sass.compileString(contents, {
|
|
396
|
-
|
|
579
|
+
importers: [
|
|
580
|
+
createSassImporter(filePath, loadPaths, language, config)
|
|
581
|
+
],
|
|
582
|
+
loadPaths,
|
|
397
583
|
style: "expanded",
|
|
398
584
|
syntax: language === "sass" ? "indented" : "scss",
|
|
399
585
|
url: new URL(`file://${filePath}`)
|
|
@@ -413,13 +599,24 @@ ${contents}` : contents, compileStyleSource = async (filePath, source, languageH
|
|
|
413
599
|
if (!render)
|
|
414
600
|
throw missingDependencyError("less", filePath);
|
|
415
601
|
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
602
|
+
const loadPaths = normalizeLoadPaths(filePath, options.paths);
|
|
416
603
|
const result = await render(contents, {
|
|
417
604
|
...options.options ?? {},
|
|
418
605
|
filename: filePath,
|
|
419
|
-
paths:
|
|
606
|
+
paths: loadPaths,
|
|
607
|
+
plugins: [
|
|
608
|
+
...options.options?.plugins ?? [],
|
|
609
|
+
createLessFileManager(filePath, loadPaths, config)
|
|
610
|
+
]
|
|
420
611
|
});
|
|
421
612
|
return result.css;
|
|
422
613
|
}
|
|
614
|
+
if (language === "stylus") {
|
|
615
|
+
const options = getStylusOptions(config);
|
|
616
|
+
const loadPaths = normalizeLoadPaths(filePath, options.paths);
|
|
617
|
+
const contents = withAdditionalData(preprocessLoadedStyle(rawContents, filePath, filePath, loadPaths, "stylus", config), options.additionalData);
|
|
618
|
+
return renderStylus(contents, filePath, loadPaths, options);
|
|
619
|
+
}
|
|
423
620
|
return rawContents;
|
|
424
621
|
}, createStylePreprocessorPlugin = (config) => ({
|
|
425
622
|
name: "absolute-style-preprocessor",
|
|
@@ -430,21 +627,24 @@ ${contents}` : contents, compileStyleSource = async (filePath, source, languageH
|
|
|
430
627
|
path: path.slice("absolute-style-module:".length)
|
|
431
628
|
}));
|
|
432
629
|
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
433
|
-
const
|
|
434
|
-
if (!
|
|
630
|
+
const source = cssModuleSources.get(path);
|
|
631
|
+
if (!source) {
|
|
435
632
|
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
436
633
|
}
|
|
437
634
|
return {
|
|
438
|
-
contents:
|
|
635
|
+
contents: source.css,
|
|
439
636
|
loader: "css"
|
|
440
637
|
};
|
|
441
638
|
});
|
|
442
639
|
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
443
640
|
if (isStyleModulePath(path)) {
|
|
444
641
|
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
445
|
-
|
|
642
|
+
const compiled = await compileStyleSource(path, undefined, undefined, config);
|
|
643
|
+
const { css, exports } = extractCssModuleExports(compiled);
|
|
644
|
+
cssModuleSources.set(cssModulePath, { css, exports });
|
|
645
|
+
const exportSource = Object.keys(exports).length > 0 ? `import styles from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)}; export default Object.assign({}, styles, ${JSON.stringify(exports)});` : `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`;
|
|
446
646
|
return {
|
|
447
|
-
contents:
|
|
647
|
+
contents: exportSource,
|
|
448
648
|
loader: "js"
|
|
449
649
|
};
|
|
450
650
|
}
|
|
@@ -475,9 +675,9 @@ ${contents}` : contents, compileStyleSource = async (filePath, source, languageH
|
|
|
475
675
|
return compileStyleSource(filePath, undefined, undefined, config);
|
|
476
676
|
};
|
|
477
677
|
var init_stylePreprocessor = __esm(() => {
|
|
478
|
-
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less)$/i;
|
|
479
|
-
STYLE_MODULE_EXTENSION_PATTERN = /\.module\.(s[ac]ss|less)$/i;
|
|
480
|
-
STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less)$/i;
|
|
678
|
+
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less|styl(?:us)?)$/i;
|
|
679
|
+
STYLE_MODULE_EXTENSION_PATTERN = /\.module\.(s[ac]ss|less|styl(?:us)?)$/i;
|
|
680
|
+
STYLE_LANGUAGE_PATTERN = /^(s[ac]ss|less|styl(?:us)?)$/i;
|
|
481
681
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
482
682
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
483
683
|
requireFromCwd = createRequire(join2(process.cwd(), "package.json"));
|
|
@@ -486,9 +686,9 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
486
686
|
|
|
487
687
|
// src/core/svelteServerModule.ts
|
|
488
688
|
import { mkdir, readdir } from "fs/promises";
|
|
489
|
-
import { basename, dirname as dirname2, extname as extname2, join as join3, relative, resolve as resolve3 } from "path";
|
|
689
|
+
import { basename, dirname as dirname2, extname as extname2, join as join3, relative as relative2, resolve as resolve3 } from "path";
|
|
490
690
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
491
|
-
const importPath =
|
|
691
|
+
const importPath = relative2(dirname2(from), target).replace(/\\/g, "/");
|
|
492
692
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
493
693
|
}, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
|
|
494
694
|
for (const entry of entries) {
|
|
@@ -552,7 +752,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
552
752
|
const foundIndex = existResults.indexOf(true);
|
|
553
753
|
return foundIndex >= 0 ? candidates[foundIndex] ?? null : null;
|
|
554
754
|
}, getCachedModulePath = (sourcePath) => {
|
|
555
|
-
const relativeSourcePath =
|
|
755
|
+
const relativeSourcePath = relative2(process.cwd(), sourcePath).replace(/\\/g, "/");
|
|
556
756
|
const normalizedSourcePath = relativeSourcePath.startsWith("..") ? sourcePath.replace(/[:\\/]/g, "_") : relativeSourcePath;
|
|
557
757
|
return join3(serverCacheRoot, `${normalizedSourcePath}.server.js`);
|
|
558
758
|
}, resolveSvelteImport = async (spec, from) => {
|
|
@@ -1750,12 +1950,12 @@ var init_startupBanner = __esm(() => {
|
|
|
1750
1950
|
// src/utils/logger.ts
|
|
1751
1951
|
var colors2, frameworkColors, formatPath = (filePath) => {
|
|
1752
1952
|
const cwd = process.cwd();
|
|
1753
|
-
let
|
|
1754
|
-
|
|
1755
|
-
if (!
|
|
1756
|
-
|
|
1953
|
+
let relative3 = filePath.startsWith(cwd) ? filePath.slice(cwd.length + 1) : filePath;
|
|
1954
|
+
relative3 = relative3.replace(/\\/g, "/");
|
|
1955
|
+
if (!relative3.startsWith("/")) {
|
|
1956
|
+
relative3 = `/${relative3}`;
|
|
1757
1957
|
}
|
|
1758
|
-
return
|
|
1958
|
+
return relative3;
|
|
1759
1959
|
}, getFrameworkColor = (framework) => frameworkColors[framework] || colors2.white, log = (action, options) => {
|
|
1760
1960
|
const timestamp = `${colors2.dim}${formatTimestamp()}${colors2.reset}`;
|
|
1761
1961
|
const tag = `${colors2.cyan}[hmr]${colors2.reset}`;
|
|
@@ -2296,7 +2496,7 @@ var init_pageHandler = __esm(() => {
|
|
|
2296
2496
|
});
|
|
2297
2497
|
|
|
2298
2498
|
// src/angular/injectorPatch.ts
|
|
2299
|
-
import { existsSync as
|
|
2499
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, writeFileSync } from "fs";
|
|
2300
2500
|
import { dirname as dirname3, join as join4, resolve as resolve4 } from "path";
|
|
2301
2501
|
var applyInjectorPatch = (chunkPath, content) => {
|
|
2302
2502
|
if (content.includes('Symbol.for("angular.currentInjector")')) {
|
|
@@ -2334,7 +2534,7 @@ var applyInjectorPatch = (chunkPath, content) => {
|
|
|
2334
2534
|
writeFileSync(chunkPath, patched, "utf-8");
|
|
2335
2535
|
}, resolveAngularCoreDir = () => {
|
|
2336
2536
|
const fromProject = resolve4(process.cwd(), "node_modules/@angular/core");
|
|
2337
|
-
if (
|
|
2537
|
+
if (existsSync3(join4(fromProject, "package.json"))) {
|
|
2338
2538
|
return fromProject;
|
|
2339
2539
|
}
|
|
2340
2540
|
return dirname3(__require.resolve("@angular/core/package.json"));
|
|
@@ -2342,7 +2542,7 @@ var applyInjectorPatch = (chunkPath, content) => {
|
|
|
2342
2542
|
try {
|
|
2343
2543
|
const coreDir = resolveAngularCoreDir();
|
|
2344
2544
|
const chunkPath = join4(coreDir, "fesm2022", "_not_found-chunk.mjs");
|
|
2345
|
-
const content =
|
|
2545
|
+
const content = readFileSync3(chunkPath, "utf-8");
|
|
2346
2546
|
applyInjectorPatch(chunkPath, content);
|
|
2347
2547
|
} catch {}
|
|
2348
2548
|
};
|
|
@@ -2351,11 +2551,11 @@ var init_injectorPatch = __esm(() => {
|
|
|
2351
2551
|
});
|
|
2352
2552
|
|
|
2353
2553
|
// src/angular/resolveAngularPackage.ts
|
|
2354
|
-
import { existsSync as
|
|
2554
|
+
import { existsSync as existsSync4 } from "fs";
|
|
2355
2555
|
import { resolve as resolve5 } from "path";
|
|
2356
2556
|
var resolveAngularPackage = (specifier) => {
|
|
2357
2557
|
const fromProject = resolve5(process.cwd(), "node_modules", specifier);
|
|
2358
|
-
if (
|
|
2558
|
+
if (existsSync4(fromProject)) {
|
|
2359
2559
|
return fromProject;
|
|
2360
2560
|
}
|
|
2361
2561
|
return specifier;
|
|
@@ -3174,5 +3374,5 @@ export {
|
|
|
3174
3374
|
createTypedIsland
|
|
3175
3375
|
};
|
|
3176
3376
|
|
|
3177
|
-
//# debugId=
|
|
3377
|
+
//# debugId=436071CA69710DBB64756E2164756E21
|
|
3178
3378
|
//# sourceMappingURL=index.js.map
|