@bleedingdev/modern-js-server-core 3.2.0-ultramodern.120 → 3.2.0-ultramodern.121

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 (60) hide show
  1. package/dist/cjs/adapters/node/plugins/resource.js +1 -6
  2. package/dist/cjs/adapters/node/plugins/static.js +11 -185
  3. package/dist/cjs/adapters/node/plugins/staticModuleFederation.js +165 -0
  4. package/dist/cjs/adapters/node/plugins/staticPrecompressed.js +135 -0
  5. package/dist/cjs/index.js +34 -10
  6. package/dist/cjs/plugins/default.js +0 -2
  7. package/dist/cjs/plugins/index.js +2 -83
  8. package/dist/cjs/types/config/bffRuntime.js +18 -0
  9. package/dist/cjs/types/config/serverTelemetry.js +18 -0
  10. package/dist/cjs/utils/error.js +62 -0
  11. package/dist/esm/adapters/node/plugins/resource.mjs +1 -6
  12. package/dist/esm/adapters/node/plugins/static.mjs +7 -181
  13. package/dist/esm/adapters/node/plugins/staticModuleFederation.mjs +96 -0
  14. package/dist/esm/adapters/node/plugins/staticPrecompressed.mjs +91 -0
  15. package/dist/esm/index.mjs +1 -1
  16. package/dist/esm/plugins/default.mjs +0 -2
  17. package/dist/esm/plugins/index.mjs +0 -3
  18. package/dist/esm/types/config/bffRuntime.mjs +0 -0
  19. package/dist/esm/types/config/serverTelemetry.mjs +0 -0
  20. package/dist/esm/utils/error.mjs +54 -1
  21. package/dist/esm-node/adapters/node/plugins/resource.mjs +1 -6
  22. package/dist/esm-node/adapters/node/plugins/static.mjs +7 -181
  23. package/dist/esm-node/adapters/node/plugins/staticModuleFederation.mjs +97 -0
  24. package/dist/esm-node/adapters/node/plugins/staticPrecompressed.mjs +92 -0
  25. package/dist/esm-node/index.mjs +1 -1
  26. package/dist/esm-node/plugins/default.mjs +0 -2
  27. package/dist/esm-node/plugins/index.mjs +0 -3
  28. package/dist/esm-node/types/config/bffRuntime.mjs +1 -0
  29. package/dist/esm-node/types/config/serverTelemetry.mjs +1 -0
  30. package/dist/esm-node/utils/error.mjs +54 -1
  31. package/dist/types/adapters/node/plugins/staticModuleFederation.d.ts +13 -0
  32. package/dist/types/adapters/node/plugins/staticPrecompressed.d.ts +13 -0
  33. package/dist/types/index.d.ts +2 -1
  34. package/dist/types/plugins/index.d.ts +0 -3
  35. package/dist/types/types/config/bff.d.ts +2 -97
  36. package/dist/types/types/config/bffRuntime.d.ts +105 -0
  37. package/dist/types/types/config/server.d.ts +3 -337
  38. package/dist/types/types/config/serverTelemetry.d.ts +319 -0
  39. package/dist/types/utils/error.d.ts +16 -0
  40. package/package.json +5 -5
  41. package/dist/cjs/adapters/node/plugins/moduleFederationCss.js +0 -176
  42. package/dist/cjs/plugins/contractGateAutopilot.js +0 -162
  43. package/dist/cjs/plugins/contractGateSnapshotStore.js +0 -243
  44. package/dist/cjs/plugins/mfCache.js +0 -82
  45. package/dist/cjs/plugins/telemetry.js +0 -1287
  46. package/dist/esm/adapters/node/plugins/moduleFederationCss.mjs +0 -125
  47. package/dist/esm/plugins/contractGateAutopilot.mjs +0 -124
  48. package/dist/esm/plugins/contractGateSnapshotStore.mjs +0 -180
  49. package/dist/esm/plugins/mfCache.mjs +0 -35
  50. package/dist/esm/plugins/telemetry.mjs +0 -1195
  51. package/dist/esm-node/adapters/node/plugins/moduleFederationCss.mjs +0 -126
  52. package/dist/esm-node/plugins/contractGateAutopilot.mjs +0 -125
  53. package/dist/esm-node/plugins/contractGateSnapshotStore.mjs +0 -182
  54. package/dist/esm-node/plugins/mfCache.mjs +0 -36
  55. package/dist/esm-node/plugins/telemetry.mjs +0 -1196
  56. package/dist/types/adapters/node/plugins/moduleFederationCss.d.ts +0 -33
  57. package/dist/types/plugins/contractGateAutopilot.d.ts +0 -35
  58. package/dist/types/plugins/contractGateSnapshotStore.d.ts +0 -57
  59. package/dist/types/plugins/mfCache.d.ts +0 -12
  60. package/dist/types/plugins/telemetry.d.ts +0 -309
