@salesforce/storefront-next-dev 0.4.0-alpha.1 → 0.4.0-alpha.2
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/commands/dev.js +43 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/logger.js +1 -1
- package/dist/mrt/ssr.mjs +51 -51
- package/dist/mrt/ssr.mjs.map +1 -1
- package/dist/mrt/streamingHandler.mjs +57 -57
- package/dist/mrt/streamingHandler.mjs.map +1 -1
- package/package.json +1 -7
- package/dist/data-store/local-provider.d.ts +0 -42
- package/dist/data-store/local-provider.d.ts.map +0 -1
- package/dist/data-store/local-provider.js +0 -66
- package/dist/data-store/local-provider.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/storefront-next-dev",
|
|
3
|
-
"version": "0.4.0-alpha.
|
|
3
|
+
"version": "0.4.0-alpha.2",
|
|
4
4
|
"description": "Dev and build tools for SFCC Storefront Next",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -13,12 +13,6 @@
|
|
|
13
13
|
"default": "./dist/index.js"
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
|
-
"./data-store/local-provider": {
|
|
17
|
-
"import": {
|
|
18
|
-
"types": "./dist/data-store/local-provider.d.ts",
|
|
19
|
-
"default": "./dist/data-store/local-provider.js"
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
16
|
"./logger": {
|
|
23
17
|
"import": {
|
|
24
18
|
"types": "./dist/logger/index.d.ts",
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
//#region src/data-store/local-provider.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Copyright 2026 Salesforce, Inc.
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
type DataStoreEntry = {
|
|
18
|
-
value?: unknown;
|
|
19
|
-
};
|
|
20
|
-
type LocalDataStoreProvider = {
|
|
21
|
-
kind: 'local';
|
|
22
|
-
getEntry: (key: string) => Promise<DataStoreEntry | null>;
|
|
23
|
-
};
|
|
24
|
-
type LocalDataStoreProviderOptions = {
|
|
25
|
-
defaults?: Record<string, Record<string, unknown>>;
|
|
26
|
-
warnOnMissing?: boolean;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Create a local data-store provider for development environments.
|
|
30
|
-
*
|
|
31
|
-
* Environment variables:
|
|
32
|
-
* - `SFNEXT_DATA_STORE_DEFAULTS` (optional): JSON map of keys to preference objects.
|
|
33
|
-
* Example: {"custom-global-preferences":{"featureFlag":true}}
|
|
34
|
-
* - `SFNEXT_DATA_STORE_WARN_ON_MISSING` (optional): Set to "false" to silence warnings.
|
|
35
|
-
*
|
|
36
|
-
* @param options - Optional defaults and warning controls for local entries.
|
|
37
|
-
* @returns Local provider that supplies preferences from defaults or empty values.
|
|
38
|
-
*/
|
|
39
|
-
declare function createLocalDataStoreProvider(options?: LocalDataStoreProviderOptions): LocalDataStoreProvider;
|
|
40
|
-
//#endregion
|
|
41
|
-
export { LocalDataStoreProvider, createLocalDataStoreProvider };
|
|
42
|
-
//# sourceMappingURL=local-provider.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"local-provider.d.ts","names":[],"sources":["../../src/data-store/local-provider.ts"],"sourcesContent":[],"mappings":";;;AAoBA;AAGE;AAkBF;;;;;;;;;;;KAzBK,cAAA;;;KAIO,sBAAA;;6BAEmB,QAAQ;;KAGlC,6BAAA;aACU,eAAe;;;;;;;;;;;;;;iBAed,4BAAA,WAAsC,gCAAqC"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
//#region src/data-store/local-provider.ts
|
|
2
|
-
/**
|
|
3
|
-
* Create a local data-store provider for development environments.
|
|
4
|
-
*
|
|
5
|
-
* Environment variables:
|
|
6
|
-
* - `SFNEXT_DATA_STORE_DEFAULTS` (optional): JSON map of keys to preference objects.
|
|
7
|
-
* Example: {"custom-global-preferences":{"featureFlag":true}}
|
|
8
|
-
* - `SFNEXT_DATA_STORE_WARN_ON_MISSING` (optional): Set to "false" to silence warnings.
|
|
9
|
-
*
|
|
10
|
-
* @param options - Optional defaults and warning controls for local entries.
|
|
11
|
-
* @returns Local provider that supplies preferences from defaults or empty values.
|
|
12
|
-
*/
|
|
13
|
-
function createLocalDataStoreProvider(options = {}) {
|
|
14
|
-
const defaults = options.defaults ?? readDefaultsFromEnv();
|
|
15
|
-
const warnOnMissing = options.warnOnMissing ?? readWarnOnMissingFromEnv();
|
|
16
|
-
const warnedKeys = /* @__PURE__ */ new Set();
|
|
17
|
-
return {
|
|
18
|
-
kind: "local",
|
|
19
|
-
getEntry(key) {
|
|
20
|
-
const value = defaults[key];
|
|
21
|
-
if (value && typeof value === "object") return Promise.resolve({ value });
|
|
22
|
-
if (warnOnMissing && !warnedKeys.has(key)) {
|
|
23
|
-
warnedKeys.add(key);
|
|
24
|
-
console.warn(`Local data-store provider did not find '${key}'. Returning an empty object for development.`);
|
|
25
|
-
}
|
|
26
|
-
return Promise.resolve({ value: {} });
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Read default data-store entries from the environment.
|
|
32
|
-
*
|
|
33
|
-
* Environment variables:
|
|
34
|
-
* - `SFNEXT_DATA_STORE_DEFAULTS` (optional): JSON map of keys to preference objects.
|
|
35
|
-
* Example: {"custom-global-preferences":{"featureFlag":true}}
|
|
36
|
-
*
|
|
37
|
-
* @returns Parsed defaults map or an empty object.
|
|
38
|
-
*/
|
|
39
|
-
function readDefaultsFromEnv() {
|
|
40
|
-
const raw = process.env.SFNEXT_DATA_STORE_DEFAULTS;
|
|
41
|
-
if (!raw) return {};
|
|
42
|
-
try {
|
|
43
|
-
const parsed = JSON.parse(raw);
|
|
44
|
-
if (parsed && typeof parsed === "object") return parsed;
|
|
45
|
-
} catch (error) {
|
|
46
|
-
console.warn("Failed to parse SFNEXT_DATA_STORE_DEFAULTS JSON.", error);
|
|
47
|
-
}
|
|
48
|
-
return {};
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Read warn-on-missing behavior from the environment.
|
|
52
|
-
*
|
|
53
|
-
* Environment variables:
|
|
54
|
-
* - `SFNEXT_DATA_STORE_WARN_ON_MISSING` (optional): Set to "false" to silence warnings.
|
|
55
|
-
*
|
|
56
|
-
* @returns True when warnings should be emitted for missing entries.
|
|
57
|
-
*/
|
|
58
|
-
function readWarnOnMissingFromEnv() {
|
|
59
|
-
const raw = process.env.SFNEXT_DATA_STORE_WARN_ON_MISSING;
|
|
60
|
-
if (!raw) return true;
|
|
61
|
-
return raw.toLowerCase() !== "false";
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
//#endregion
|
|
65
|
-
export { createLocalDataStoreProvider };
|
|
66
|
-
//# sourceMappingURL=local-provider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"local-provider.js","names":[],"sources":["../../src/data-store/local-provider.ts"],"sourcesContent":["/**\n * Copyright 2026 Salesforce, Inc.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntype DataStoreEntry = {\n value?: unknown;\n};\n\nexport type LocalDataStoreProvider = {\n kind: 'local';\n getEntry: (key: string) => Promise<DataStoreEntry | null>;\n};\n\ntype LocalDataStoreProviderOptions = {\n defaults?: Record<string, Record<string, unknown>>;\n warnOnMissing?: boolean;\n};\n\n/**\n * Create a local data-store provider for development environments.\n *\n * Environment variables:\n * - `SFNEXT_DATA_STORE_DEFAULTS` (optional): JSON map of keys to preference objects.\n * Example: {\"custom-global-preferences\":{\"featureFlag\":true}}\n * - `SFNEXT_DATA_STORE_WARN_ON_MISSING` (optional): Set to \"false\" to silence warnings.\n *\n * @param options - Optional defaults and warning controls for local entries.\n * @returns Local provider that supplies preferences from defaults or empty values.\n */\nexport function createLocalDataStoreProvider(options: LocalDataStoreProviderOptions = {}): LocalDataStoreProvider {\n const defaults = options.defaults ?? readDefaultsFromEnv();\n const warnOnMissing = options.warnOnMissing ?? readWarnOnMissingFromEnv();\n const warnedKeys = new Set<string>();\n\n return {\n kind: 'local',\n getEntry(key: string) {\n const value = defaults[key];\n if (value && typeof value === 'object') {\n return Promise.resolve({ value });\n }\n\n if (warnOnMissing && !warnedKeys.has(key)) {\n warnedKeys.add(key);\n // eslint-disable-next-line no-console\n console.warn(\n `Local data-store provider did not find '${key}'. Returning an empty object for development.`\n );\n }\n\n return Promise.resolve({ value: {} });\n },\n };\n}\n\n/**\n * Read default data-store entries from the environment.\n *\n * Environment variables:\n * - `SFNEXT_DATA_STORE_DEFAULTS` (optional): JSON map of keys to preference objects.\n * Example: {\"custom-global-preferences\":{\"featureFlag\":true}}\n *\n * @returns Parsed defaults map or an empty object.\n */\nfunction readDefaultsFromEnv(): Record<string, Record<string, unknown>> {\n const raw = process.env.SFNEXT_DATA_STORE_DEFAULTS;\n if (!raw) {\n return {};\n }\n\n try {\n const parsed = JSON.parse(raw);\n if (parsed && typeof parsed === 'object') {\n return parsed as Record<string, Record<string, unknown>>;\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.warn('Failed to parse SFNEXT_DATA_STORE_DEFAULTS JSON.', error);\n }\n\n return {};\n}\n\n/**\n * Read warn-on-missing behavior from the environment.\n *\n * Environment variables:\n * - `SFNEXT_DATA_STORE_WARN_ON_MISSING` (optional): Set to \"false\" to silence warnings.\n *\n * @returns True when warnings should be emitted for missing entries.\n */\nfunction readWarnOnMissingFromEnv(): boolean {\n const raw = process.env.SFNEXT_DATA_STORE_WARN_ON_MISSING;\n if (!raw) {\n return true;\n }\n return raw.toLowerCase() !== 'false';\n}\n"],"mappings":";;;;;;;;;;;;AAyCA,SAAgB,6BAA6B,UAAyC,EAAE,EAA0B;CAC9G,MAAM,WAAW,QAAQ,YAAY,qBAAqB;CAC1D,MAAM,gBAAgB,QAAQ,iBAAiB,0BAA0B;CACzE,MAAM,6BAAa,IAAI,KAAa;AAEpC,QAAO;EACH,MAAM;EACN,SAAS,KAAa;GAClB,MAAM,QAAQ,SAAS;AACvB,OAAI,SAAS,OAAO,UAAU,SAC1B,QAAO,QAAQ,QAAQ,EAAE,OAAO,CAAC;AAGrC,OAAI,iBAAiB,CAAC,WAAW,IAAI,IAAI,EAAE;AACvC,eAAW,IAAI,IAAI;AAEnB,YAAQ,KACJ,2CAA2C,IAAI,+CAClD;;AAGL,UAAO,QAAQ,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC;;EAE5C;;;;;;;;;;;AAYL,SAAS,sBAA+D;CACpE,MAAM,MAAM,QAAQ,IAAI;AACxB,KAAI,CAAC,IACD,QAAO,EAAE;AAGb,KAAI;EACA,MAAM,SAAS,KAAK,MAAM,IAAI;AAC9B,MAAI,UAAU,OAAO,WAAW,SAC5B,QAAO;UAEN,OAAO;AAEZ,UAAQ,KAAK,oDAAoD,MAAM;;AAG3E,QAAO,EAAE;;;;;;;;;;AAWb,SAAS,2BAAoC;CACzC,MAAM,MAAM,QAAQ,IAAI;AACxB,KAAI,CAAC,IACD,QAAO;AAEX,QAAO,IAAI,aAAa,KAAK"}
|