@absolutejs/absolute 0.19.0-beta.692 → 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 +122 -108
- package/dist/angular/index.js.map +4 -4
- package/dist/angular/server.js +104 -90
- package/dist/angular/server.js.map +4 -4
- package/dist/build.js +309 -284
- package/dist/build.js.map +9 -9
- package/dist/index.js +336 -310
- package/dist/index.js.map +10 -10
- package/dist/islands/index.js +64 -50
- package/dist/islands/index.js.map +3 -3
- package/dist/react/index.js +64 -50
- 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 +68 -54
- package/dist/svelte/index.js.map +3 -3
- package/dist/svelte/server.js +64 -50
- package/dist/svelte/server.js.map +3 -3
- package/dist/types/build.d.ts +28 -0
- package/dist/vue/index.js +64 -50
- package/dist/vue/index.js.map +3 -3
- package/package.json +7 -7
package/dist/vue/index.js
CHANGED
|
@@ -2568,7 +2568,7 @@ var init_lowerAwaitSlotSyntax = __esm(() => {
|
|
|
2568
2568
|
// src/build/stylePreprocessor.ts
|
|
2569
2569
|
import { readFile } from "fs/promises";
|
|
2570
2570
|
import { createRequire } from "module";
|
|
2571
|
-
import { dirname as dirname3, extname, join as join3 } from "path";
|
|
2571
|
+
import { dirname as dirname3, extname, join as join3, resolve as resolve4 } from "path";
|
|
2572
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) => {
|
|
2573
2573
|
const normalized = filePathOrLanguage.toLowerCase();
|
|
2574
2574
|
if (normalized === "scss" || normalized.endsWith(".scss"))
|
|
@@ -2578,18 +2578,29 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2578
2578
|
if (normalized === "less" || normalized.endsWith(".less"))
|
|
2579
2579
|
return "less";
|
|
2580
2580
|
return null;
|
|
2581
|
-
}, missingDependencyError = (name, filePath) => new Error(`Unable to compile ${filePath}: install optional dependency "${name}" to use this stylesheet preprocessor.`),
|
|
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) => {
|
|
2582
2590
|
const language = getStyleLanguage(languageHint ?? filePath);
|
|
2583
|
-
const
|
|
2591
|
+
const rawContents = source ?? await readFile(filePath, "utf-8");
|
|
2584
2592
|
if (language === "scss" || language === "sass") {
|
|
2593
|
+
const options = getSassOptions(config, language);
|
|
2594
|
+
const packageName = options.implementation ?? "sass";
|
|
2585
2595
|
let sass;
|
|
2586
2596
|
try {
|
|
2587
|
-
sass = await importOptionalPeer(
|
|
2597
|
+
sass = await importOptionalPeer(packageName);
|
|
2588
2598
|
} catch {
|
|
2589
|
-
throw missingDependencyError(
|
|
2599
|
+
throw missingDependencyError(packageName, filePath);
|
|
2590
2600
|
}
|
|
2601
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2591
2602
|
const result = sass.compileString(contents, {
|
|
2592
|
-
loadPaths:
|
|
2603
|
+
loadPaths: normalizeLoadPaths(filePath, options.loadPaths),
|
|
2593
2604
|
style: "expanded",
|
|
2594
2605
|
syntax: language === "sass" ? "indented" : "scss",
|
|
2595
2606
|
url: new URL(`file://${filePath}`)
|
|
@@ -2597,6 +2608,7 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2597
2608
|
return result.css;
|
|
2598
2609
|
}
|
|
2599
2610
|
if (language === "less") {
|
|
2611
|
+
const options = getLessOptions(config);
|
|
2600
2612
|
let lessModule;
|
|
2601
2613
|
try {
|
|
2602
2614
|
lessModule = await importOptionalPeer("less");
|
|
@@ -2607,14 +2619,49 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2607
2619
|
const render = less?.render;
|
|
2608
2620
|
if (!render)
|
|
2609
2621
|
throw missingDependencyError("less", filePath);
|
|
2622
|
+
const contents = withAdditionalData(rawContents, options.additionalData);
|
|
2610
2623
|
const result = await render(contents, {
|
|
2624
|
+
...options.options ?? {},
|
|
2611
2625
|
filename: filePath,
|
|
2612
|
-
paths:
|
|
2626
|
+
paths: normalizeLoadPaths(filePath, options.paths)
|
|
2613
2627
|
});
|
|
2614
2628
|
return result.css;
|
|
2615
2629
|
}
|
|
2616
|
-
return
|
|
2617
|
-
},
|
|
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) => ({
|
|
2618
2665
|
style: async ({
|
|
2619
2666
|
attributes,
|
|
2620
2667
|
content,
|
|
@@ -2625,14 +2672,14 @@ var STYLE_EXTENSION_PATTERN, STYLE_MODULE_EXTENSION_PATTERN, STYLE_LANGUAGE_PATT
|
|
|
2625
2672
|
return;
|
|
2626
2673
|
const path = filename ?? `style.${language}`;
|
|
2627
2674
|
return {
|
|
2628
|
-
code: await compileStyleSource(path, content, language)
|
|
2675
|
+
code: await compileStyleSource(path, content, language, config)
|
|
2629
2676
|
};
|
|
2630
2677
|
}
|
|
2631
|
-
}), compileStyleFileIfNeeded = async (filePath) => {
|
|
2678
|
+
}), compileStyleFileIfNeeded = async (filePath, config) => {
|
|
2632
2679
|
if (!isPreprocessableStylePath(filePath)) {
|
|
2633
2680
|
return readFile(filePath, "utf-8");
|
|
2634
2681
|
}
|
|
2635
|
-
return compileStyleSource(filePath);
|
|
2682
|
+
return compileStyleSource(filePath, undefined, undefined, config);
|
|
2636
2683
|
};
|
|
2637
2684
|
var init_stylePreprocessor = __esm(() => {
|
|
2638
2685
|
STYLE_EXTENSION_PATTERN = /\.(s[ac]ss|less)$/i;
|
|
@@ -2641,45 +2688,12 @@ var init_stylePreprocessor = __esm(() => {
|
|
|
2641
2688
|
importOptionalPeer = new Function("specifier", "return import(specifier)");
|
|
2642
2689
|
requireOptionalPeer = new Function("specifier", "return require(specifier)");
|
|
2643
2690
|
requireFromCwd = createRequire(join3(process.cwd(), "package.json"));
|
|
2644
|
-
stylePreprocessorPlugin =
|
|
2645
|
-
name: "absolute-style-preprocessor",
|
|
2646
|
-
setup(build) {
|
|
2647
|
-
const cssModuleSources = new Map;
|
|
2648
|
-
build.onResolve({ filter: /^absolute-style-module:/ }, ({ path }) => ({
|
|
2649
|
-
namespace: "absolute-style-module",
|
|
2650
|
-
path: path.slice("absolute-style-module:".length)
|
|
2651
|
-
}));
|
|
2652
|
-
build.onLoad({ filter: /\.module\.css$/i, namespace: "absolute-style-module" }, async ({ path }) => {
|
|
2653
|
-
const sourcePath = cssModuleSources.get(path);
|
|
2654
|
-
if (!sourcePath) {
|
|
2655
|
-
throw new Error(`Unable to resolve CSS module source for ${path}`);
|
|
2656
|
-
}
|
|
2657
|
-
return {
|
|
2658
|
-
contents: await compileStyleSource(sourcePath),
|
|
2659
|
-
loader: "css"
|
|
2660
|
-
};
|
|
2661
|
-
});
|
|
2662
|
-
build.onLoad({ filter: STYLE_EXTENSION_PATTERN }, async ({ path }) => {
|
|
2663
|
-
if (isStyleModulePath(path)) {
|
|
2664
|
-
const cssModulePath = path.replace(STYLE_EXTENSION_PATTERN, ".css");
|
|
2665
|
-
cssModuleSources.set(cssModulePath, path);
|
|
2666
|
-
return {
|
|
2667
|
-
contents: `export { default } from ${JSON.stringify(`absolute-style-module:${cssModulePath}`)};`,
|
|
2668
|
-
loader: "js"
|
|
2669
|
-
};
|
|
2670
|
-
}
|
|
2671
|
-
return {
|
|
2672
|
-
contents: await compileStyleSource(path),
|
|
2673
|
-
loader: "css"
|
|
2674
|
-
};
|
|
2675
|
-
});
|
|
2676
|
-
}
|
|
2677
|
-
};
|
|
2691
|
+
stylePreprocessorPlugin = createStylePreprocessorPlugin();
|
|
2678
2692
|
});
|
|
2679
2693
|
|
|
2680
2694
|
// src/core/svelteServerModule.ts
|
|
2681
2695
|
import { mkdir, readdir as readdir2 } from "fs/promises";
|
|
2682
|
-
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";
|
|
2683
2697
|
var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
2684
2698
|
const importPath = relative(dirname4(from), target).replace(/\\/g, "/");
|
|
2685
2699
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
@@ -2727,7 +2741,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2727
2741
|
if (!spec.startsWith(".")) {
|
|
2728
2742
|
return null;
|
|
2729
2743
|
}
|
|
2730
|
-
const basePath =
|
|
2744
|
+
const basePath = resolve5(dirname4(from), spec);
|
|
2731
2745
|
const candidates = [
|
|
2732
2746
|
basePath,
|
|
2733
2747
|
`${basePath}.ts`,
|
|
@@ -2759,7 +2773,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, transpiler, e
|
|
|
2759
2773
|
if (!spec.startsWith(".")) {
|
|
2760
2774
|
return null;
|
|
2761
2775
|
}
|
|
2762
|
-
const explicitPath =
|
|
2776
|
+
const explicitPath = resolve5(dirname4(from), spec);
|
|
2763
2777
|
if (extname2(explicitPath) === ".svelte") {
|
|
2764
2778
|
return explicitPath;
|
|
2765
2779
|
}
|
|
@@ -3716,5 +3730,5 @@ export {
|
|
|
3716
3730
|
Image_default as Image
|
|
3717
3731
|
};
|
|
3718
3732
|
|
|
3719
|
-
//# debugId=
|
|
3733
|
+
//# debugId=B302B91F64F4530864756E2164756E21
|
|
3720
3734
|
//# sourceMappingURL=index.js.map
|