@bleedingdev/modern-js-app-tools 3.5.0-ultramodern.36 → 3.5.0-ultramodern.37

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.
Files changed (59) hide show
  1. package/dist/cjs/builder/shared/lazyCompilation.js +2 -10
  2. package/dist/cjs/commands/index.js +0 -4
  3. package/dist/cjs/index.js +18 -53
  4. package/dist/cjs/plugins/deploy/index.js +4 -4
  5. package/dist/cjs/plugins/deploy/platforms/cloudflare/index.js +2 -2
  6. package/dist/cjs/plugins/deploy/platforms/cloudflare/security-policies.js +2 -20
  7. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.js +0 -9
  8. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.js +0 -6
  9. package/dist/esm/builder/shared/lazyCompilation.mjs +1 -3
  10. package/dist/esm/commands/index.mjs +0 -1
  11. package/dist/esm/index.mjs +1 -4
  12. package/dist/esm/plugins/analyze/getHtmlTemplate.mjs +2 -2
  13. package/dist/esm/plugins/analyze/isDefaultExportFunction.mjs +2 -2
  14. package/dist/esm/plugins/deploy/index.mjs +1 -1
  15. package/dist/esm/plugins/deploy/platforms/cloudflare/index.mjs +1 -1
  16. package/dist/esm/plugins/deploy/platforms/cloudflare/security-policies.mjs +1 -1
  17. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +1 -1
  18. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +1 -1
  19. package/dist/esm-node/builder/shared/lazyCompilation.mjs +1 -3
  20. package/dist/esm-node/commands/index.mjs +0 -1
  21. package/dist/esm-node/index.mjs +1 -4
  22. package/dist/esm-node/plugins/analyze/getHtmlTemplate.mjs +2 -2
  23. package/dist/esm-node/plugins/analyze/isDefaultExportFunction.mjs +2 -2
  24. package/dist/esm-node/plugins/deploy/index.mjs +1 -1
  25. package/dist/esm-node/plugins/deploy/platforms/cloudflare/index.mjs +1 -1
  26. package/dist/esm-node/plugins/deploy/platforms/cloudflare/security-policies.mjs +1 -1
  27. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.mjs +1 -1
  28. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.mjs +1 -1
  29. package/dist/types/builder/generator/createCopyPattern.d.ts +7 -5
  30. package/dist/types/builder/shared/lazyCompilation.d.ts +2 -4
  31. package/dist/types/commands/index.d.ts +0 -1
  32. package/dist/types/index.d.ts +0 -2
  33. package/dist/types/plugins/deploy/platforms/cloudflare/i18n-worker.d.ts +3 -2
  34. package/dist/types/plugins/deploy/platforms/cloudflare/security-policies.d.ts +0 -37
  35. package/dist/types/plugins/deploy/platforms/cloudflare/worker-manifest.d.ts +14 -1
  36. package/dist/types/plugins/deploy/platforms/cloudflare-output-plan.d.ts +2 -1
  37. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/mutation-policy.d.ts +1 -8
  38. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier/worker-bundles.d.ts +3 -4
  39. package/package.json +22 -22
  40. package/dist/cjs/baseline.js +0 -45
  41. package/dist/cjs/commands/runtime.js +0 -196
  42. package/dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier.js +0 -62
  43. package/dist/cjs/plugins/deploy/platforms/cloudflare.js +0 -40
  44. package/dist/cjs/ultramodern/designSystem.js +0 -123
  45. package/dist/esm/baseline.mjs +0 -4
  46. package/dist/esm/commands/runtime.mjs +0 -146
  47. package/dist/esm/plugins/deploy/platforms/cloudflare-output-verifier.mjs +0 -1
  48. package/dist/esm/plugins/deploy/platforms/cloudflare.mjs +0 -1
  49. package/dist/esm/ultramodern/designSystem.mjs +0 -73
  50. package/dist/esm-node/baseline.mjs +0 -5
  51. package/dist/esm-node/commands/runtime.mjs +0 -147
  52. package/dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier.mjs +0 -2
  53. package/dist/esm-node/plugins/deploy/platforms/cloudflare.mjs +0 -2
  54. package/dist/esm-node/ultramodern/designSystem.mjs +0 -74
  55. package/dist/types/baseline.d.ts +0 -16
  56. package/dist/types/commands/runtime.d.ts +0 -12
  57. package/dist/types/plugins/deploy/platforms/cloudflare-output-verifier.d.ts +0 -1
  58. package/dist/types/plugins/deploy/platforms/cloudflare.d.ts +0 -1
  59. package/dist/types/ultramodern/designSystem.d.ts +0 -54