@@ -1,162 +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
- ContractGateAutopilot: ()=>ContractGateAutopilot
32
- });
33
- const external_contractGateSnapshotStore_js_namespaceObject = require("./contractGateSnapshotStore.js");
34
- const DEFAULT_POLL_INTERVAL_MS = 15000;
35
- const DEFAULT_GATE_STALE_AFTER_MS = 600000;
36
- class ContractGateAutopilot {
37
- async start() {
38
- await this.syncOnce();
39
- if (this.poller) return;
40
- this.poller = setInterval(()=>{
41
- this.syncOnce();
42
- }, this.pollIntervalMs);
43
- if ('function' == typeof this.poller.unref) this.poller.unref();
44
- }
45
- stop() {
46
- if (this.poller) {
47
- clearInterval(this.poller);
48
- this.poller = void 0;
49
- }
50
- }
51
- async syncOnce() {
52
- const snapshot = await this.loadSnapshot();
53
- if (!snapshot) return 0;
54
- const gates = this.normalizeSnapshot(snapshot);
55
- let updatedCount = 0;
56
- for (const gate of gates){
57
- this.orchestrator.addRequiredContractGate(gate.name);
58
- const fingerprint = `${gate.passed ? '1' : '0'}:${gate.reason || ''}`;
59
- if (this.appliedGateFingerprints.get(gate.name) !== fingerprint) {
60
- this.orchestrator.setContractGate(gate.name, gate.passed, gate.reason);
61
- this.appliedGateFingerprints.set(gate.name, fingerprint);
62
- updatedCount += 1;
63
- this.logger?.info?.(`[telemetry.canary.autopilot] gate=${gate.name} passed=${String(gate.passed)} reason=${gate.reason || 'none'}`);
64
- }
65
- }
66
- return updatedCount;
67
- }
68
- async loadSnapshot() {
69
- try {
70
- const snapshot = await this.gateSnapshotStore.readSnapshot();
71
- if (!snapshot) return;
72
- const fingerprint = JSON.stringify(snapshot);
73
- if (fingerprint === this.lastSnapshotFingerprint) return;
74
- this.lastSnapshotFingerprint = fingerprint;
75
- return snapshot;
76
- } catch (error) {
77
- const source = this.gateSnapshotPath || this.gateSnapshotStore.name || 'stateStore';
78
- this.logger?.warn?.(`[telemetry.canary.autopilot] failed to load gate snapshot ${source}: ${error instanceof Error ? error.message : String(error)}`);
79
- return;
80
- }
81
- }
82
- normalizeSnapshot(snapshot) {
83
- const now = Date.now();
84
- const output = [];
85
- const gates = snapshot.gates;
86
- if (!gates || 'object' != typeof gates) return output;
87
- for (const [name, value] of Object.entries(gates)){
88
- const normalizedName = name.trim();
89
- if (!normalizedName) continue;
90
- const gate = this.normalizeGateValue(value, snapshot.updatedAt, now);
91
- if (!gate) continue;
92
- if ('number' == typeof gate.expiresAt && Number.isFinite(gate.expiresAt) && gate.expiresAt > 0 && now >= gate.expiresAt) {
93
- output.push({
94
- name: normalizedName,
95
- passed: true,
96
- reason: void 0,
97
- updatedAt: gate.updatedAt,
98
- expiresAt: gate.expiresAt
99
- });
100
- continue;
101
- }
102
- const isStale = this.gateStaleAfterMs > 0 && now - gate.updatedAt > this.gateStaleAfterMs;
103
- if (isStale) {
104
- output.push({
105
- name: normalizedName,
106
- passed: false,
107
- reason: gate.reason || 'Gate snapshot is stale',
108
- updatedAt: gate.updatedAt
109
- });
110
- continue;
111
- }
112
- output.push({
113
- name: normalizedName,
114
- passed: gate.passed,
115
- reason: gate.reason,
116
- updatedAt: gate.updatedAt
117
- });
118
- }
119
- return output;
120
- }
121
- normalizeGateValue(value, snapshotUpdatedAt, now) {
122
- if ('boolean' == typeof value) return {
123
- passed: value,
124
- updatedAt: this.normalizeUpdatedAt(snapshotUpdatedAt, now)
125
- };
126
- if (!value || 'object' != typeof value) return;
127
- const hasPassed = 'boolean' == typeof value.passed;
128
- const passed = true === value.passed;
129
- let reason = 'string' == typeof value.reason && value.reason.trim().length > 0 ? value.reason : void 0;
130
- if (!hasPassed) reason = reason || 'Gate snapshot record is missing "passed" boolean';
131
- return {
132
- passed,
133
- reason,
134
- updatedAt: this.normalizeUpdatedAt(value.updatedAt ?? snapshotUpdatedAt, now),
135
- expiresAt: this.normalizeExpiresAt(value.expiresAt)
136
- };
137
- }
138
- normalizeUpdatedAt(value, fallback) {
139
- if ('number' == typeof value && Number.isFinite(value) && value > 0) return value;
140
- return fallback;
141
- }
142
- normalizeExpiresAt(value) {
143
- if ('number' == typeof value && Number.isFinite(value) && value > 0) return value;
144
- }
145
- constructor(options){
146
- this.appliedGateFingerprints = new Map();
147
- this.orchestrator = options.orchestrator;
148
- if (!options.gateSnapshotStore && !options.gateSnapshotPath) throw new Error('ContractGateAutopilot requires gateSnapshotPath or gateSnapshotStore');
149
- this.gateSnapshotPath = options.gateSnapshotPath;
150
- this.gateSnapshotStore = options.gateSnapshotStore || (0, external_contractGateSnapshotStore_js_namespaceObject.createFileContractGateSnapshotStore)(options.gateSnapshotPath);
151
- this.pollIntervalMs = Math.max(250, options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS);
152
- this.gateStaleAfterMs = Math.max(0, options.gateStaleAfterMs ?? DEFAULT_GATE_STALE_AFTER_MS);
153
- this.logger = options.logger;
154
- }
155
- }
156
- exports.ContractGateAutopilot = __webpack_exports__.ContractGateAutopilot;
157
- for(var __rspack_i in __webpack_exports__)if (-1 === [
158
- "ContractGateAutopilot"
159
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
160
- Object.defineProperty(exports, '__esModule', {
161
- value: true
162
- });
@@ -1,243 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.n = (module)=>{
5
- var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
- __webpack_require__.d(getter, {
7
- a: getter
8
- });
9
- return getter;
10
- };
11
- })();
12
- (()=>{
13
- __webpack_require__.d = (exports1, getters, values)=>{
14
- var define = (defs, kind)=>{
15
- for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
16
- enumerable: true,
17
- [kind]: defs[key]
18
- });
19
- };
20
- define(getters, "get");
21
- define(values, "value");
22
- };
23
- })();
24
- (()=>{
25
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
26
- })();
27
- (()=>{
28
- __webpack_require__.r = (exports1)=>{
29
- if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
30
- value: 'Module'
31
- });
32
- Object.defineProperty(exports1, '__esModule', {
33
- value: true
34
- });
35
- };
36
- })();
37
- var __webpack_exports__ = {};
38
- __webpack_require__.r(__webpack_exports__);
39
- __webpack_require__.d(__webpack_exports__, {
40
- CONTRACT_GATE_SNAPSHOT_SCHEMA_VERSION: ()=>CONTRACT_GATE_SNAPSHOT_SCHEMA_VERSION,
41
- DEFAULT_CONTRACT_GATE_SNAPSHOT_PATH: ()=>DEFAULT_CONTRACT_GATE_SNAPSHOT_PATH,
42
- createFileContractGateSnapshotStore: ()=>createFileContractGateSnapshotStore,
43
- createHttpContractGateSnapshotStore: ()=>createHttpContractGateSnapshotStore,
44
- resolveContractGateSnapshotPath: ()=>resolveContractGateSnapshotPath,
45
- resolveContractGateSnapshotStore: ()=>resolveContractGateSnapshotStore
46
- });
47
- const utils_namespaceObject = require("@modern-js/utils");
48
- const external_fs_namespaceObject = require("fs");
49
- const external_path_namespaceObject = require("path");
50
- var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
51
- const CONTRACT_GATE_SNAPSHOT_SCHEMA_VERSION = 1;
52
- const DEFAULT_CONTRACT_GATE_SNAPSHOT_PATH = '.modern/contract-gates.json';
53
- const DEFAULT_HTTP_STORE_TIMEOUT_MS = 5000;
54
- const BUILTIN_HTTP_STATE_STORE_MODULES = new Set([
55
- 'http',
56
- '@modern-js/server-core/http',
57
- '@modern-js/server-core/contract-gate-http-store'
58
- ]);
59
- const isRecord = (value)=>'object' == typeof value && null !== value && !Array.isArray(value);
60
- const normalizeSnapshot = (snapshot)=>{
61
- if (!isRecord(snapshot)) return;
62
- const schemaVersion = 'number' == typeof snapshot.schemaVersion ? snapshot.schemaVersion : CONTRACT_GATE_SNAPSHOT_SCHEMA_VERSION;
63
- const updatedAt = 'number' == typeof snapshot.updatedAt ? snapshot.updatedAt : Date.now();
64
- const gates = isRecord(snapshot.gates) ? snapshot.gates : {};
65
- return {
66
- schemaVersion,
67
- updatedAt,
68
- gates
69
- };
70
- };
71
- const normalizeHttpStoreOptions = (options)=>{
72
- const endpoint = 'string' == typeof options?.endpoint ? options.endpoint.trim() : '';
73
- if (!endpoint) throw new Error('[telemetry.canary.autopilot] HTTP stateStore requires options.endpoint');
74
- const readMethod = 'string' == typeof options?.readMethod && options.readMethod.trim() ? options.readMethod.trim().toUpperCase() : 'GET';
75
- const writeMethod = 'string' == typeof options?.writeMethod && options.writeMethod.trim() ? options.writeMethod.trim().toUpperCase() : 'PUT';
76
- const timeoutMsRaw = Number(options?.timeoutMs);
77
- const timeoutMs = Number.isFinite(timeoutMsRaw) && timeoutMsRaw > 0 ? Math.floor(timeoutMsRaw) : DEFAULT_HTTP_STORE_TIMEOUT_MS;
78
- const headersRaw = options?.headers;
79
- const headers = {};
80
- if (headersRaw && 'object' == typeof headersRaw && !Array.isArray(headersRaw)) Object.entries(headersRaw).forEach(([key, value])=>{
81
- if ('string' == typeof key && key.trim().length > 0 && null != value) headers[key] = String(value);
82
- });
83
- return {
84
- endpoint,
85
- readMethod,
86
- writeMethod,
87
- headers,
88
- timeoutMs
89
- };
90
- };
91
- const withTimeoutAbort = (timeoutMs)=>{
92
- const controller = new AbortController();
93
- const timer = setTimeout(()=>controller.abort(), timeoutMs);
94
- return {
95
- signal: controller.signal,
96
- clear: ()=>clearTimeout(timer)
97
- };
98
- };
99
- const createHttpContractGateSnapshotStore = (options)=>{
100
- const normalized = normalizeHttpStoreOptions(options);
101
- const endpoint = normalized.endpoint;
102
- return {
103
- name: `http:${endpoint}`,
104
- async readSnapshot () {
105
- const { signal, clear } = withTimeoutAbort(normalized.timeoutMs || 5000);
106
- try {
107
- const response = await fetch(endpoint, {
108
- method: normalized.readMethod || 'GET',
109
- headers: {
110
- accept: 'application/json',
111
- ...normalized.headers || {}
112
- },
113
- signal
114
- });
115
- if (404 === response.status) return;
116
- if (!response.ok) throw new Error(`HTTP stateStore read failed with status ${String(response.status)}`);
117
- const payload = await response.json();
118
- return normalizeSnapshot(payload);
119
- } finally{
120
- clear();
121
- }
122
- },
123
- async writeSnapshot (snapshot) {
124
- const body = JSON.stringify(normalizeSnapshot(snapshot) || {
125
- schemaVersion: CONTRACT_GATE_SNAPSHOT_SCHEMA_VERSION,
126
- updatedAt: Date.now(),
127
- gates: {}
128
- });
129
- const { signal, clear } = withTimeoutAbort(normalized.timeoutMs || 5000);
130
- try {
131
- const response = await fetch(endpoint, {
132
- method: normalized.writeMethod || 'PUT',
133
- headers: {
134
- 'content-type': 'application/json',
135
- ...normalized.headers || {}
136
- },
137
- body,
138
- signal
139
- });
140
- if (!response.ok) throw new Error(`HTTP stateStore write failed with status ${String(response.status)}`);
141
- } finally{
142
- clear();
143
- }
144
- }
145
- };
146
- };
147
- const tryResolveBuiltinSnapshotStore = (input)=>{
148
- const moduleName = input.stateStore.module.trim();
149
- if (!BUILTIN_HTTP_STATE_STORE_MODULES.has(moduleName)) return;
150
- return createHttpContractGateSnapshotStore(input.stateStore.options || {});
151
- };
152
- const pickStoreFactory = (mod)=>{
153
- if ('function' == typeof mod) return mod;
154
- if ('function' == typeof mod.createContractGateSnapshotStore) return mod.createContractGateSnapshotStore;
155
- if ('function' == typeof mod.default) return mod.default;
156
- if (mod.default && 'object' == typeof mod.default && 'function' == typeof mod.default.createContractGateSnapshotStore) return mod.default.createContractGateSnapshotStore;
157
- };
158
- const ensureStoreShape = (store, modulePath)=>{
159
- if (!store || 'object' != typeof store || 'function' != typeof store.readSnapshot || 'function' != typeof store.writeSnapshot) throw new Error(`Invalid contract gate snapshot store from "${modulePath}". Expected { readSnapshot(), writeSnapshot() }.`);
160
- };
161
- const resolveStoreModulePath = (appDirectory, modulePath)=>{
162
- const normalized = modulePath.trim();
163
- if (!normalized) throw new Error('Contract gate snapshot stateStore.module must be non-empty');
164
- if (external_path_default().isAbsolute(normalized)) return normalized;
165
- return normalized.startsWith('.') ? external_path_default().resolve(appDirectory, normalized) : normalized;
166
- };
167
- const resolveContractGateSnapshotPath = (appDirectory, configuredPath)=>{
168
- const rawPath = configuredPath || process.env.MODERN_CONTRACT_GATES_FILE || DEFAULT_CONTRACT_GATE_SNAPSHOT_PATH;
169
- if (external_path_default().isAbsolute(rawPath)) return rawPath;
170
- return external_path_default().resolve(appDirectory, rawPath);
171
- };
172
- const createFileContractGateSnapshotStore = (gateSnapshotPath)=>{
173
- const resolvedPath = external_path_default().resolve(gateSnapshotPath);
174
- return {
175
- name: `file:${resolvedPath}`,
176
- async readSnapshot () {
177
- if (!await utils_namespaceObject.fs.pathExists(resolvedPath)) return;
178
- try {
179
- const raw = await external_fs_namespaceObject.promises.readFile(resolvedPath, 'utf8');
180
- return normalizeSnapshot(JSON.parse(raw));
181
- } catch (_error) {
182
- return;
183
- }
184
- },
185
- async writeSnapshot (snapshot) {
186
- const normalized = normalizeSnapshot(snapshot) || {
187
- schemaVersion: CONTRACT_GATE_SNAPSHOT_SCHEMA_VERSION,
188
- updatedAt: Date.now(),
189
- gates: {}
190
- };
191
- await external_fs_namespaceObject.promises.mkdir(external_path_default().dirname(resolvedPath), {
192
- recursive: true
193
- });
194
- await external_fs_namespaceObject.promises.writeFile(resolvedPath, `${JSON.stringify(normalized, null, 2)}\n`);
195
- }
196
- };
197
- };
198
- const resolveContractGateSnapshotStore = async (input)=>{
199
- const { appDirectory, gateSnapshotPath, stateStore, logger } = input;
200
- if (!stateStore?.module) return createFileContractGateSnapshotStore(gateSnapshotPath);
201
- const builtinStore = tryResolveBuiltinSnapshotStore({
202
- stateStore
203
- });
204
- if (builtinStore) {
205
- logger?.info?.(`[telemetry.canary.autopilot] using built-in contract gate snapshot store "${builtinStore.name}"`);
206
- return builtinStore;
207
- }
208
- const modulePath = resolveStoreModulePath(appDirectory, stateStore.module);
209
- let mod;
210
- try {
211
- mod = require(modulePath);
212
- } catch (error) {
213
- throw new Error(`[telemetry.canary.autopilot] Failed to load stateStore.module "${stateStore.module}" (${modulePath}): ${error instanceof Error ? error.message : String(error)}`);
214
- }
215
- const factory = pickStoreFactory(mod);
216
- if (!factory) throw new Error(`[telemetry.canary.autopilot] stateStore.module "${stateStore.module}" does not export createContractGateSnapshotStore()`);
217
- const store = await factory({
218
- appDirectory,
219
- gateSnapshotPath,
220
- options: stateStore.options,
221
- logger
222
- });
223
- ensureStoreShape(store, modulePath);
224
- logger?.info?.(`[telemetry.canary.autopilot] using contract gate snapshot store "${store.name || modulePath}"`);
225
- return store;
226
- };
227
- exports.CONTRACT_GATE_SNAPSHOT_SCHEMA_VERSION = __webpack_exports__.CONTRACT_GATE_SNAPSHOT_SCHEMA_VERSION;
228
- exports.DEFAULT_CONTRACT_GATE_SNAPSHOT_PATH = __webpack_exports__.DEFAULT_CONTRACT_GATE_SNAPSHOT_PATH;
229
- exports.createFileContractGateSnapshotStore = __webpack_exports__.createFileContractGateSnapshotStore;
230
- exports.createHttpContractGateSnapshotStore = __webpack_exports__.createHttpContractGateSnapshotStore;
231
- exports.resolveContractGateSnapshotPath = __webpack_exports__.resolveContractGateSnapshotPath;
232
- exports.resolveContractGateSnapshotStore = __webpack_exports__.resolveContractGateSnapshotStore;
233
- for(var __rspack_i in __webpack_exports__)if (-1 === [
234
- "CONTRACT_GATE_SNAPSHOT_SCHEMA_VERSION",
235
- "DEFAULT_CONTRACT_GATE_SNAPSHOT_PATH",
236
- "createFileContractGateSnapshotStore",
237
- "createHttpContractGateSnapshotStore",
238
- "resolveContractGateSnapshotPath",
239
- "resolveContractGateSnapshotStore"
240
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
241
- Object.defineProperty(exports, '__esModule', {
242
- value: true
243
- });
@@ -1,82 +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 REMOTE_ENTRY_REGEXP = /(^|\/)remoteEntry(?:\.[a-zA-Z0-9_-]+)?\.js$/;
31
- function firstQueryValue(value) {
32
- if (Array.isArray(value)) return value.find((item)=>'string' == typeof item && item.length > 0);
33
- if ('string' == typeof value && value.length > 0) return value;
34
- }
35
- function getRequestPathname(url) {
36
- try {
37
- return new URL(url, 'http://modernjs.local').pathname;
38
- } catch (_error) {
39
- return url.split('?')[0] || '/';
40
- }
41
- }
42
- function isMfManifestAsset(pathname) {
43
- return pathname.endsWith('/mf-manifest.json') || pathname.endsWith('/mf-stats.json');
44
- }
45
- function isMfRemoteEntryAsset(pathname) {
46
- return REMOTE_ENTRY_REGEXP.test(pathname);
47
- }
48
- function hasRemoteVersionPin(query = {}) {
49
- return Boolean(firstQueryValue(query.mfv) || firstQueryValue(query.v) || firstQueryValue(query.version));
50
- }
51
- function resolveMfAssetCacheHeaders(url, query = {}) {
52
- const pathname = getRequestPathname(url);
53
- if (isMfManifestAsset(pathname)) return {
54
- 'cache-control': 'no-cache, no-store, must-revalidate',
55
- pragma: 'no-cache',
56
- expires: '0'
57
- };
58
- if (isMfRemoteEntryAsset(pathname)) return hasRemoteVersionPin(query) ? {
59
- 'cache-control': 'public, max-age=31536000, immutable'
60
- } : {
61
- 'cache-control': 'public, max-age=0, must-revalidate'
62
- };
63
- }
64
- __webpack_require__.d(__webpack_exports__, {
65
- getRequestPathname: ()=>getRequestPathname,
66
- isMfManifestAsset: ()=>isMfManifestAsset,
67
- isMfRemoteEntryAsset: ()=>isMfRemoteEntryAsset,
68
- resolveMfAssetCacheHeaders: ()=>resolveMfAssetCacheHeaders
69
- });
70
- exports.getRequestPathname = __webpack_exports__.getRequestPathname;
71
- exports.isMfManifestAsset = __webpack_exports__.isMfManifestAsset;
72
- exports.isMfRemoteEntryAsset = __webpack_exports__.isMfRemoteEntryAsset;
73
- exports.resolveMfAssetCacheHeaders = __webpack_exports__.resolveMfAssetCacheHeaders;
74
- for(var __rspack_i in __webpack_exports__)if (-1 === [
75
- "getRequestPathname",
76
- "isMfManifestAsset",
77
- "isMfRemoteEntryAsset",
78
- "resolveMfAssetCacheHeaders"
79
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
80
- Object.defineProperty(exports, '__esModule', {
81
- value: true
82
- });