@salesforce/storefront-next-dev 0.4.1 → 1.0.0-alpha.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/README.md +1 -1
- package/dist/cartridge-services/index.d.ts.map +1 -1
- package/dist/cartridge-services/index.js +1 -0
- package/dist/cartridge-services/index.js.map +1 -1
- package/dist/commands/extensions/install.js +1 -1
- package/dist/commands/extensions/remove.js +2 -2
- package/dist/commands/scapi/add.js +30 -9
- package/dist/commands/scapi/available.js +225 -0
- package/dist/commands/scapi/list.js +24 -11
- package/dist/commands/scapi/remove.js +8 -2
- package/dist/configs/react-router.config.d.ts +7 -0
- package/dist/configs/react-router.config.d.ts.map +1 -1
- package/dist/configs/react-router.config.js +12 -1
- package/dist/configs/react-router.config.js.map +1 -1
- package/dist/generate-cartridge.js +1 -0
- package/dist/generate-custom-clients.js +127 -7
- package/dist/hooks/init.js +1 -0
- package/dist/index.d.ts +5 -224
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +281 -1574
- package/dist/index.js.map +1 -1
- package/dist/logger.js +1 -1
- package/dist/mrt/ssr.mjs +1 -1
- package/dist/mrt/ssr.mjs.map +1 -1
- package/dist/mrt/streamingHandler.mjs +2 -2
- package/dist/mrt/streamingHandler.mjs.map +1 -1
- package/dist/react-router/Scripts.d.ts +4 -16
- package/dist/react-router/Scripts.d.ts.map +1 -1
- package/dist/react-router/Scripts.js +4 -16
- package/dist/react-router/Scripts.js.map +1 -1
- package/dist/schema-utils.js +16 -4
- package/package.json +6 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Project } from "ts-morph";
|
|
2
|
-
import {
|
|
3
|
-
import { Plugin, ResolvedConfig, ViteDevServer } from "vite";
|
|
4
|
-
import { ServerBuild } from "react-router";
|
|
2
|
+
import { Plugin, ResolvedConfig } from "vite";
|
|
5
3
|
|
|
6
4
|
//#region src/plugins/staticRegistry.d.ts
|
|
7
5
|
|
|
@@ -202,8 +200,8 @@ interface HybridProxyPluginOptions {
|
|
|
202
200
|
* hybridProxyPlugin({ routeMatcher: shouldRouteToNext, ... })
|
|
203
201
|
*/
|
|
204
202
|
routeMatcher: (pathname: string, routingRules: string) => boolean;
|
|
205
|
-
/** SFCC
|
|
206
|
-
|
|
203
|
+
/** SFCC default site ID (e.g., 'RefArchGlobal'). Required when `enabled` is true. */
|
|
204
|
+
defaultSiteId?: string;
|
|
207
205
|
/** Locale for SFRA paths (e.g., 'en-GB'). Defaults to 'default' if not provided. */
|
|
208
206
|
locale?: string;
|
|
209
207
|
}
|
|
@@ -223,60 +221,7 @@ interface HybridProxyPluginOptions {
|
|
|
223
221
|
declare function hybridProxyPlugin(options: HybridProxyPluginOptions): Plugin;
|
|
224
222
|
//#endregion
|
|
225
223
|
//#region src/plugins/ecdnMatcher.d.ts
|
|
226
|
-
|
|
227
|
-
* Copyright 2026 Salesforce, Inc.
|
|
228
|
-
*
|
|
229
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
230
|
-
* you may not use this file except in compliance with the License.
|
|
231
|
-
* You may obtain a copy of the License at
|
|
232
|
-
*
|
|
233
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
234
|
-
*
|
|
235
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
236
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
237
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
238
|
-
* See the License for the specific language governing permissions and
|
|
239
|
-
* limitations under the License.
|
|
240
|
-
*/
|
|
241
|
-
/**
|
|
242
|
-
* Extracts regex patterns from a Cloudflare routing expression.
|
|
243
|
-
*
|
|
244
|
-
* Parses Cloudflare "matches" expressions like:
|
|
245
|
-
* (http.request.uri.path matches "^/$" or http.request.uri.path matches "^/category.*")
|
|
246
|
-
*
|
|
247
|
-
* And extracts the regex patterns: ["^/$", "^/category.*"]
|
|
248
|
-
*
|
|
249
|
-
* @param expression - Cloudflare expression string
|
|
250
|
-
* @returns Array of regex pattern strings
|
|
251
|
-
*
|
|
252
|
-
* @example
|
|
253
|
-
* ```typescript
|
|
254
|
-
* extractPatterns('(http.request.uri.path matches "^/$")');
|
|
255
|
-
* // Returns: ["^/$"]
|
|
256
|
-
*
|
|
257
|
-
* extractPatterns('(http.request.uri.path matches "^/$" or http.request.uri.path matches "^/search.*")');
|
|
258
|
-
* // Returns: ["^/$", "^/search.*"]
|
|
259
|
-
* ```
|
|
260
|
-
*/
|
|
261
|
-
declare function extractPatterns(expression: string): string[];
|
|
262
|
-
/**
|
|
263
|
-
* Tests if a pathname matches any of the provided regex patterns (logical OR).
|
|
264
|
-
* Uses caching to optimize repeated pattern compilations.
|
|
265
|
-
*
|
|
266
|
-
* @param pathname - URL pathname to test (e.g., "/search", "/category/shoes")
|
|
267
|
-
* @param patterns - Array of regex pattern strings
|
|
268
|
-
* @returns true if pathname matches any pattern, false otherwise
|
|
269
|
-
*
|
|
270
|
-
* @example
|
|
271
|
-
* ```typescript
|
|
272
|
-
* testPatterns('/category/shoes', ['^/category.*', '^/search.*']);
|
|
273
|
-
* // Returns: true (matches first pattern)
|
|
274
|
-
*
|
|
275
|
-
* testPatterns('/checkout', ['^/category.*', '^/search.*']);
|
|
276
|
-
* // Returns: false (matches no patterns)
|
|
277
|
-
* ```
|
|
278
|
-
*/
|
|
279
|
-
declare function testPatterns(pathname: string, patterns: string[]): boolean;
|
|
224
|
+
|
|
280
225
|
/**
|
|
281
226
|
* Main function: Determines if a pathname should route to Storefront Next
|
|
282
227
|
* or be proxied/redirected to SFRA/legacy backend.
|
|
@@ -296,170 +241,6 @@ declare function testPatterns(pathname: string, patterns: string[]): boolean;
|
|
|
296
241
|
* ```
|
|
297
242
|
*/
|
|
298
243
|
declare function shouldRouteToNext(pathname: string, routingRules?: string): boolean;
|
|
299
|
-
/**
|
|
300
|
-
* Clears the regex cache. Useful for testing or when routing rules change.
|
|
301
|
-
*
|
|
302
|
-
* @example
|
|
303
|
-
* ```typescript
|
|
304
|
-
* clearCache();
|
|
305
|
-
* // All cached regex patterns are removed
|
|
306
|
-
* ```
|
|
307
|
-
*/
|
|
308
|
-
declare function clearCache(): void;
|
|
309
|
-
//#endregion
|
|
310
|
-
//#region src/server/config.d.ts
|
|
311
|
-
/**
|
|
312
|
-
* Server configuration extracted from environment variables
|
|
313
|
-
*/
|
|
314
|
-
interface ServerConfig {
|
|
315
|
-
commerce: {
|
|
316
|
-
api: {
|
|
317
|
-
shortCode: string;
|
|
318
|
-
organizationId: string;
|
|
319
|
-
clientId: string;
|
|
320
|
-
proxy: string;
|
|
321
|
-
proxyHost?: string;
|
|
322
|
-
};
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* This is a temporary function before we move the config implementation from
|
|
327
|
-
* template-retail-rsc-app to the SDK.
|
|
328
|
-
*
|
|
329
|
-
* @ TODO: Remove this function after we move the config implementation from
|
|
330
|
-
* template-retail-rsc-app to the SDK.
|
|
331
|
-
*
|
|
332
|
-
*/
|
|
333
|
-
declare function loadConfigFromEnv(): ServerConfig;
|
|
334
|
-
/**
|
|
335
|
-
* Load storefront-next project configuration from config.server.ts.
|
|
336
|
-
* Requires projectDirectory to be provided.
|
|
337
|
-
*
|
|
338
|
-
* @param projectDirectory - Project directory to load config.server.ts from
|
|
339
|
-
* @throws Error if config.server.ts is not found or invalid
|
|
340
|
-
*/
|
|
341
|
-
declare function loadProjectConfig(projectDirectory: string): Promise<ServerConfig>;
|
|
342
|
-
//#endregion
|
|
343
|
-
//#region src/server/modes.d.ts
|
|
344
|
-
/**
|
|
345
|
-
* Copyright 2026 Salesforce, Inc.
|
|
346
|
-
*
|
|
347
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
348
|
-
* you may not use this file except in compliance with the License.
|
|
349
|
-
* You may obtain a copy of the License at
|
|
350
|
-
*
|
|
351
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
352
|
-
*
|
|
353
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
354
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
355
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
356
|
-
* See the License for the specific language governing permissions and
|
|
357
|
-
* limitations under the License.
|
|
358
|
-
*/
|
|
359
|
-
type ServerMode = 'development' | 'preview' | 'production';
|
|
360
|
-
/**
|
|
361
|
-
* Feature flags for each server mode
|
|
362
|
-
*/
|
|
363
|
-
interface ServerModeFeatures {
|
|
364
|
-
/** Enable Commerce API proxy middleware to forward /mobify/proxy/api requests to SCAPI */
|
|
365
|
-
enableProxy: boolean;
|
|
366
|
-
/** Enable static file serving from build/client directory */
|
|
367
|
-
enableStaticServing: boolean;
|
|
368
|
-
/** Enable gzip/brotli compression middleware for responses */
|
|
369
|
-
enableCompression: boolean;
|
|
370
|
-
/** Enable HTTP request/response logging */
|
|
371
|
-
enableLogging: boolean;
|
|
372
|
-
/** Enable patching of asset URLs with bundle path (for CDN deployment) */
|
|
373
|
-
enableAssetUrlPatching: boolean;
|
|
374
|
-
}
|
|
375
|
-
//#endregion
|
|
376
|
-
//#region src/server/index.d.ts
|
|
377
|
-
interface ServerOptions extends Partial<ServerModeFeatures> {
|
|
378
|
-
/** Server mode: development (with Vite), preview (preview), or production (minimal) */
|
|
379
|
-
mode: ServerMode;
|
|
380
|
-
/** Project root directory (optional, defaults to process.cwd()) */
|
|
381
|
-
projectDirectory?: string;
|
|
382
|
-
/** Server configuration (optional, will load from env vars if not provided) */
|
|
383
|
-
config?: ServerConfig;
|
|
384
|
-
/** Server port (optional, for logging) */
|
|
385
|
-
port?: number;
|
|
386
|
-
/** Vite dev server instance (required for development mode) */
|
|
387
|
-
vite?: ViteDevServer;
|
|
388
|
-
/** React Router server build (required for preview/production modes) */
|
|
389
|
-
build?: ServerBuild;
|
|
390
|
-
/** Enable streaming of responses */
|
|
391
|
-
streaming?: boolean;
|
|
392
|
-
}
|
|
393
|
-
/**
|
|
394
|
-
* Create a unified Express server for development, preview, or production mode
|
|
395
|
-
*/
|
|
396
|
-
declare function createServer(options: ServerOptions): Promise<Express>;
|
|
397
|
-
//#endregion
|
|
398
|
-
//#region src/extensibility/extension-config.d.ts
|
|
399
|
-
/**
|
|
400
|
-
* Copyright 2026 Salesforce, Inc.
|
|
401
|
-
*
|
|
402
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
403
|
-
* you may not use this file except in compliance with the License.
|
|
404
|
-
* You may obtain a copy of the License at
|
|
405
|
-
*
|
|
406
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
407
|
-
*
|
|
408
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
409
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
410
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
411
|
-
* See the License for the specific language governing permissions and
|
|
412
|
-
* limitations under the License.
|
|
413
|
-
*/
|
|
414
|
-
type ExtensionMeta = {
|
|
415
|
-
name: string;
|
|
416
|
-
description: string;
|
|
417
|
-
installationInstructions: string;
|
|
418
|
-
uninstallationInstructions: string;
|
|
419
|
-
folder: string;
|
|
420
|
-
dependencies: string[];
|
|
421
|
-
defaultOn?: boolean;
|
|
422
|
-
};
|
|
423
|
-
declare const ExtensionConfig: {
|
|
424
|
-
extensions: Record<string, ExtensionMeta>;
|
|
425
|
-
};
|
|
426
|
-
//#endregion
|
|
427
|
-
//#region src/extensibility/trim-extensions.d.ts
|
|
428
|
-
type ExtensionsSelection = Record<string, boolean>;
|
|
429
|
-
declare function trimExtensions(directory: string, selectedExtensions?: Partial<ExtensionsSelection>, extensionConfig?: typeof ExtensionConfig): void;
|
|
430
|
-
//#endregion
|
|
431
|
-
//#region src/cartridge-services/generate-cartridge.d.ts
|
|
432
|
-
/**
|
|
433
|
-
* Options for generateMetadata function
|
|
434
|
-
*/
|
|
435
|
-
interface GenerateMetadataOptions {
|
|
436
|
-
/**
|
|
437
|
-
* Optional array of specific file paths to process.
|
|
438
|
-
* If provided, only these files will be processed and existing cartridge files will NOT be deleted.
|
|
439
|
-
* If omitted, the entire src/ directory will be scanned and all existing cartridge files will be deleted first.
|
|
440
|
-
*/
|
|
441
|
-
filePaths?: string[];
|
|
442
|
-
/**
|
|
443
|
-
* Whether to run ESLint with --fix on generated JSON files to format them according to project settings.
|
|
444
|
-
* Defaults to true.
|
|
445
|
-
*/
|
|
446
|
-
lintFix?: boolean;
|
|
447
|
-
/**
|
|
448
|
-
* If true, scans files and reports what would be generated without actually writing any files or deleting directories.
|
|
449
|
-
* Defaults to false.
|
|
450
|
-
*/
|
|
451
|
-
dryRun?: boolean;
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* Result returned by generateMetadata function
|
|
455
|
-
*/
|
|
456
|
-
interface GenerateMetadataResult {
|
|
457
|
-
componentsGenerated: number;
|
|
458
|
-
pageTypesGenerated: number;
|
|
459
|
-
aspectsGenerated: number;
|
|
460
|
-
totalFiles: number;
|
|
461
|
-
}
|
|
462
|
-
declare function generateMetadata(projectDirectory: string, metadataDirectory: string, options?: GenerateMetadataOptions): Promise<GenerateMetadataResult>;
|
|
463
244
|
//#endregion
|
|
464
|
-
export { type
|
|
245
|
+
export { type HybridProxyPluginOptions, type StorefrontNextTargetsConfig, type UITargetDevModeConfig, storefrontNextTargets as default, hybridProxyPlugin, shouldRouteToNext, transformTargetPlaceholderPlugin, uiTargetDevModePlugin };
|
|
465
246
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/plugins/staticRegistry.ts","../src/plugins/eventInstrumentationValidator.ts","../src/storefront-next-targets.ts","../src/plugins/transformTargets.ts","../src/plugins/uiTargetDevMode.ts","../src/plugins/hybridProxy.ts","../src/plugins/ecdnMatcher.ts"],"sourcesContent":[],"mappings":";;;;;;;;UAuDiB,0BAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AG5BjB;;UFDiB,mCAAA;;AGgBjB;AA4CA;;;;AC1BA;AA+PA;;;;AC7KA;;;;;;;;;;;AFpGiB,UFHA,2BAAA,CEuBH;EAwBE;;;;AC1BhB;AA+PA;;;;AC7KA;;;;;;;;;;;;;;;;;;;;;;;mBJrEqB;;;;;;;;;kCAUe;;;;;;;;;;;;;;;;;;;;;iBAsBpB,qBAAA,UAA8B,8BAAmC;;;iBC9EjE,gCAAA,CAAA;;;EH4BC,cAAA,CAAA,MAAA,EGlBc,cHkBY,CAAA,EAAA,IAAA;;;;IC7B1B,GAAA,EAAA,IAAA;;;;;UGgBA,qBAAA;EDfD;;;;ECeC,OAAA,CAAA,EAAA,OAAA;EA4CD;;;;AC1BhB;EA+PgB,cAAA,CAAA,EAAA,MAAiB;;;;AC7KjC;;;YFhFc;;;;;;;;;;;;;;;;;;;;;;;iBAwBE,qBAAA,UAA8B,wBAA6B;;;;UC1B1D,wBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA+PD,iBAAA,UAA2B,2BAA2B;;;;;;;;;;;;;;;;;;;;;;iBC7KtD,iBAAA"}
|