@absolutejs/absolute 0.19.0-beta.691 → 0.19.0-beta.693
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 +184 -177
- package/dist/angular/index.js.map +4 -4
- package/dist/angular/server.js +166 -159
- package/dist/angular/server.js.map +4 -4
- package/dist/build.js +409 -391
- package/dist/build.js.map +9 -9
- package/dist/index.js +450 -431
- package/dist/index.js.map +10 -10
- package/dist/islands/index.js +64 -78
- package/dist/islands/index.js.map +3 -3
- package/dist/react/index.js +64 -78
- package/dist/react/index.js.map +3 -3
- package/dist/src/build/compileAngular.d.ts +4 -3
- package/dist/src/build/compileSvelte.d.ts +2 -1
- package/dist/src/build/compileVue.d.ts +2 -1
- package/dist/src/build/stylePreprocessor.d.ts +6 -4
- package/dist/src/core/build.d.ts +1 -1
- package/dist/src/dev/moduleServer.d.ts +2 -0
- package/dist/svelte/index.js +70 -84
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +64 -78
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/build.d.ts +28 -0
- package/dist/vue/index.js +64 -78
- package/dist/vue/index.js.map +3 -3
- package/package.json +7 -7
package/dist/vue/index.js
CHANGED
|
@@ -2566,10 +2566,9 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
2566
2566
|
});
|
|
2567
2567
|
|
|
2568
2568
|
// src/build/stylePreprocessor.ts
|
|
2569
|
-
import { readFileSync as readFileSync3 } from "fs";
|
|
2570
2569
|
import { readFile } from "fs/promises";
|
|
2571
2570
|
import { createRequire } from "module";
|
|
2572
|
-
import { dirname as dirname3, extname, join as join3 } from "path";
|
|
2571
|
+
import { dirname as dirname3, extname, join as join3, resolve as resolve4 } from "path";
|
|
2573
2572
|
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)$/i.test(filePath), getStyleBaseName = (filePath) => filePath.replace(/\.(css|s[ac]ss|less)$/i, ""), getStyleLanguage = (filePathOrLanguage) => {
|
|
2574
2573
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
2575
2574
|
if (normalized === "scss" || normalized.endsWith(".scss"))
|
|
@@ -2579,24 +2578,29 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2579
2578
|
if (normalized === "less" || normalized.endsWith(".less"))
|
|
2580
2579
|
return "less";
|
|
2581
2580
|
return null;
|
|
2582
|
-
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`),
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
}
|
|
2588
|
-
|
|
2581
|
+
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`), normalizeLoadPaths = (filePath, paths = []) => [
|
|
2582
|
+
dirname3(filePath),
|
|
2583
|
+
process.cwd(),
|
|
2584
|
+
...paths.map((path) => resolve4(process.cwd(), path))
|
|
2585
|
+
], getSassOptions = (config, language) => ({
|
|
2586
|
+
...config?.sass ?? {},
|
|
2587
|
+
...language === "scss" ? config?.scss ?? {} : {}
|
|
2588
|
+
}), getLessOptions = (config) => config?.less ?? {}, withAdditionalData = (contents, additionalData) => additionalData ? `${additionalData}
|
|
2589
|
+
${contents}` : contents, compileStyleSource = async (filePath, source, languageHint, config) => {
|
|
2589
2590
|
const language = getStyleLanguage(languageHint ?? filePath);
|
|
2590
|
-
const
|
|
2591
|
+
const rawContents = source ?? await readFile(filePath, "utf-8");
|
|
2591
2592
|
if (language === "scss" || language === "sass") {
|
|
2593
|
+
const options = getSassOptions(config, language);
|
|
2594
|
+
const packageName = options.implementation ?? "sass";
|
|
2592
2595
|
let sass;
|
|
2593
2596
|
try {
|
|
2594
|
-
sass = await importOptionalPeer(
|
|
2597
|
+
sass = await importOptionalPeer(packageName);
|
|
2595
2598
|
} catch {
|
|
2596
|
-
throw missingDependencyError(
|
|
2599
|
+
throw missingDependencyError(packageName, filePath);
|
|
2597
2600
|
}
|
|
2601
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2598
2602
|
const result = sass.compileString(contents, {
|
|
2599
|
-
loadPaths:
|
|
2603
|
+
loadPaths: normalizeLoadPaths(filePath, options.loadPaths),
|
|
2600
2604
|
style: "expanded",
|
|
2601
2605
|
syntax: language === "sass" ? "indented" : "scss",
|
|
2602
2606
|
url: new URL(`file://${filePath}`)
|
|
@@ -2604,6 +2608,7 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2604
2608
|
return result.css;
|
|
2605
2609
|
}
|
|
2606
2610
|
if (language === "less") {
|
|
2611
|
+
const options = getLessOptions(config);
|
|
2607
2612
|
let lessModule;
|
|
2608
2613
|
try {
|
|
2609
2614
|
lessModule = await importOptionalPeer("less");
|
|
@@ -2614,14 +2619,49 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2614
2619
|
const render = less?.render;
|
|
2615
2620
|
if (!render)
|
|
2616
2621
|
throw missingDependencyError("less", filePath);
|
|
2622
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2617
2623
|
const result = await render(contents, {
|
|
2624
|
+
...options.options ?? {},
|
|
2618
2625
|
filename: filePath,
|
|
2619
|
-
paths:
|
|
2626
|
+
paths: normalizeLoadPaths(filePath, options.paths)
|
|
2620
2627
|
});
|
|
2621
2628
|
return result.css;
|
|
2622
2629
|
}
|
|
2623
|
-
return
|
|
2624
|
-
},
|
|
2630
|
+
return rawContents;
|
|
2631
|
+
}, createStylePreprocessorPlugin = (config) => ({
|
|
2632
|
+
name: "absolute-style-preprocessor",
|
|
2633
|
+
setup(build) {
|
|
2634
|
+
const cssModuleSources = new Map;
|
|
2635
|
+
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
2636
|
+
namespace: "absolute-style-module",
|
|
2637
|
+
path: path.slice("absolute-style-module:".length)
|
|
2638
|
+
}));
|
|
2639
|
+
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
2640
|
+
const sourcePath = cssModuleSources.get(path);
|
|
2641
|
+
if (!sourcePath) {
|
|
2642
|
+
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
2643
|
+
}
|
|
2644
|
+
return {
|
|
2645
|
+
contents: await compileStyleSource(sourcePath, undefined, undefined, config),
|
|
2646
|
+
loader: "css"
|
|
2647
|
+
};
|
|
2648
|
+
});
|
|
2649
|
+
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
2650
|
+
if (isStyleModulePath(path)) {
|
|
2651
|
+
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
2652
|
+
cssModuleSources.set(cssModulePath, path);
|
|
2653
|
+
return {
|
|
2654
|
+
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
2655
|
+
loader: "js"
|
|
2656
|
+
};
|
|
2657
|
+
}
|
|
2658
|
+
return {
|
|
2659
|
+
contents: await compileStyleSource(path, undefined, undefined, config),
|
|
2660
|
+
loader: "css"
|
|
2661
|
+
};
|
|
2662
|
+
});
|
|
2663
|
+
}
|
|
2664
|
+
}), stylePreprocessorPlugin, createSvelteStylePreprocessor = (config) => ({
|
|
2625
2665
|
style: async ({
|
|
2626
2666
|
attributes,
|
|
2627
2667
|
content,
|
|
@@ -2632,35 +2672,14 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2632
2672
|
return;
|
|
2633
2673
|
const path = filename ?? `style.${language}`;
|
|
2634
2674
|
return {
|
|
2635
|
-
code: await compileStyleSource(path, content, language)
|
|
2675
|
+
code: await compileStyleSource(path, content, language, config)
|
|
2636
2676
|
};
|
|
2637
2677
|
}
|
|
2638
|
-
}), compileStyleFileIfNeeded = async (filePath) => {
|
|
2678
|
+
}), compileStyleFileIfNeeded = async (filePath, config) => {
|
|
2639
2679
|
if (!isPreprocessableStylePath(filePath)) {
|
|
2640
2680
|
return readFile(filePath, "utf-8");
|
|
2641
2681
|
}
|
|
2642
|
-
return compileStyleSource(filePath);
|
|
2643
|
-
}, compileStyleFileIfNeededSync = (filePath) => {
|
|
2644
|
-
const contents = readFileSync3(filePath, "utf-8");
|
|
2645
|
-
const language = getStyleLanguage(filePath);
|
|
2646
|
-
if (language === "scss" || language === "sass") {
|
|
2647
|
-
let sass;
|
|
2648
|
-
try {
|
|
2649
|
-
sass = requireOptionalPeerSync("sass");
|
|
2650
|
-
} catch {
|
|
2651
|
-
throw missingDependencyError("sass", filePath);
|
|
2652
|
-
}
|
|
2653
|
-
return sass.compileString(contents, {
|
|
2654
|
-
loadPaths: [dirname3(filePath), process.cwd()],
|
|
2655
|
-
style: "expanded",
|
|
2656
|
-
syntax: language === "sass" ? "indented" : "scss",
|
|
2657
|
-
url: new URL(`file://${filePath}`)
|
|
2658
|
-
}).css;
|
|
2659
|
-
}
|
|
2660
|
-
if (language === "less") {
|
|
2661
|
-
throw new Error(`Unable to compile ${filePath}: Less styleUrl preprocessing is async-only. Import the Less file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
|
|
2662
|
-
}
|
|
2663
|
-
return contents;
|
|
2682
|
+
return compileStyleSource(filePath, undefined, undefined, config);
|
|
2664
2683
|
};
|
|
2665
2684
|
var init_stylePreprocessor = __esm(() => {
|
|
2666
2685
|
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less)$/i;
|
|
@@ -2669,45 +2688,12 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
2669
2688
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
2670
2689
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
2671
2690
|
requireFromCwd = createRequire(join3(process.cwd(), "package.json"));
|
|
2672
|
-
stylePreprocessorPlugin =
|
|
2673
|
-
name: "absolute-style-preprocessor",
|
|
2674
|
-
setup(build) {
|
|
2675
|
-
const cssModuleSources = new Map;
|
|
2676
|
-
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
2677
|
-
namespace: "absolute-style-module",
|
|
2678
|
-
path: path.slice("absolute-style-module:".length)
|
|
2679
|
-
}));
|
|
2680
|
-
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
2681
|
-
const sourcePath = cssModuleSources.get(path);
|
|
2682
|
-
if (!sourcePath) {
|
|
2683
|
-
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
2684
|
-
}
|
|
2685
|
-
return {
|
|
2686
|
-
contents: await compileStyleSource(sourcePath),
|
|
2687
|
-
loader: "css"
|
|
2688
|
-
};
|
|
2689
|
-
});
|
|
2690
|
-
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
2691
|
-
if (isStyleModulePath(path)) {
|
|
2692
|
-
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
2693
|
-
cssModuleSources.set(cssModulePath, path);
|
|
2694
|
-
return {
|
|
2695
|
-
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
2696
|
-
loader: "js"
|
|
2697
|
-
};
|
|
2698
|
-
}
|
|
2699
|
-
return {
|
|
2700
|
-
contents: await compileStyleSource(path),
|
|
2701
|
-
loader: "css"
|
|
2702
|
-
};
|
|
2703
|
-
});
|
|
2704
|
-
}
|
|
2705
|
-
};
|
|
2691
|
+
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
2706
2692
|
});
|
|
2707
2693
|
|
|
2708
2694
|
// src/core/svelteServerModule.ts
|
|
2709
2695
|
import { mkdir, readdir as readdir2 } from "fs/promises";
|
|
2710
|
-
import { basename as basename3, dirname as dirname4, extname as extname2, join as join4, relative, resolve as
|
|
2696
|
+
import { basename as basename3, dirname as dirname4, extname as extname2, join as join4, relative, resolve as resolve5 } from "path";
|
|
2711
2697
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
2712
2698
|
const importPath = relative(dirname4(from), target).replace(/\\/g, "/");
|
|
2713
2699
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
@@ -2755,7 +2741,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2755
2741
|
if (!spec.startsWith(".")) {
|
|
2756
2742
|
return null;
|
|
2757
2743
|
}
|
|
2758
|
-
const basePath =
|
|
2744
|
+
const basePath = resolve5(dirname4(from), spec);
|
|
2759
2745
|
const candidates = [
|
|
2760
2746
|
basePath,
|
|
2761
2747
|
`${basePath}.ts`,
|
|
@@ -2787,7 +2773,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2787
2773
|
if (!spec.startsWith(".")) {
|
|
2788
2774
|
return null;
|
|
2789
2775
|
}
|
|
2790
|
-
const explicitPath =
|
|
2776
|
+
const explicitPath = resolve5(dirname4(from), spec);
|
|
2791
2777
|
if (extname2(explicitPath) === ".svelte") {
|
|
2792
2778
|
return explicitPath;
|
|
2793
2779
|
}
|
|
@@ -3744,5 +3730,5 @@ export {
|
|
|
3744
3730
|
Image_default as Image
|
|
3745
3731
|
};
|
|
3746
3732
|
|
|
3747
|
-
//# debugId=
|
|
3733
|
+
//# debugId=B302B91F64F4530864756E2164756E21
|
|
3748
3734
|
//# sourceMappingURL=index.js.map
|