@@ -6,7 +6,7 @@ type ModuleLike = {
6
6
  type LazyCompilationTestFn = (m: ModuleLike) => boolean;
7
7
  /** Matches Rspack's `LazyCompilationOptions['test']`. */
8
8
  type LazyCompilationTest = RegExp | LazyCompilationTestFn | undefined;
9
- export type EagerRouteComponentInfo = {
9
+ type EagerRouteComponentInfo = {
10
10
  files: Set<string>;
11
11
  /** Specifiers that could not be resolved, keyed by entry name. */
12
12
  unresolvedByEntry: Map<string, string[]>;
@@ -26,8 +26,7 @@ export declare function aggregateEagerRouteComponentFiles(byEntry: EagerRouteCom
26
26
  * (defaulting to lazy when the user did not provide one).
27
27
  */
28
28
  export declare function buildRouteEagerLazyCompilationTest(eagerRouteFiles: Set<string>, userTest?: LazyCompilationTest): LazyCompilationTestFn;
29
- export declare const buildSSRLazyCompilationTest: typeof buildRouteEagerLazyCompilationTest;
30
- export type SSRLazyPlan = {
29
+ type SSRLazyPlan = {
31
30
  apply: false;
32
31
  unresolvedByEntry?: Map<string, string[]>;
33
32
  } | {
@@ -42,4 +41,3 @@ export type SSRLazyPlan = {
42
41
  * existing `dev.lazyCompilation` value (lazy must be enabled for this to apply).
43
42
  */
44
43
  export declare function planRouteEagerLazyCompilation(current: unknown, info: EagerRouteComponentInfo): SSRLazyPlan;
45
- export declare const planSSRLazyCompilation: typeof planRouteEagerLazyCompilation;
@@ -7,4 +7,3 @@ export declare const serverCommand: (program: Command, api: CLIPluginAPI<AppTool
7
7
  export declare const deployCommand: (program: Command, api: CLIPluginAPI<AppTools>) => void;
8
8
  export declare const inspectCommand: (program: Command, api: CLIPluginAPI<AppTools>) => void;
9
9
  export declare const infoCommand: (program: Command, api: CLIPluginAPI<AppTools>) => void;
10
- export { runtimeCommand } from './runtime';
@@ -1,9 +1,7 @@
1
1
  import type { AppTools, CliPlugin } from './types';
2
2
  import { initAppContext } from './utils/initAppContext';
3
- export * from './baseline';
4
3
  export * from './defineConfig';
5
4
  export * from './presetUltramodern';
6
- export * from './ultramodern/designSystem';
7
5
  export declare const appTools: () => CliPlugin<AppTools>;
8
6
  export { dev } from './commands/dev';
9
7
  export { serve } from './commands/serve';
@@ -1,11 +1,11 @@
1
1
  import type { CloudflareAppContext } from './types';
2
- export type WorkerI18nDetection = {
2
+ type WorkerI18nDetection = {
3
3
  order: string[];
4
4
  lookupQuerystring: string;
5
5
  lookupCookie: string;
6
6
  lookupHeader: string;
7
7
  };
8
- export type WorkerI18nEntry = {
8
+ type WorkerI18nEntry = {
9
9
  i18nextDetector: boolean;
10
10
  languages: string[];
11
11
  fallbackLanguage: string;
@@ -19,3 +19,4 @@ export declare const createI18nWorkerManifest: (routeSpec: {
19
19
  }, appContext: CloudflareAppContext) => {
20
20
  entries: Record<string, WorkerI18nEntry>;
21
21
  } | undefined;
22
+ export {};
@@ -1,40 +1,3 @@
1
- import type { CloudflareWorkerSecurityConfig } from '../../../../types/config/deploy';
2
- export declare const DEFAULT_SECURITY_HEADERS: {
3
- readonly referrerPolicy: 'strict-origin-when-cross-origin';
4
- readonly contentTypeOptions: 'nosniff';
5
- readonly permissionsPolicy: 'camera=(), geolocation=(), microphone=(), payment=(), usb=()';
6
- };
7
- export declare const DEFAULT_CORS_ALLOWED_METHODS: string[];
8
- export declare const DEFAULT_CSP_DIRECTIVES: Record<string, string[]>;
9
- export declare const createContentSecurityPolicy: (config?: CloudflareWorkerSecurityConfig['contentSecurityPolicy']) => {
10
- mode: "off";
11
- directives: {};
12
- reason: string | undefined;
13
- } | {
14
- mode: "enforce" | "report-only";
15
- directives: {
16
- [k: string]: string[];
17
- };
18
- reason: string | undefined;
19
- };
20
- export declare const createNoindexPolicy: (noindex: CloudflareWorkerSecurityConfig['noindex']) => {
21
- workersDev: boolean;
22
- localhost: boolean;
23
- previewHostnames: never[];
24
- reason?: undefined;
25
- } | {
26
- workersDev: boolean;
27
- localhost: boolean;
28
- previewHostnames: string[];
29
- reason: string | undefined;
30
- };
31
- export declare const createCloudflareWorkerCorsPolicy: (cors: CloudflareWorkerSecurityConfig['cors']) => {
32
- assets: boolean;
33
- allowedOrigins: string[];
34
- allowedMethods: string[];
35
- allowedHeaders: string[];
36
- reason: string | undefined;
37
- };
38
1
  export declare const createCloudflareWorkerSecurityPolicy: (modernConfig: Parameters<CreatePreset>[0]['modernConfig']) => {
39
2
  enabled: boolean;
40
3
  cors: {
@@ -80,7 +80,20 @@ export declare const createWorkerManifest: (outputDirectory: string, modernConfi
80
80
  };
81
81
  deliveryUnit?: DeliveryUnitStamp | undefined;
82
82
  i18n: {
83
- entries: Record<string, import("./i18n-worker").WorkerI18nEntry>;
83
+ entries: Record<string, {
84
+ i18nextDetector: boolean;
85
+ languages: string[];
86
+ fallbackLanguage: string;
87
+ detection: {
88
+ order: string[];
89
+ lookupQuerystring: string;
90
+ lookupCookie: string;
91
+ lookupHeader: string;
92
+ };
93
+ ignoreRedirectRoutes: string[];
94
+ staticRoutePrefixes: string[];
95
+ localisedUrls?: Record<string, Record<string, string>>;
96
+ }>;
84
97
  } | undefined;
85
98
  bff: {
86
99
  runtimeFramework: string;
@@ -1,5 +1,5 @@
1
1
  import { CLOUDFLARE_ASSETS_BINDING, CLOUDFLARE_OUTPUT_PACKAGE_TYPE, CLOUDFLARE_PUBLIC_ASSETS_DIRECTORY, CLOUDFLARE_REQUIRED_COMPATIBILITY_FLAGS, CLOUDFLARE_WORKER_ENTRY, CLOUDFLARE_WORKER_PACKAGE_TYPE } from './cloudflare-output-contract';
2
- export type CloudflareOutputPlan = {
2
+ type CloudflareOutputPlan = {
3
3
  outputDirectory: string;
4
4
  requiredFiles: string[];
5
5
  publicLeakDirectories: string[];
@@ -31,3 +31,4 @@ export type CloudflareOutputPlan = {
31
31
  };
32
32
  };
33
33
  export declare function createCloudflareOutputPlan(outputDirectory: string): CloudflareOutputPlan;
34
+ export {};
@@ -1,13 +1,6 @@
1
- import type { CloudflareOutputVerifierIssueCode, CloudflareOutputVerifierResult } from './issues';
1
+ import type { CloudflareOutputVerifierResult } from './issues';
2
2
  export interface VerifyCloudflareOutputMutationPolicyOptions {
3
3
  scanRoots: string[];
4
4
  }
5
- export declare const SOURCE_SCAN_FILE_PATTERN: RegExp;
6
- export declare const SOURCE_SCAN_IGNORED_DIRECTORY_NAMES: Set<string>;
7
- export declare const FORBIDDEN_MUTATION_PATTERNS: Array<{
8
- code: CloudflareOutputVerifierIssueCode;
9
- message: string;
10
- pattern: RegExp;
11
- }>;
12
5
  export declare const walkFiles: (root: string) => Promise<string[]>;
13
6
  export declare const verifyCloudflareOutputMutationPolicy: (options: VerifyCloudflareOutputMutationPolicyOptions) => Promise<CloudflareOutputVerifierResult>;
@@ -1,16 +1,15 @@
1
1
  import type { CloudflareOutputVerifierIssue, JsonObject } from './issues';
2
- export interface WorkerBundleReference {
2
+ interface WorkerBundleReference {
3
3
  kind: 'effect-bff' | 'route';
4
4
  reference: string;
5
5
  }
6
- export interface ResolvedWorkerBundleReference extends WorkerBundleReference {
6
+ interface ResolvedWorkerBundleReference extends WorkerBundleReference {
7
7
  path: string;
8
8
  }
9
- export declare const getReferencedRouteWorkers: (manifest: JsonObject) => any;
10
9
  export declare const getEffectBffWorker: (manifest: JsonObject) => any;
11
10
  export declare const getWorkerBundleReferences: (manifest: JsonObject) => WorkerBundleReference[];
12
11
  export declare const resolveWorkerBundleReference: (issues: CloudflareOutputVerifierIssue[], outputDirectory: string, reference: WorkerBundleReference, manifestPath: string) => ResolvedWorkerBundleReference | null;
13
12
  export declare const missingWorkerBundleMessage: (reference: WorkerBundleReference) => "Cloudflare Effect BFF manifest points to a missing worker bundle." | "Cloudflare route worker manifest points to a missing worker bundle.";
14
- export declare const FORBIDDEN_WORKER_BUNDLE_REFERENCE_PATTERNS: readonly [RegExp, RegExp, RegExp];
15
13
  export declare const verifyWorkerBundleReferences: (issues: CloudflareOutputVerifierIssue[], worker: ResolvedWorkerBundleReference, source: string) => void;
16
14
  export declare const verifyWorkerImport: (issues: CloudflareOutputVerifierIssue[], entryPath: string) => Promise<void>;
15
+ export {};
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "modern",
18
18
  "modern.js"
19
19
  ],
20
- "version": "3.5.0-ultramodern.36",
20
+ "version": "3.5.0-ultramodern.37",
21
21
  "types": "./dist/types/index.d.ts",
22
22
  "main": "./dist/cjs/index.js",
23
23
  "exports": {
@@ -46,10 +46,10 @@
46
46
  "default": "./dist/cjs/run/index.js"
47
47
  },
48
48
  "./cloudflare-output-verifier": {
49
- "types": "./dist/types/plugins/deploy/platforms/cloudflare-output-verifier.d.ts",
50
- "import": "./dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier.mjs",
51
- "require": "./dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier.js",
52
- "default": "./dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier.js"
49
+ "types": "./dist/types/plugins/deploy/platforms/cloudflare-output-verifier/index.d.ts",
50
+ "import": "./dist/esm-node/plugins/deploy/platforms/cloudflare-output-verifier/index.mjs",
51
+ "require": "./dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js",
52
+ "default": "./dist/cjs/plugins/deploy/platforms/cloudflare-output-verifier/index.js"
53
53
  },
54
54
  "./types": {
55
55
  "types": "./lib/types.d.ts",
@@ -84,37 +84,37 @@
84
84
  "@babel/traverse": "^8.0.0",
85
85
  "@babel/types": "^8.0.0",
86
86
  "@loadable/component": "5.16.7",
87
- "@rsbuild/core": "2.1.1",
87
+ "@rsbuild/core": "2.1.5",
88
88
  "@swc/core": "1.15.43",
89
89
  "@swc/helpers": "^0.5.23",
90
90
  "compression-webpack-plugin": "^12.0.0",
91
- "es-module-lexer": "^2.1.0",
91
+ "es-module-lexer": "^2.3.0",
92
92
  "esbuild": "^0.28.1",
93
93
  "flatted": "^3.4.2",
94
94
  "import-meta-resolve": "^4.2.0",
95
95
  "mlly": "^1.8.2",
96
96
  "ndepe": "^0.1.13",
97
97
  "pkg-types": "^2.3.1",
98
- "std-env": "4.1.0",
99
- "@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.5.0-ultramodern.36",
100
- "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.5.0-ultramodern.36",
101
- "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.5.0-ultramodern.36",
102
- "@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.5.0-ultramodern.36",
103
- "@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.5.0-ultramodern.36",
104
- "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.5.0-ultramodern.36",
105
- "@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.5.0-ultramodern.36",
106
- "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.5.0-ultramodern.36",
107
- "@modern-js/server": "npm:@bleedingdev/modern-js-server@3.5.0-ultramodern.36",
108
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.5.0-ultramodern.36"
98
+ "std-env": "4.2.0",
99
+ "@modern-js/builder": "npm:@bleedingdev/modern-js-builder@3.5.0-ultramodern.37",
100
+ "@modern-js/i18n-utils": "npm:@bleedingdev/modern-js-i18n-utils@3.5.0-ultramodern.37",
101
+ "@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.5.0-ultramodern.37",
102
+ "@modern-js/plugin-data-loader": "npm:@bleedingdev/modern-js-plugin-data-loader@3.5.0-ultramodern.37",
103
+ "@modern-js/server": "npm:@bleedingdev/modern-js-server@3.5.0-ultramodern.37",
104
+ "@modern-js/server-core": "npm:@bleedingdev/modern-js-server-core@3.5.0-ultramodern.37",
105
+ "@modern-js/server-utils": "npm:@bleedingdev/modern-js-server-utils@3.5.0-ultramodern.37",
106
+ "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.5.0-ultramodern.37",
107
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.5.0-ultramodern.37",
108
+ "@modern-js/plugin": "npm:@bleedingdev/modern-js-plugin@3.5.0-ultramodern.37"
109
109
  },
110
110
  "devDependencies": {
111
- "@rslib/core": "0.23.1",
111
+ "@rslib/core": "0.23.2",
112
112
  "@types/babel__traverse": "7.28.0",
113
- "@types/node": "^26.0.1",
114
- "@typescript/native-preview": "7.0.0-dev.20260628.1",
113
+ "@types/node": "^26.1.1",
114
+ "@typescript/native-preview": "7.0.0-dev.20260707.2",
115
115
  "ts-node": "^10.9.2",
116
116
  "tsconfig-paths": "^4.2.0",
117
- "typescript": "^6.0.3",
117
+ "typescript": "^7.0.2",
118
118
  "@scripts/rstest-config": "2.66.0"
119
119
  },
120
120
  "peerDependencies": {
@@ -1,45 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, getters, values)=>{
5
- var define = (defs, kind)=>{
6
- for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
- enumerable: true,
8
- [kind]: defs[key]
9
- });
10
- };
11
- define(getters, "get");
12
- define(values, "value");
13
- };
14
- })();
15
- (()=>{
16
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
- })();
18
- (()=>{
19
- __webpack_require__.r = (exports1)=>{
20
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
- value: 'Module'
22
- });
23
- Object.defineProperty(exports1, '__esModule', {
24
- value: true
25
- });
26
- };
27
- })();
28
- var __webpack_exports__ = {};
29
- __webpack_require__.r(__webpack_exports__);
30
- __webpack_require__.d(__webpack_exports__, {
31
- createAppBaselineConfig: ()=>createAppBaselineConfig,
32
- withAppBaseline: ()=>withAppBaseline
33
- });
34
- const external_presetUltramodern_js_namespaceObject = require("./presetUltramodern.js");
35
- const createAppBaselineConfig = external_presetUltramodern_js_namespaceObject.createPresetUltramodernConfig;
36
- const withAppBaseline = external_presetUltramodern_js_namespaceObject.presetUltramodern;
37
- exports.createAppBaselineConfig = __webpack_exports__.createAppBaselineConfig;
38
- exports.withAppBaseline = __webpack_exports__.withAppBaseline;
39
- for(var __rspack_i in __webpack_exports__)if (-1 === [
40
- "createAppBaselineConfig",
41
- "withAppBaseline"
42
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
43
- Object.defineProperty(exports, '__esModule', {
44
- value: true
45
- });
@@ -1,196 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, getters, values)=>{
5
- var define = (defs, kind)=>{
6
- for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
- enumerable: true,
8
- [kind]: defs[key]
9
- });
10
- };
11
- define(getters, "get");
12
- define(values, "value");
13
- };
14
- })();
15
- (()=>{
16
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
- })();
18
- (()=>{
19
- __webpack_require__.r = (exports1)=>{
20
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
- value: 'Module'
22
- });
23
- Object.defineProperty(exports1, '__esModule', {
24
- value: true
25
- });
26
- };
27
- })();
28
- var __webpack_exports__ = {};
29
- __webpack_require__.r(__webpack_exports__);
30
- const DEFAULT_RUNTIME_HOST = 'http://127.0.0.1:8080';
31
- const DEFAULT_RUNTIME_STATUS_PATH = '/_modern/runtime/status';
32
- const DEFAULT_RUNTIME_FALLBACK_SIGNAL_PATH = '/_modern/contract-gates/runtime-fallback';
33
- const DEFAULT_RUNTIME_TOKEN_HEADER = 'x-modernjs-runtime-signal-token';
34
- const DEFAULT_TIMEOUT_MS = 5000;
35
- const resolveRuntimeEndpoint = (input, defaultPath)=>{
36
- const rawInput = input?.trim();
37
- if (!rawInput) return `${DEFAULT_RUNTIME_HOST}${defaultPath}`;
38
- if (rawInput.startsWith('http://') || rawInput.startsWith('https://')) return rawInput;
39
- const normalized = rawInput.startsWith('/') ? rawInput : `/${rawInput}`;
40
- return `${DEFAULT_RUNTIME_HOST}${normalized}`;
41
- };
42
- const resolveToken = ({ token, tokenEnv })=>{
43
- if ('string' == typeof token && token.trim().length > 0) return token.trim();
44
- if ('string' == typeof tokenEnv && tokenEnv.trim().length > 0) {
45
- const value = process.env[tokenEnv.trim()];
46
- if ('string' == typeof value && value.trim().length > 0) return value.trim();
47
- }
48
- };
49
- const parseTimeoutMs = (value)=>{
50
- if ('string' != typeof value || 0 === value.trim().length) return DEFAULT_TIMEOUT_MS;
51
- const parsed = Number.parseInt(value, 10);
52
- if (!Number.isFinite(parsed) || parsed <= 0) return DEFAULT_TIMEOUT_MS;
53
- return parsed;
54
- };
55
- const parseMetadata = (metadata)=>{
56
- if ('string' != typeof metadata || 0 === metadata.trim().length) return;
57
- const parsed = JSON.parse(metadata);
58
- if (!parsed || 'object' != typeof parsed || Array.isArray(parsed)) throw new Error('metadata must be a JSON object');
59
- return parsed;
60
- };
61
- const fetchWithTimeout = async (url, init, timeoutMs)=>{
62
- const controller = new AbortController();
63
- const timeout = setTimeout(()=>{
64
- controller.abort();
65
- }, timeoutMs);
66
- try {
67
- return await fetch(url, {
68
- ...init,
69
- signal: controller.signal
70
- });
71
- } finally{
72
- clearTimeout(timeout);
73
- }
74
- };
75
- const parseResponseBody = async (response)=>{
76
- const text = await response.text();
77
- if (!text) return {};
78
- try {
79
- return JSON.parse(text);
80
- } catch (_error) {
81
- return {
82
- raw: text
83
- };
84
- }
85
- };
86
- const INDENT_STEP = ' ';
87
- const formatScalar = (value)=>'string' == typeof value ? value : JSON.stringify(value) ?? 'undefined';
88
- const formatHumanReadableLines = (value, indent)=>{
89
- if (Array.isArray(value)) {
90
- if (0 === value.length) return [
91
- `${indent}(empty)`
92
- ];
93
- return value.flatMap((entry)=>null !== entry && 'object' == typeof entry ? [
94
- `${indent}-`,
95
- ...formatHumanReadableLines(entry, indent + INDENT_STEP)
96
- ] : [
97
- `${indent}- ${formatScalar(entry)}`
98
- ]);
99
- }
100
- if (null !== value && 'object' == typeof value) {
101
- const entries = Object.entries(value);
102
- if (0 === entries.length) return [
103
- `${indent}(empty)`
104
- ];
105
- return entries.flatMap(([key, entry])=>null !== entry && 'object' == typeof entry ? [
106
- `${indent}${key}:`,
107
- ...formatHumanReadableLines(entry, indent + INDENT_STEP)
108
- ] : [
109
- `${indent}${key}: ${formatScalar(entry)}`
110
- ]);
111
- }
112
- return [
113
- `${indent}${formatScalar(value)}`
114
- ];
115
- };
116
- const formatRuntimeOutput = (payload, jsonOnly)=>jsonOnly ? JSON.stringify(payload, null, 2) : formatHumanReadableLines(payload, '').join('\n');
117
- const printOutput = (payload, jsonOnly)=>{
118
- console.log(formatRuntimeOutput(payload, jsonOnly));
119
- };
120
- const createRuntimeFallbackSignalPayload = (options)=>{
121
- const payload = {
122
- appName: options.app,
123
- reason: options.reason || 'runtime_fallback',
124
- phase: options.phase || 'load'
125
- };
126
- if (options.entry) payload.entry = options.entry;
127
- if (options.runtimeDigest) payload.runtimeDigest = options.runtimeDigest;
128
- const metadata = parseMetadata(options.metadata);
129
- if (metadata) payload.metadata = metadata;
130
- return payload;
131
- };
132
- const runtimeCommand = async (program, _api)=>{
133
- const runtime = program.command('runtime').description('runtime operations');
134
- runtime.command('status').description('read runtime status snapshot').option('--endpoint <endpoint>', 'runtime status endpoint URL or path').option('--token <token>', 'runtime status auth token').option('--token-env <name>', 'environment variable name that stores runtime status auth token', 'MODERN_RUNTIME_SIGNAL_TOKEN').option('--header-name <name>', 'auth header name', DEFAULT_RUNTIME_TOKEN_HEADER).option('--timeout <ms>', 'request timeout in milliseconds', '5000').option('--json', 'output as JSON format for machine reading').action(async (options)=>{
135
- const endpoint = resolveRuntimeEndpoint(options.endpoint, DEFAULT_RUNTIME_STATUS_PATH);
136
- const timeoutMs = parseTimeoutMs(options.timeout);
137
- const token = resolveToken({
138
- token: options.token,
139
- tokenEnv: options.tokenEnv
140
- });
141
- const headerName = options.headerName?.trim() || DEFAULT_RUNTIME_TOKEN_HEADER;
142
- const headers = new Headers();
143
- if (token) headers.set(headerName, token);
144
- const response = await fetchWithTimeout(endpoint, {
145
- method: 'GET',
146
- headers
147
- }, timeoutMs);
148
- const payload = await parseResponseBody(response);
149
- if (!response.ok) throw new Error(`runtime status request failed with ${response.status}: ${JSON.stringify(payload)}`);
150
- printOutput(payload, options.json);
151
- });
152
- runtime.command('fallback-signal').description('emit runtime fallback signal for canary gate mutation').requiredOption('--app <appName>', 'remote app name').option('--endpoint <endpoint>', 'runtime fallback signal endpoint URL or path').option('--reason <reason>', 'fallback reason', 'runtime_fallback').option('--phase <phase>', 'fallback phase', 'load').option('--entry <entry>', 'remote entry URL').option('--runtime-digest <digest>', 'runtime digest value').option('--metadata <json>', 'metadata JSON object string').option('--token <token>', 'runtime signal auth token').option('--token-env <name>', 'environment variable name that stores runtime signal auth token', 'MODERN_RUNTIME_SIGNAL_TOKEN').option('--header-name <name>', 'auth header name', DEFAULT_RUNTIME_TOKEN_HEADER).option('--timeout <ms>', 'request timeout in milliseconds', '5000').option('--json', 'output as JSON format for machine reading').action(async (options)=>{
153
- const endpoint = resolveRuntimeEndpoint(options.endpoint, DEFAULT_RUNTIME_FALLBACK_SIGNAL_PATH);
154
- const timeoutMs = parseTimeoutMs(options.timeout);
155
- const token = resolveToken({
156
- token: options.token,
157
- tokenEnv: options.tokenEnv
158
- });
159
- const headerName = options.headerName?.trim() || DEFAULT_RUNTIME_TOKEN_HEADER;
160
- const payload = createRuntimeFallbackSignalPayload(options);
161
- const headers = new Headers({
162
- 'content-type': 'application/json'
163
- });
164
- if (token) headers.set(headerName, token);
165
- const response = await fetchWithTimeout(endpoint, {
166
- method: 'POST',
167
- headers,
168
- body: JSON.stringify(payload)
169
- }, timeoutMs);
170
- const responsePayload = await parseResponseBody(response);
171
- if (!response.ok) throw new Error(`runtime fallback signal request failed with ${response.status}: ${JSON.stringify(responsePayload)}`);
172
- printOutput(responsePayload, options.json);
173
- });
174
- };
175
- __webpack_require__.d(__webpack_exports__, {}, {
176
- createRuntimeFallbackSignalPayload: createRuntimeFallbackSignalPayload,
177
- formatRuntimeOutput: formatRuntimeOutput,
178
- resolveRuntimeEndpoint: resolveRuntimeEndpoint,
179
- resolveToken: resolveToken,
180
- runtimeCommand: runtimeCommand
181
- });
182
- exports.createRuntimeFallbackSignalPayload = __webpack_exports__.createRuntimeFallbackSignalPayload;
183
- exports.formatRuntimeOutput = __webpack_exports__.formatRuntimeOutput;
184
- exports.resolveRuntimeEndpoint = __webpack_exports__.resolveRuntimeEndpoint;
185
- exports.resolveToken = __webpack_exports__.resolveToken;
186
- exports.runtimeCommand = __webpack_exports__.runtimeCommand;
187
- for(var __rspack_i in __webpack_exports__)if (-1 === [
188
- "createRuntimeFallbackSignalPayload",
189
- "formatRuntimeOutput",
190
- "resolveRuntimeEndpoint",
191
- "resolveToken",
192
- "runtimeCommand"
193
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
194
- Object.defineProperty(exports, '__esModule', {
195
- value: true
196
- });
@@ -1,62 +0,0 @@
1
- "use strict";
2
- var __webpack_modules__ = {
3
- "./cloudflare-output-verifier/index" (module) {
4
- module.exports = require("./cloudflare-output-verifier/index.js");
5
- }
6
- };
7
- var __webpack_module_cache__ = {};
8
- function __webpack_require__(moduleId) {
9
- var cachedModule = __webpack_module_cache__[moduleId];
10
- if (void 0 !== cachedModule) return cachedModule.exports;
11
- var module = __webpack_module_cache__[moduleId] = {
12
- exports: {}
13
- };
14
- __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
15
- return module.exports;
16
- }
17
- (()=>{
18
- __webpack_require__.n = (module)=>{
19
- var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
20
- __webpack_require__.d(getter, {
21
- a: getter
22
- });
23
- return getter;
24
- };
25
- })();
26
- (()=>{
27
- __webpack_require__.d = (exports1, getters, values)=>{
28
- var define = (defs, kind)=>{
29
- for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
30
- enumerable: true,
31
- [kind]: defs[key]
32
- });
33
- };
34
- define(getters, "get");
35
- define(values, "value");
36
- };
37
- })();
38
- (()=>{
39
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
40
- })();
41
- (()=>{
42
- __webpack_require__.r = (exports1)=>{
43
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
44
- value: 'Module'
45
- });
46
- Object.defineProperty(exports1, '__esModule', {
47
- value: true
48
- });
49
- };
50
- })();
51
- var __webpack_exports__ = {};
52
- (()=>{
53
- __webpack_require__.r(__webpack_exports__);
54
- var _cloudflare_output_verifier_index__rspack_import_0 = __webpack_require__("./cloudflare-output-verifier/index");
55
- var __rspack_reexport = {};
56
- for(const __rspack_import_key in _cloudflare_output_verifier_index__rspack_import_0)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_cloudflare_output_verifier_index__rspack_import_0[__rspack_import_key];
57
- __webpack_require__.d(__webpack_exports__, __rspack_reexport);
58
- })();
59
- for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
60
- Object.defineProperty(exports, '__esModule', {
61
- value: true
62
- });
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, getters, values)=>{
5
- var define = (defs, kind)=>{
6
- for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
7
- enumerable: true,
8
- [kind]: defs[key]
9
- });
10
- };
11
- define(getters, "get");
12
- define(values, "value");
13
- };
14
- })();
15
- (()=>{
16
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
17
- })();
18
- (()=>{
19
- __webpack_require__.r = (exports1)=>{
20
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
21
- value: 'Module'
22
- });
23
- Object.defineProperty(exports1, '__esModule', {
24
- value: true
25
- });
26
- };
27
- })();
28
- var __webpack_exports__ = {};
29
- __webpack_require__.r(__webpack_exports__);
30
- __webpack_require__.d(__webpack_exports__, {
31
- createCloudflarePreset: ()=>index_js_namespaceObject.createCloudflarePreset
32
- });
33
- const index_js_namespaceObject = require("./cloudflare/index.js");
34
- exports.createCloudflarePreset = __webpack_exports__.createCloudflarePreset;
35
- for(var __rspack_i in __webpack_exports__)if (-1 === [
36
- "createCloudflarePreset"
37
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
38
- Object.defineProperty(exports, '__esModule', {
39
- value: true
40
- });