@shop-on/theme-loader 0.2.0 → 0.4.0
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/disk.js +4 -2
- package/package.json +5 -5
package/dist/disk.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { buildSectionInstance } from "@shop-on/theme-contract";
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { currentPresetHandle, mergePresetJson } from "@shop-on/theme-contract/preset-listing";
|
|
4
|
+
import { currentPresetHandle, mergePresetJson, normalizePresetKey } from "@shop-on/theme-contract/preset-listing";
|
|
5
5
|
import { loadBlockSchemasFrom, loadSectionSchemasFrom } from "@shop-on/theme-system";
|
|
6
6
|
//#region src/disk.ts
|
|
7
7
|
/** Path-segment guard for anything that reaches the disk loaders — template
|
|
@@ -14,7 +14,9 @@ async function readJson(filePath) {
|
|
|
14
14
|
function extractPresetSettings(data) {
|
|
15
15
|
if (data && typeof data === "object" && "presets" in data) {
|
|
16
16
|
const d = data;
|
|
17
|
-
|
|
17
|
+
const override = typeof process === "undefined" ? void 0 : process.env.THEME_PRESET;
|
|
18
|
+
const overrideKey = override ? Object.keys(d.presets ?? {}).find((key) => normalizePresetKey(key) === normalizePresetKey(override)) : void 0;
|
|
19
|
+
return d.presets?.[overrideKey ?? d.current?.preset ?? ""]?.settings ?? {};
|
|
18
20
|
}
|
|
19
21
|
return data ?? {};
|
|
20
22
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shop-on/theme-loader",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"license": "SEE LICENSE IN dist/LICENSE.md",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"./package.json": "./package.json"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@shop-on/theme-contract": "0.
|
|
26
|
-
"@shop-on/theme-
|
|
27
|
-
"@shop-on/theme-runtime": "0.
|
|
28
|
-
"@shop-on/theme-
|
|
25
|
+
"@shop-on/theme-contract": "0.4.0",
|
|
26
|
+
"@shop-on/theme-server": "0.4.0",
|
|
27
|
+
"@shop-on/theme-runtime": "0.4.0",
|
|
28
|
+
"@shop-on/theme-system": "0.4.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "26.6.5",
|