@salesforce/storefront-next-dev 0.1.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/LICENSE.txt +181 -0
- package/README.md +302 -0
- package/dist/cartridge-services/index.d.ts +60 -0
- package/dist/cartridge-services/index.d.ts.map +1 -0
- package/dist/cartridge-services/index.js +954 -0
- package/dist/cartridge-services/index.js.map +1 -0
- package/dist/cli.js +3373 -0
- package/dist/configs/react-router.config.d.ts +13 -0
- package/dist/configs/react-router.config.d.ts.map +1 -0
- package/dist/configs/react-router.config.js +36 -0
- package/dist/configs/react-router.config.js.map +1 -0
- package/dist/extensibility/templates/install-instructions.mdc.hbs +192 -0
- package/dist/extensibility/templates/uninstall-instructions.mdc.hbs +137 -0
- package/dist/index.d.ts +327 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2606 -0
- package/dist/index.js.map +1 -0
- package/dist/mrt/sfnext-server-chunk-DUt5XHAg.mjs +1 -0
- package/dist/mrt/sfnext-server-jiti-DjnmHo-6.mjs +10 -0
- package/dist/mrt/sfnext-server-jiti-DjnmHo-6.mjs.map +1 -0
- package/dist/mrt/ssr.d.ts +19 -0
- package/dist/mrt/ssr.d.ts.map +1 -0
- package/dist/mrt/ssr.mjs +246 -0
- package/dist/mrt/ssr.mjs.map +1 -0
- package/dist/mrt/streamingHandler.d.ts +11 -0
- package/dist/mrt/streamingHandler.d.ts.map +1 -0
- package/dist/mrt/streamingHandler.mjs +255 -0
- package/dist/mrt/streamingHandler.mjs.map +1 -0
- package/dist/react-router/Scripts.d.ts +36 -0
- package/dist/react-router/Scripts.d.ts.map +1 -0
- package/dist/react-router/Scripts.js +68 -0
- package/dist/react-router/Scripts.js.map +1 -0
- package/package.json +157 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Scripts as Scripts$1 } from "react-router";
|
|
2
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/react-router/Scripts.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Enhanced Scripts component that wraps React Router's Scripts component with Odyssey-specific functionality.
|
|
8
|
+
*
|
|
9
|
+
* This component extends the standard React Router Scripts component by injecting additional
|
|
10
|
+
* bundle configuration scripts during server-side rendering. It ensures that bundle metadata
|
|
11
|
+
* (ID and path) are available on the client before any other scripts execute.
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* ```tsx
|
|
15
|
+
* import { Outlet, Scripts } from 'react-router';
|
|
16
|
+
*
|
|
17
|
+
* export default function Root() {
|
|
18
|
+
* return (
|
|
19
|
+
* <html>
|
|
20
|
+
* <head>...</head>
|
|
21
|
+
* <body>
|
|
22
|
+
* <Outlet />
|
|
23
|
+
* <Scripts />
|
|
24
|
+
* </body>
|
|
25
|
+
* </html>
|
|
26
|
+
* );
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @param props - Props passed through to the underlying React Router Scripts component
|
|
31
|
+
* @returns A fragment containing internal bundle scripts and React Router scripts
|
|
32
|
+
*/
|
|
33
|
+
declare function Scripts(props: React.ComponentProps<typeof Scripts$1>): react_jsx_runtime0.JSX.Element;
|
|
34
|
+
//#endregion
|
|
35
|
+
export { Scripts };
|
|
36
|
+
//# sourceMappingURL=Scripts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Scripts.d.ts","names":[],"sources":["../../src/react-router/Scripts.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoFgB,OAAA,QAAe,KAAA,CAAM,sBAAsB,aAAmB,kBAAA,CAAA,GAAA,CAAA"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Scripts as Scripts$1 } from "react-router";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region src/react-router/Scripts.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Determines if the code is running in a server-side rendering (SSR) environment.
|
|
7
|
+
* Returns true when window is undefined (server), false otherwise (client).
|
|
8
|
+
*/
|
|
9
|
+
const isSSR = typeof window === "undefined";
|
|
10
|
+
/**
|
|
11
|
+
* Internal component that injects bundle configuration scripts during server-side rendering.
|
|
12
|
+
*
|
|
13
|
+
* This component renders a script tag that sets up global bundle variables on the window object,
|
|
14
|
+
* which are used by the client-side application to locate and load the correct bundle assets.
|
|
15
|
+
*
|
|
16
|
+
* The script defines:
|
|
17
|
+
* - `window._BUNDLE_ID`: The unique identifier for the current bundle (from BUNDLE_ID env var, defaults to 'local')
|
|
18
|
+
* - `window._BUNDLE_PATH`: The path to the client bundle assets (e.g., `/mobify/bundle/{bundleId}/client/`)
|
|
19
|
+
*
|
|
20
|
+
* @returns A script element during SSR, or null during client-side rendering
|
|
21
|
+
* @internal
|
|
22
|
+
*/
|
|
23
|
+
const InternalServerScripts = () => {
|
|
24
|
+
if (!isSSR) return null;
|
|
25
|
+
const bundleId = process.env.BUNDLE_ID || "local";
|
|
26
|
+
const bundlePath = `/mobify/bundle/${bundleId}/client/`;
|
|
27
|
+
return /* @__PURE__ */ jsx("script", {
|
|
28
|
+
id: "sf-next-bundle-config",
|
|
29
|
+
dangerouslySetInnerHTML: { __html: `
|
|
30
|
+
window._BUNDLE_ID = ${JSON.stringify(bundleId)};
|
|
31
|
+
window._BUNDLE_PATH = ${JSON.stringify(bundlePath)};
|
|
32
|
+
` }
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Enhanced Scripts component that wraps React Router's Scripts component with Odyssey-specific functionality.
|
|
37
|
+
*
|
|
38
|
+
* This component extends the standard React Router Scripts component by injecting additional
|
|
39
|
+
* bundle configuration scripts during server-side rendering. It ensures that bundle metadata
|
|
40
|
+
* (ID and path) are available on the client before any other scripts execute.
|
|
41
|
+
*
|
|
42
|
+
* Usage:
|
|
43
|
+
* ```tsx
|
|
44
|
+
* import { Outlet, Scripts } from 'react-router';
|
|
45
|
+
*
|
|
46
|
+
* export default function Root() {
|
|
47
|
+
* return (
|
|
48
|
+
* <html>
|
|
49
|
+
* <head>...</head>
|
|
50
|
+
* <body>
|
|
51
|
+
* <Outlet />
|
|
52
|
+
* <Scripts />
|
|
53
|
+
* </body>
|
|
54
|
+
* </html>
|
|
55
|
+
* );
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @param props - Props passed through to the underlying React Router Scripts component
|
|
60
|
+
* @returns A fragment containing internal bundle scripts and React Router scripts
|
|
61
|
+
*/
|
|
62
|
+
function Scripts(props) {
|
|
63
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(InternalServerScripts, {}), /* @__PURE__ */ jsx(Scripts$1, { ...props })] });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
//#endregion
|
|
67
|
+
export { Scripts };
|
|
68
|
+
//# sourceMappingURL=Scripts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Scripts.js","names":["ReactRouterScripts"],"sources":["../../src/react-router/Scripts.tsx"],"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 */\nimport { Scripts as ReactRouterScripts } from 'react-router';\n\n/**\n * Determines if the code is running in a server-side rendering (SSR) environment.\n * Returns true when window is undefined (server), false otherwise (client).\n */\nconst isSSR = typeof window === 'undefined';\n\n/**\n * Internal component that injects bundle configuration scripts during server-side rendering.\n *\n * This component renders a script tag that sets up global bundle variables on the window object,\n * which are used by the client-side application to locate and load the correct bundle assets.\n *\n * The script defines:\n * - `window._BUNDLE_ID`: The unique identifier for the current bundle (from BUNDLE_ID env var, defaults to 'local')\n * - `window._BUNDLE_PATH`: The path to the client bundle assets (e.g., `/mobify/bundle/{bundleId}/client/`)\n *\n * @returns A script element during SSR, or null during client-side rendering\n * @internal\n */\nconst InternalServerScripts = () => {\n if (!isSSR) {\n return null;\n }\n\n const bundleId = process.env.BUNDLE_ID || 'local';\n const bundlePath = `/mobify/bundle/${bundleId}/client/`;\n return (\n <script\n id=\"sf-next-bundle-config\"\n // eslint-disable-next-line react/no-danger\n dangerouslySetInnerHTML={{\n __html: `\n window._BUNDLE_ID = ${JSON.stringify(bundleId)};\n window._BUNDLE_PATH = ${JSON.stringify(bundlePath)};\n `,\n }}\n />\n );\n};\n\n/**\n * Enhanced Scripts component that wraps React Router's Scripts component with Odyssey-specific functionality.\n *\n * This component extends the standard React Router Scripts component by injecting additional\n * bundle configuration scripts during server-side rendering. It ensures that bundle metadata\n * (ID and path) are available on the client before any other scripts execute.\n *\n * Usage:\n * ```tsx\n * import { Outlet, Scripts } from 'react-router';\n *\n * export default function Root() {\n * return (\n * <html>\n * <head>...</head>\n * <body>\n * <Outlet />\n * <Scripts />\n * </body>\n * </html>\n * );\n * }\n * ```\n *\n * @param props - Props passed through to the underlying React Router Scripts component\n * @returns A fragment containing internal bundle scripts and React Router scripts\n */\nexport function Scripts(props: React.ComponentProps<typeof ReactRouterScripts>) {\n return (\n <>\n <InternalServerScripts />\n <ReactRouterScripts {...props} />\n </>\n );\n}\n"],"mappings":";;;;;;;;AAqBA,MAAM,QAAQ,OAAO,WAAW;;;;;;;;;;;;;;AAehC,MAAM,8BAA8B;AAChC,KAAI,CAAC,MACD,QAAO;CAGX,MAAM,WAAW,QAAQ,IAAI,aAAa;CAC1C,MAAM,aAAa,kBAAkB,SAAS;AAC9C,QACI,oBAAC;EACG,IAAG;EAEH,yBAAyB,EACrB,QAAQ;8BACM,KAAK,UAAU,SAAS,CAAC;gCACvB,KAAK,UAAU,WAAW,CAAC;OAE9C;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BV,SAAgB,QAAQ,OAAwD;AAC5E,QACI,4CACI,oBAAC,0BAAwB,EACzB,oBAACA,aAAmB,GAAI,QAAS,IAClC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@salesforce/storefront-next-dev",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Dev and build tools for SFCC Storefront Next",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"./react-router-preset": {
|
|
17
|
+
"import": {
|
|
18
|
+
"types": "./dist/configs/react-router.config.d.ts",
|
|
19
|
+
"default": "./dist/configs/react-router.config.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"./react-router/Scripts": {
|
|
23
|
+
"import": {
|
|
24
|
+
"types": "./dist/react-router/Scripts.d.ts",
|
|
25
|
+
"default": "./dist/react-router/Scripts.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"./mrt/streamingHandler": {
|
|
29
|
+
"import": {
|
|
30
|
+
"types": "./dist/mrt/streamingHandler.d.ts",
|
|
31
|
+
"default": "./dist/mrt/streamingHandler.mjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"./mrt/ssr": {
|
|
35
|
+
"import": {
|
|
36
|
+
"types": "./dist/mrt/ssr.d.ts",
|
|
37
|
+
"default": "./dist/mrt/ssr.mjs"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"./cartridge-services": {
|
|
41
|
+
"import": {
|
|
42
|
+
"types": "./dist/cartridge-services/index.d.ts",
|
|
43
|
+
"default": "./dist/cartridge-services/index.js"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"bin": {
|
|
48
|
+
"sfnext": "./dist/cli.js"
|
|
49
|
+
},
|
|
50
|
+
"files": [
|
|
51
|
+
"dist"
|
|
52
|
+
],
|
|
53
|
+
"keywords": [
|
|
54
|
+
"vite",
|
|
55
|
+
"plugin",
|
|
56
|
+
"salesforce",
|
|
57
|
+
"storefront-next",
|
|
58
|
+
"commerce-cloud",
|
|
59
|
+
"pwa-kit",
|
|
60
|
+
"deployment",
|
|
61
|
+
"bundle"
|
|
62
|
+
],
|
|
63
|
+
"author": "cc-pwa-kit@salesforce.com",
|
|
64
|
+
"license": "Apache-2.0",
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"@react-router/dev": ">=7.0.0",
|
|
67
|
+
"react": ">=19.0.0",
|
|
68
|
+
"react-dom": ">=19.0.0",
|
|
69
|
+
"react-router": ">=7.0.0",
|
|
70
|
+
"vite": ">=7.0.0"
|
|
71
|
+
},
|
|
72
|
+
"devDependencies": {
|
|
73
|
+
"@react-router/dev": "7.12.0",
|
|
74
|
+
"@serverless/event-mocks": "1.1.1",
|
|
75
|
+
"@types/archiver": "^6.0.2",
|
|
76
|
+
"@types/aws-lambda": "8.10.159",
|
|
77
|
+
"@types/babel__generator": "7.27.0",
|
|
78
|
+
"@types/babel__traverse": "7.28.0",
|
|
79
|
+
"@types/compressible": "2.0.3",
|
|
80
|
+
"@types/compression": "^1.7.5",
|
|
81
|
+
"@types/express": "4.17.23",
|
|
82
|
+
"@types/fs-extra": "^11.0.4",
|
|
83
|
+
"@types/glob": "^8.1.0",
|
|
84
|
+
"@types/handlebars": "^4.1.0",
|
|
85
|
+
"@types/jest": "30.0.0",
|
|
86
|
+
"@types/minimatch": "^5.1.2",
|
|
87
|
+
"@types/morgan": "^1.9.9",
|
|
88
|
+
"@types/negotiator": "0.6.4",
|
|
89
|
+
"@types/node": "^24.0.0",
|
|
90
|
+
"@types/prompts": "2.4.9",
|
|
91
|
+
"@types/react": "19.1.13",
|
|
92
|
+
"@types/react-dom": "19.1.9",
|
|
93
|
+
"@types/semver": "7.7.1",
|
|
94
|
+
"@vitest/coverage-v8": "4.0.18",
|
|
95
|
+
"fs-extra": "11.3.2",
|
|
96
|
+
"jest": "^29.7.0",
|
|
97
|
+
"memfs": "^4.42.0",
|
|
98
|
+
"react": "19.2.3",
|
|
99
|
+
"react-dom": "19.2.3",
|
|
100
|
+
"react-router": "7.12.0",
|
|
101
|
+
"shx": "^0.4.0",
|
|
102
|
+
"ts-jest": "29.4.1",
|
|
103
|
+
"tsdown": "^0.15.4",
|
|
104
|
+
"typescript": "^5.6.0",
|
|
105
|
+
"vite": "7.1.7",
|
|
106
|
+
"vitest": "4.0.18"
|
|
107
|
+
},
|
|
108
|
+
"dependencies": {
|
|
109
|
+
"@babel/parser": "^7.28.4",
|
|
110
|
+
"@babel/traverse": "^7.28.4",
|
|
111
|
+
"@babel/types": "7.28.4",
|
|
112
|
+
"@babel/generator": "7.28.5",
|
|
113
|
+
"@codegenie/serverless-express": "4.17.0",
|
|
114
|
+
"@h4ad/serverless-adapter": "4.4.0",
|
|
115
|
+
"@react-router/express": "7.12.0",
|
|
116
|
+
"archiver": "^7.0.1",
|
|
117
|
+
"chalk": "^5.3.0",
|
|
118
|
+
"commander": "^12.1.0",
|
|
119
|
+
"compressible": "2.0.18",
|
|
120
|
+
"compression": "^1.7.4",
|
|
121
|
+
"dotenv": "^16.4.7",
|
|
122
|
+
"express": "4.21.2",
|
|
123
|
+
"fs-extra": "^11.2.0",
|
|
124
|
+
"glob": "^11.0.0",
|
|
125
|
+
"handlebars": "4.7.8",
|
|
126
|
+
"http-proxy-middleware": "^3.0.0",
|
|
127
|
+
"jiti": "^2.6.1",
|
|
128
|
+
"minimatch": "^10.0.1",
|
|
129
|
+
"morgan": "^1.10.0",
|
|
130
|
+
"negotiator": "1.0.0",
|
|
131
|
+
"npm-run-path": "6.0.0",
|
|
132
|
+
"prompts": "2.4.2",
|
|
133
|
+
"ts-morph": "^24.0.0",
|
|
134
|
+
"tsx": "^4.20.5",
|
|
135
|
+
"undici": "^6.21.3",
|
|
136
|
+
"zod": "4.1.13"
|
|
137
|
+
},
|
|
138
|
+
"engines": {
|
|
139
|
+
"node": ">=24.0.0"
|
|
140
|
+
},
|
|
141
|
+
"publishConfig": {
|
|
142
|
+
"access": "public"
|
|
143
|
+
},
|
|
144
|
+
"scripts": {
|
|
145
|
+
"build": "tsdown",
|
|
146
|
+
"dev": "tsdown --watch",
|
|
147
|
+
"test": "pnpm typecheck && vitest --run --coverage",
|
|
148
|
+
"typecheck": "tsc --noEmit",
|
|
149
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
150
|
+
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
151
|
+
"clean": "shx rm -rf dist",
|
|
152
|
+
"push": "node dist/cli.js push",
|
|
153
|
+
"create-bundle": "node dist/cli.js create-bundle",
|
|
154
|
+
"generate-cartridge": "node dist/cli.js generate-cartridge",
|
|
155
|
+
"deploy-cartridge": "node dist/cli.js deploy-cartridge"
|
|
156
|
+
}
|
|
157
|
+
}
|