@mearl/preset 3.0.0 → 3.0.1

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.en.md CHANGED
@@ -12,6 +12,8 @@ Browser and Node share one inheritance resolution and resource download; see [co
12
12
 
13
13
  The main entry shares preset validation and inheritance resolution across browsers and Node, without filesystem, network, credential, or browser permission side effects. Callers supply manifest loading. Optional `@mearl/preset/bundles` provides resource validation, bounded downloads, and explicitly invoked browser-local storage; see [browser bundles](../../docs/browser-bundles.en.md).
14
14
 
15
+ `@mearl/preset/pageRuntime` provides the page runtime host and source generation functions for standalone page injection scripts.
16
+
15
17
  ```ts
16
18
  import { resolvePreset, mergePresetDefaults } from '@mearl/preset';
17
19
 
package/README.md CHANGED
@@ -12,6 +12,8 @@
12
12
 
13
13
  主入口在浏览器和 Node 中共享 preset 清单校验与继承解析,没有文件系统、网络、凭据或浏览器权限副作用;清单加载由调用方提供。可选子入口 `@mearl/preset/bundles` 提供资源校验、受限下载和显式调用的浏览器本地存储,见 [能力包说明](../../docs/browser-bundles.md)。
14
14
 
15
+ `@mearl/preset/pageRuntime` 为独立的页面注入脚本提供页面运行时宿主及注入源码生成函数。
16
+
15
17
  ```ts
16
18
  import { resolvePreset, mergePresetDefaults } from '@mearl/preset';
17
19
 
@@ -1,19 +1,32 @@
1
1
  import { selectBrowserControl } from './browserControls.js';
2
2
  import { BundleError, MAX_BROWSER_STORAGE_BYTES, verifyBundle } from './bundle.js';
3
- import { satisfies } from 'semver';
4
- import { preparePresetPackages, presetPackages, presetSnapshotRevision, verifyPresetGraph, verifyPackageTargets } from './prepare.js';
3
+ import satisfies from 'semver/functions/satisfies.js';
4
+ import { preparePresetPackages, presetPackages, presetSnapshotRevision, verifyPresetGraph, verifyPackageTargets, } from './prepare.js';
5
5
  /** Core browser defaults also need synchronization when no browser package is declared. */
6
6
  export function presetRequiresBrowser(preset) {
7
- return Object.values(preset.packages).some(entry => entry.enabled !== false && entry.targets?.includes('browser')) || Object.keys(preset.appProfiles).length > 0 || Object.keys(preset.defaults).some(key => key === 'simulation' || key === 'extension' || key === 'services');
7
+ return (Object.values(preset.packages).some(entry => entry.enabled !== false && entry.targets?.includes('browser')) ||
8
+ Object.keys(preset.appProfiles).length > 0 ||
9
+ Object.keys(preset.defaults).some(key => key === 'simulation' || key === 'extension' || key === 'services'));
8
10
  }
9
11
  /** Browser selection can be derived from the same accepted batch without another download. */
10
12
  export async function browserPresetSnapshot(source, manifests, preset, bundles) {
11
13
  const ids = new Set(presetPackages(preset, ['browser']).map(([id]) => id));
12
14
  const selected = bundles.filter(bundle => ids.has(bundle.manifest.id));
13
15
  selectBrowserControl(selected);
14
- const packageTargets = Object.fromEntries(Object.entries(preset.packages).filter(([, entry]) => entry.enabled !== false).map(([id, entry]) => [id, entry.targets]));
15
- const data = { source, manifests, bundleRevisions: Object.fromEntries(selected.map(bundle => [bundle.manifest.id, bundle.revision])), packageTargets };
16
- return { snapshot: { ...data, revision: await presetSnapshotRevision(data) }, preset, bundles: selected };
16
+ const packageTargets = Object.fromEntries(Object.entries(preset.packages)
17
+ .filter(([, entry]) => entry.enabled !== false)
18
+ .map(([id, entry]) => [id, entry.targets]));
19
+ const data = {
20
+ source,
21
+ manifests,
22
+ bundleRevisions: Object.fromEntries(selected.map(bundle => [bundle.manifest.id, bundle.revision])),
23
+ packageTargets,
24
+ };
25
+ return {
26
+ snapshot: { ...data, revision: await presetSnapshotRevision(data) },
27
+ preset,
28
+ bundles: selected,
29
+ };
17
30
  }
18
31
  export async function prepareBrowserPreset(source, options) {
19
32
  const prepared = await preparePresetPackages(source, options, ['browser']);
@@ -29,7 +42,9 @@ export async function verifyPreparedBrowserPreset(value, mearlApiVersion) {
29
42
  throw new BundleError('BUNDLE_QUOTA', 'Browser preset package count exceeds 64');
30
43
  let total = 0;
31
44
  for (const bundle of value.bundles) {
32
- if (!bundle?.resources || typeof bundle.resources !== 'object' || Array.isArray(bundle.resources))
45
+ if (!bundle?.resources ||
46
+ typeof bundle.resources !== 'object' ||
47
+ Array.isArray(bundle.resources))
33
48
  throw new BundleError('BUNDLE_INVALID', 'Expected package resource buffers');
34
49
  const resources = Object.values(bundle.resources);
35
50
  if (resources.length > 64)
@@ -46,10 +61,14 @@ export async function verifyPreparedBrowserPreset(value, mearlApiVersion) {
46
61
  verifyBrowserPreset(value.snapshot, mearlApiVersion),
47
62
  Promise.all(value.bundles.map(bundle => verifyBundle(bundle, mearlApiVersion))),
48
63
  ]);
49
- if (bundles.length !== Object.keys(graph.snapshot.bundleRevisions).length || new Set(bundles.map(bundle => bundle.manifest.id)).size !== bundles.length || bundles.some(bundle => {
50
- const entry = graph.preset.packages[bundle.manifest.id];
51
- return graph.snapshot.bundleRevisions[bundle.manifest.id] !== bundle.revision || entry?.source !== bundle.source || (entry.version && !satisfies(bundle.manifest.version, entry.version));
52
- }))
64
+ if (bundles.length !== Object.keys(graph.snapshot.bundleRevisions).length ||
65
+ new Set(bundles.map(bundle => bundle.manifest.id)).size !== bundles.length ||
66
+ bundles.some(bundle => {
67
+ const entry = graph.preset.packages[bundle.manifest.id];
68
+ return (graph.snapshot.bundleRevisions[bundle.manifest.id] !== bundle.revision ||
69
+ entry?.source !== bundle.source ||
70
+ (entry.version && !satisfies(bundle.manifest.version, entry.version)));
71
+ }))
53
72
  throw new BundleError('BUNDLE_INTEGRITY', 'Browser activation requires every exact package');
54
73
  selectBrowserControl(bundles);
55
74
  verifyPackageTargets(graph.preset, bundles);
package/dist/bundle.d.ts CHANGED
@@ -58,5 +58,7 @@ export declare function bundleDigest(bytes: Uint8Array): Promise<string>;
58
58
  export declare function readBundleJson(bundle: PreparedBundle, name: string): unknown;
59
59
  export declare function readBundleText(bundle: PreparedBundle, name: string): string;
60
60
  export declare function prepareBundle(source: string, options: PrepareBundleOptions): Promise<PreparedBundle>;
61
+ /** Loads the resources declared by a validated manifest at its canonical source. */
62
+ export declare function loadBundleResources(source: string, manifest: BundleManifest, options: Pick<PrepareBundleOptions, 'load' | 'signal'>): Promise<PreparedBundle>;
61
63
  /** Revalidates persisted snapshots without network access and returns independent resource buffers. */
62
64
  export declare function verifyBundle(bundle: PreparedBundle, mearlApiVersion: string): Promise<PreparedBundle>;
package/dist/bundle.js CHANGED
@@ -1,4 +1,6 @@
1
- import { satisfies, valid, validRange } from 'semver';
1
+ import satisfies from 'semver/functions/satisfies.js';
2
+ import valid from 'semver/functions/valid.js';
3
+ import validRange from 'semver/ranges/valid.js';
2
4
  import { clonePresetDefaults } from './manifest.js';
3
5
  import { validateBrowserControl } from './browserControls.js';
4
6
  export const MAX_BUNDLE_BYTES = 16 * 1024 * 1024;
@@ -18,7 +20,9 @@ function invalid(message) {
18
20
  throw new BundleError('BUNDLE_INVALID', message);
19
21
  }
20
22
  function fields(value, names) {
21
- if (!value || typeof value !== 'object' || Array.isArray(value) ||
23
+ if (!value ||
24
+ typeof value !== 'object' ||
25
+ Array.isArray(value) ||
22
26
  Object.keys(value).some(key => !names.includes(key)))
23
27
  invalid('Unexpected manifest structure');
24
28
  }
@@ -48,10 +52,20 @@ export function validateBundleManifest(value, mearlApiVersion) {
48
52
  catch {
49
53
  invalid('Expected a JSON manifest');
50
54
  }
51
- fields(json, ['schemaVersion', 'id', 'version', 'requires', 'defaults', 'resources', 'contributions']);
55
+ fields(json, [
56
+ 'schemaVersion',
57
+ 'id',
58
+ 'version',
59
+ 'requires',
60
+ 'defaults',
61
+ 'resources',
62
+ 'contributions',
63
+ ]);
52
64
  if (json.defaults !== undefined)
53
65
  json.defaults = clonePresetDefaults(json.defaults);
54
- if (json.schemaVersion !== 1 || typeof json.id !== 'string' || !/^[a-z][a-z0-9-]{0,79}$/.test(json.id))
66
+ if (json.schemaVersion !== 1 ||
67
+ typeof json.id !== 'string' ||
68
+ !/^[a-z][a-z0-9-]{0,79}$/.test(json.id))
55
69
  invalid('Invalid bundle identity');
56
70
  if (typeof json.version !== 'string' || valid(json.version) !== json.version)
57
71
  invalid('Expected an exact bundle version');
@@ -74,45 +88,77 @@ export function validateBundleManifest(value, mearlApiVersion) {
74
88
  for (const [name, resource] of resources) {
75
89
  path(name);
76
90
  fields(resource, ['sha256', 'byteLength']);
77
- if (typeof resource.sha256 !== 'string' || !/^[a-f0-9]{64}$/.test(resource.sha256) ||
78
- typeof resource.byteLength !== 'number' || !Number.isSafeInteger(resource.byteLength) || resource.byteLength < 0)
91
+ if (typeof resource.sha256 !== 'string' ||
92
+ !/^[a-f0-9]{64}$/.test(resource.sha256) ||
93
+ typeof resource.byteLength !== 'number' ||
94
+ !Number.isSafeInteger(resource.byteLength) ||
95
+ resource.byteLength < 0)
79
96
  invalid('Invalid resource metadata');
80
97
  total += resource.byteLength;
81
98
  if (total > MAX_BUNDLE_BYTES)
82
99
  throw new BundleError('BUNDLE_QUOTA', 'Bundle resources exceed 16 MiB');
83
100
  }
84
101
  if (json.contributions !== undefined) {
85
- fields(json.contributions, ['appProfiles', 'pageRuntimes', 'nodeRuntimes', 'browserRuntimes', 'extension', 'requestUi', 'browserViews', 'browserControls']);
102
+ fields(json.contributions, [
103
+ 'appProfiles',
104
+ 'pageRuntimes',
105
+ 'nodeRuntimes',
106
+ 'browserRuntimes',
107
+ 'extension',
108
+ 'requestUi',
109
+ 'browserViews',
110
+ 'browserControls',
111
+ ]);
86
112
  const extension = json.contributions.extension;
87
- if (extension !== undefined && (typeof extension !== 'string' || !Object.hasOwn(json.resources, extension)))
113
+ if (extension !== undefined &&
114
+ (typeof extension !== 'string' || !Object.hasOwn(json.resources, extension)))
88
115
  invalid('Extension contributions must reference a declared resource');
89
- if (typeof extension === 'string' && json.resources[extension].byteLength > MAX_REQUEST_UI_BYTES)
116
+ if (typeof extension === 'string' &&
117
+ json.resources[extension].byteLength > MAX_REQUEST_UI_BYTES)
90
118
  throw new BundleError('BUNDLE_QUOTA', 'Extension contributions exceed 64 KiB');
91
119
  const controls = json.contributions.browserControls;
92
- if (controls !== undefined && (typeof controls !== 'string' || !Object.hasOwn(json.resources, controls)))
120
+ if (controls !== undefined &&
121
+ (typeof controls !== 'string' || !Object.hasOwn(json.resources, controls)))
93
122
  invalid('Browser controls must reference a declared resource');
94
- if (typeof controls === 'string' && json.resources[controls].byteLength > MAX_REQUEST_UI_BYTES)
123
+ if (typeof controls === 'string' &&
124
+ json.resources[controls].byteLength > MAX_REQUEST_UI_BYTES)
95
125
  throw new BundleError('BUNDLE_QUOTA', 'Browser controls exceed 64 KiB');
96
- if (json.contributions.requestUi !== undefined && (typeof json.contributions.requestUi !== 'string' || !Object.hasOwn(json.resources, json.contributions.requestUi)))
126
+ if (json.contributions.requestUi !== undefined &&
127
+ (typeof json.contributions.requestUi !== 'string' ||
128
+ !Object.hasOwn(json.resources, json.contributions.requestUi)))
97
129
  invalid('Request UI must reference a declared resource');
98
- if (typeof json.contributions.requestUi === 'string' && json.resources[json.contributions.requestUi].byteLength > MAX_REQUEST_UI_BYTES)
130
+ if (typeof json.contributions.requestUi === 'string' &&
131
+ json.resources[json.contributions.requestUi].byteLength >
132
+ MAX_REQUEST_UI_BYTES)
99
133
  throw new BundleError('BUNDLE_QUOTA', 'Request UI exceeds 64 KiB');
100
134
  if (json.contributions.browserViews !== undefined) {
101
- fields(json.contributions.browserViews, ['requestImport', 'requestCases', 'captureLauncher', 'captureController']);
135
+ fields(json.contributions.browserViews, [
136
+ 'requestImport',
137
+ 'requestCases',
138
+ 'captureLauncher',
139
+ 'captureController',
140
+ ]);
102
141
  for (const resource of Object.values(json.contributions.browserViews)) {
103
142
  if (typeof resource !== 'string' || !Object.hasOwn(json.resources, resource))
104
143
  invalid('Browser views must reference declared resources');
105
- if (json.resources[resource].byteLength > MAX_REQUEST_UI_BYTES)
144
+ if (json.resources[resource].byteLength >
145
+ MAX_REQUEST_UI_BYTES)
106
146
  throw new BundleError('BUNDLE_QUOTA', 'Browser view definition exceeds 64 KiB');
107
147
  }
108
148
  }
109
149
  const profiles = json.contributions.appProfiles === undefined ? [] : json.contributions.appProfiles;
110
- if (!Array.isArray(profiles) || profiles.some(name => typeof name !== 'string' || !Object.hasOwn(json.resources, name)) ||
150
+ if (!Array.isArray(profiles) ||
151
+ profiles.some(name => typeof name !== 'string' || !Object.hasOwn(json.resources, name)) ||
111
152
  new Set(profiles).size !== profiles.length)
112
153
  invalid('App profiles must reference distinct declared resources');
113
154
  const runtimes = json.contributions.pageRuntimes;
114
155
  if (runtimes !== undefined) {
115
- if (!runtimes || typeof runtimes !== 'object' || Array.isArray(runtimes) || Object.entries(runtimes).some(([id, name]) => !/^[a-z][a-z0-9-]{0,79}$/.test(id) || typeof name !== 'string' || !Object.hasOwn(json.resources, name)))
156
+ if (!runtimes ||
157
+ typeof runtimes !== 'object' ||
158
+ Array.isArray(runtimes) ||
159
+ Object.entries(runtimes).some(([id, name]) => !/^[a-z][a-z0-9-]{0,79}$/.test(id) ||
160
+ typeof name !== 'string' ||
161
+ !Object.hasOwn(json.resources, name)))
116
162
  invalid('Page runtimes must reference declared resources');
117
163
  for (const name of Object.values(runtimes)) {
118
164
  const resource = json.resources[name];
@@ -125,15 +171,26 @@ export function validateBundleManifest(value, mearlApiVersion) {
125
171
  const label = kind === 'nodeRuntimes' ? 'Node' : 'Browser';
126
172
  if (runtimes === undefined)
127
173
  continue;
128
- if (!runtimes || typeof runtimes !== 'object' || Array.isArray(runtimes) || Object.keys(runtimes).length > 16)
174
+ if (!runtimes ||
175
+ typeof runtimes !== 'object' ||
176
+ Array.isArray(runtimes) ||
177
+ Object.keys(runtimes).length > 16)
129
178
  invalid(`Invalid ${label} runtime declarations`);
130
179
  for (const [host, declaration] of Object.entries(runtimes)) {
131
180
  if (!/^[a-z][a-z0-9-]{0,79}$/.test(host))
132
181
  invalid(`Invalid ${label} runtime host`);
133
182
  fields(declaration, ['entry', 'bindings']);
134
- if (typeof declaration.entry !== 'string' || !Object.hasOwn(json.resources, declaration.entry) || !declaration.entry.endsWith('.cjs'))
183
+ if (typeof declaration.entry !== 'string' ||
184
+ !Object.hasOwn(json.resources, declaration.entry) ||
185
+ !declaration.entry.endsWith('.cjs'))
135
186
  invalid(`${label} runtime entry must reference a declared CommonJS resource`);
136
- if (!declaration.bindings || typeof declaration.bindings !== 'object' || Array.isArray(declaration.bindings) || Object.keys(declaration.bindings).length > 256 || Object.entries(declaration.bindings).some(([hook, handler]) => !/^[a-z][a-zA-Z0-9_.-]{0,127}$/.test(hook) || typeof handler !== 'string' || !/^[a-z][a-zA-Z0-9_.-]{0,127}$/.test(handler)))
187
+ if (!declaration.bindings ||
188
+ typeof declaration.bindings !== 'object' ||
189
+ Array.isArray(declaration.bindings) ||
190
+ Object.keys(declaration.bindings).length > 256 ||
191
+ Object.entries(declaration.bindings).some(([hook, handler]) => !/^[a-z][a-zA-Z0-9_.-]{0,127}$/.test(hook) ||
192
+ typeof handler !== 'string' ||
193
+ !/^[a-z][a-zA-Z0-9_.-]{0,127}$/.test(handler)))
137
194
  invalid(`Invalid ${label} runtime bindings`);
138
195
  }
139
196
  }
@@ -143,7 +200,12 @@ export function validateBundleManifest(value, mearlApiVersion) {
143
200
  return json;
144
201
  }
145
202
  export async function bundleDigest(bytes) {
146
- const digest = await crypto.subtle.digest('SHA-256', Uint8Array.from(bytes).buffer);
203
+ const buffer = bytes.buffer;
204
+ // WebCrypto snapshots fixed, non-shared input views before hashing asynchronously.
205
+ const data = buffer instanceof ArrayBuffer && !('resizable' in buffer && buffer.resizable)
206
+ ? new Uint8Array(buffer, bytes.byteOffset, bytes.byteLength)
207
+ : Uint8Array.from(bytes);
208
+ const digest = await crypto.subtle.digest('SHA-256', data);
147
209
  return Array.from(new Uint8Array(digest), byte => byte.toString(16).padStart(2, '0')).join('');
148
210
  }
149
211
  async function manifestRevision(source, manifest) {
@@ -172,7 +234,8 @@ export function readBundleText(bundle, name) {
172
234
  export async function prepareBundle(source, options) {
173
235
  options.signal?.throwIfAborted();
174
236
  source = bundleSourceUrl(source);
175
- if (options.version !== undefined && (!options.version.trim() || validRange(options.version) === null))
237
+ if (options.version !== undefined &&
238
+ (!options.version.trim() || validRange(options.version) === null))
176
239
  invalid('Invalid requested bundle version');
177
240
  const bytes = Uint8Array.from(await options.load(source, { maxBytes: MAX_BUNDLE_MANIFEST_BYTES, signal: options.signal }));
178
241
  options.signal?.throwIfAborted();
@@ -190,18 +253,31 @@ export async function prepareBundle(source, options) {
190
253
  invalid('Bundle identity does not match the requested package');
191
254
  if (options.version && !satisfies(manifest.version, options.version))
192
255
  throw new BundleError('BUNDLE_INCOMPATIBLE', 'Bundle version does not satisfy the requested range');
256
+ return loadBundleResources(source, manifest, options);
257
+ }
258
+ /** Loads the resources declared by a validated manifest at its canonical source. */
259
+ export async function loadBundleResources(source, manifest, options) {
193
260
  const resources = {};
194
261
  for (const [name, expected] of Object.entries(manifest.resources)) {
195
262
  options.signal?.throwIfAborted();
196
- const resource = Uint8Array.from(await options.load(new URL(name, source).href, { maxBytes: expected.byteLength, signal: options.signal }));
263
+ const resource = Uint8Array.from(await options.load(new URL(name, source).href, {
264
+ maxBytes: expected.byteLength,
265
+ signal: options.signal,
266
+ }));
197
267
  options.signal?.throwIfAborted();
198
- if (resource.byteLength !== expected.byteLength || await bundleDigest(resource) !== expected.sha256) {
268
+ if (resource.byteLength !== expected.byteLength ||
269
+ (await bundleDigest(resource)) !== expected.sha256) {
199
270
  throw new BundleError('BUNDLE_INTEGRITY', `Resource integrity check failed: ${name}`);
200
271
  }
201
272
  resources[name] = resource;
202
273
  }
203
274
  options.signal?.throwIfAborted();
204
- const prepared = { source, manifest, revision: await manifestRevision(source, manifest), resources };
275
+ const prepared = {
276
+ source,
277
+ manifest,
278
+ revision: await manifestRevision(source, manifest),
279
+ resources,
280
+ };
205
281
  if (manifest.contributions?.browserControls)
206
282
  validateBrowserControl(readBundleJson(prepared, manifest.contributions.browserControls));
207
283
  return prepared;
@@ -211,7 +287,8 @@ export async function verifyBundle(bundle, mearlApiVersion) {
211
287
  const source = bundleSourceUrl(bundle.source);
212
288
  const manifest = validateBundleManifest(bundle.manifest, mearlApiVersion);
213
289
  const revision = bundle.revision;
214
- if (!bundle.resources || typeof bundle.resources !== 'object' ||
290
+ if (!bundle.resources ||
291
+ typeof bundle.resources !== 'object' ||
215
292
  Object.keys(bundle.resources).length !== Object.keys(manifest.resources).length)
216
293
  invalid('Stored resource set does not match the manifest');
217
294
  const resources = {};
@@ -225,10 +302,10 @@ export async function verifyBundle(bundle, mearlApiVersion) {
225
302
  }
226
303
  resources[name] = bytes;
227
304
  }
228
- if (await manifestRevision(source, manifest) !== revision)
305
+ if ((await manifestRevision(source, manifest)) !== revision)
229
306
  throw new BundleError('BUNDLE_INTEGRITY', 'Stored manifest revision does not match');
230
307
  for (const [name, expected] of Object.entries(manifest.resources)) {
231
- if (await bundleDigest(resources[name]) !== expected.sha256)
308
+ if ((await bundleDigest(resources[name])) !== expected.sha256)
232
309
  throw new BundleError('BUNDLE_INTEGRITY', `Stored resource integrity check failed: ${name}`);
233
310
  }
234
311
  const prepared = { source, manifest, revision, resources };
@@ -1,19 +1,32 @@
1
- import { valid, validRange, satisfies, subset } from 'semver';
1
+ import satisfies from 'semver/functions/satisfies.js';
2
+ import valid from 'semver/functions/valid.js';
3
+ import subset from 'semver/ranges/subset.js';
4
+ import validRange from 'semver/ranges/valid.js';
2
5
  import { isJsonObject, PresetError } from './manifest.js';
3
6
  /** Declarative installation guidance; never accepts commands, arguments or executable hooks. */
4
7
  export function parseSetupManagement(value) {
5
8
  if (value === undefined)
6
9
  return;
7
- const invalid = () => { throw new PresetError('PRESET_INVALID', 'Invalid defaults.management.setup declaration'); };
8
- if (!isJsonObject(value) || Object.keys(value).some(key => key !== 'setup') || !isJsonObject(value.setup))
10
+ const invalid = () => {
11
+ throw new PresetError('PRESET_INVALID', 'Invalid defaults.management.setup declaration');
12
+ };
13
+ if (!isJsonObject(value) ||
14
+ Object.keys(value).some(key => key !== 'setup') ||
15
+ !isJsonObject(value.setup))
9
16
  return invalid();
10
17
  const setup = value.setup;
11
18
  if (Object.keys(setup).some(key => !['package', 'version', 'registry', 'runtime'].includes(key)) ||
12
- typeof setup.package !== 'string' || setup.package.length > 214 || !/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(setup.package) ||
13
- typeof setup.version !== 'string' || setup.version.length > 64 || !(valid(setup.version) === setup.version || /^[a-z][a-z0-9.-]*$/.test(setup.version)))
19
+ typeof setup.package !== 'string' ||
20
+ setup.package.length > 214 ||
21
+ !/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(setup.package) ||
22
+ typeof setup.version !== 'string' ||
23
+ setup.version.length > 64 ||
24
+ !(valid(setup.version) === setup.version || /^[a-z][a-z0-9.-]*$/.test(setup.version)))
14
25
  return invalid();
15
26
  if (setup.registry !== undefined) {
16
- if (typeof setup.registry !== 'string' || setup.registry.length > 2048 || !/^https:\/\/[a-zA-Z0-9./:_-]+$/.test(setup.registry))
27
+ if (typeof setup.registry !== 'string' ||
28
+ setup.registry.length > 2048 ||
29
+ !/^https:\/\/[a-zA-Z0-9./:_-]+$/.test(setup.registry))
17
30
  return invalid();
18
31
  try {
19
32
  const url = new URL(setup.registry);
@@ -24,7 +37,8 @@ export function parseSetupManagement(value) {
24
37
  return invalid();
25
38
  }
26
39
  }
27
- if (setup.runtime !== undefined && (typeof setup.runtime !== 'string' || setup.runtime.length > 128 || !validRange(setup.runtime)))
40
+ if (setup.runtime !== undefined &&
41
+ (typeof setup.runtime !== 'string' || setup.runtime.length > 128 || !validRange(setup.runtime)))
28
42
  return invalid();
29
43
  return { ...setup };
30
44
  }
@@ -32,5 +46,7 @@ export function setupManagementCommand(setup) {
32
46
  return `npx${setup.registry ? ` --registry=${setup.registry}` : ''} ${setup.package}@${setup.version}`;
33
47
  }
34
48
  export function setupRuntimeCompatible(setup, version, targetLine) {
35
- return !setup.runtime || (satisfies(version, setup.runtime, { includePrerelease: true }) && (!targetLine || subset(targetLine, setup.runtime, { includePrerelease: true })));
49
+ return (!setup.runtime ||
50
+ (satisfies(version, setup.runtime, { includePrerelease: true }) &&
51
+ (!targetLine || subset(targetLine, setup.runtime, { includePrerelease: true }))));
36
52
  }
package/dist/manifest.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { validateInstallationOrigin } from './installation.js';
2
- import { valid, validRange } from 'semver';
2
+ import valid from 'semver/functions/valid.js';
3
+ import validRange from 'semver/ranges/valid.js';
3
4
  export class PresetError extends Error {
4
5
  code;
5
6
  constructor(code, message) {
@@ -14,9 +15,10 @@ function invalid(path, reason) {
14
15
  throw new PresetError('PRESET_INVALID', `${path}: ${reason}`);
15
16
  }
16
17
  export function isJsonObject(value) {
17
- return value !== null && typeof value === 'object' &&
18
+ return (value !== null &&
19
+ typeof value === 'object' &&
18
20
  !Array.isArray(value) &&
19
- (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);
21
+ (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null));
20
22
  }
21
23
  function object(value, path) {
22
24
  if (!isJsonObject(value))
@@ -88,7 +90,8 @@ function component(value, path, kind) {
88
90
  invalid(`${path}.enabled`, 'expected a boolean');
89
91
  if ('targets' in value) {
90
92
  stringArray(value.targets, `${path}.targets`);
91
- if (value.targets.length === 0 || value.targets.some(item => item !== 'browser' && item !== 'node')) {
93
+ if (value.targets.length === 0 ||
94
+ value.targets.some(item => item !== 'browser' && item !== 'node')) {
92
95
  invalid(`${path}.targets`, 'expected browser and/or node');
93
96
  }
94
97
  }
@@ -100,7 +103,19 @@ function component(value, path, kind) {
100
103
  return json(value, path);
101
104
  }
102
105
  export function validatePreset(value) {
103
- fields(value, 'preset', ['schemaVersion', 'id', 'version', 'extends', 'requires', 'packages', 'skills', 'providers', 'appProfiles', 'defaults', 'permissions']);
106
+ fields(value, 'preset', [
107
+ 'schemaVersion',
108
+ 'id',
109
+ 'version',
110
+ 'extends',
111
+ 'requires',
112
+ 'packages',
113
+ 'skills',
114
+ 'providers',
115
+ 'appProfiles',
116
+ 'defaults',
117
+ 'permissions',
118
+ ]);
104
119
  if (value.schemaVersion !== 1)
105
120
  invalid('schemaVersion', 'only version 1 is supported');
106
121
  id(value.id, 'id');
@@ -113,13 +128,20 @@ export function validatePreset(value) {
113
128
  text(value.extends.source, 'extends.source');
114
129
  if ('version' in value.extends)
115
130
  range(value.extends.version, 'extends.version');
116
- result.extends = { source: value.extends.source, ...(value.extends.version === undefined ? {} : { version: value.extends.version }) };
131
+ result.extends = {
132
+ source: value.extends.source,
133
+ ...(value.extends.version === undefined ? {} : { version: value.extends.version }),
134
+ };
117
135
  }
118
136
  if ('requires' in value) {
119
137
  fields(value.requires, 'requires', ['mearlApi']);
120
138
  if ('mearlApi' in value.requires)
121
139
  range(value.requires.mearlApi, 'requires.mearlApi');
122
- result.requires = { ...(value.requires.mearlApi === undefined ? {} : { mearlApi: value.requires.mearlApi }) };
140
+ result.requires = {
141
+ ...(value.requires.mearlApi === undefined
142
+ ? {}
143
+ : { mearlApi: value.requires.mearlApi }),
144
+ };
123
145
  }
124
146
  for (const kind of ['packages', 'skills', 'providers']) {
125
147
  if (!(kind in value))
@@ -148,14 +170,18 @@ export function validatePreset(value) {
148
170
  const origins = value.permissions.origins ?? [];
149
171
  if (origins.length > 64)
150
172
  invalid('permissions.origins', 'exceeds 64 scopes');
151
- result.permissions = { origins: [...new Set(origins.map((origin, index) => {
173
+ result.permissions = {
174
+ origins: [
175
+ ...new Set(origins.map((origin, index) => {
152
176
  try {
153
177
  return validateInstallationOrigin(origin);
154
178
  }
155
179
  catch {
156
180
  return invalid(`permissions.origins[${index}]`, 'expected an explicit HTTP host scope');
157
181
  }
158
- }))] };
182
+ })),
183
+ ],
184
+ };
159
185
  }
160
186
  if (JSON.stringify(result).length > 262_144)
161
187
  invalid('preset', 'manifest exceeds 256 Ki UTF-16 code units');
package/dist/prepare.js CHANGED
@@ -1,5 +1,5 @@
1
- import { BundleError, MAX_BROWSER_STORAGE_BYTES, MAX_BUNDLE_MANIFEST_BYTES, bundleDigest, bundleSourceUrl, prepareBundle, validateBundleManifest } from './bundle.js';
2
- import { satisfies } from 'semver';
1
+ import { BundleError, MAX_BROWSER_STORAGE_BYTES, MAX_BUNDLE_MANIFEST_BYTES, bundleDigest, bundleSourceUrl, loadBundleResources, validateBundleManifest, } from './bundle.js';
2
+ import satisfies from 'semver/functions/satisfies.js';
3
3
  import { clonePresetDefaults, validatePreset } from './manifest.js';
4
4
  import { resolvePreset } from './resolve.js';
5
5
  export async function presetSnapshotRevision(value) {
@@ -7,7 +7,8 @@ export async function presetSnapshotRevision(value) {
7
7
  }
8
8
  /** Select candidates without assuming that inferred locations have been discovered. */
9
9
  function selectPresetPackages(preset, runtimes) {
10
- const entries = Object.entries(preset.packages).filter(([, entry]) => entry.enabled !== false && (entry.targets ?? ['browser', 'node']).some(runtime => runtimes.includes(runtime)));
10
+ const entries = Object.entries(preset.packages).filter(([, entry]) => entry.enabled !== false &&
11
+ (entry.targets ?? ['browser', 'node']).some(runtime => runtimes.includes(runtime)));
11
12
  if (entries.length > 64)
12
13
  throw new BundleError('BUNDLE_QUOTA', 'A preset can activate at most 64 packages');
13
14
  return entries;
@@ -35,7 +36,14 @@ export function presetPackages(preset, runtimes) {
35
36
  export function bundleTargets(bundle) {
36
37
  const contributions = bundle.manifest.contributions;
37
38
  const targets = [];
38
- if (contributions && (Object.keys(contributions.browserRuntimes ?? {}).length || Object.keys(contributions.pageRuntimes ?? {}).length || contributions.appProfiles?.length || contributions.extension || contributions.requestUi || contributions.browserViews || contributions.browserControls))
39
+ if (contributions &&
40
+ (Object.keys(contributions.browserRuntimes ?? {}).length ||
41
+ Object.keys(contributions.pageRuntimes ?? {}).length ||
42
+ contributions.appProfiles?.length ||
43
+ contributions.extension ||
44
+ contributions.requestUi ||
45
+ contributions.browserViews ||
46
+ contributions.browserControls))
39
47
  targets.push('browser');
40
48
  if (Object.keys(contributions?.nodeRuntimes ?? {}).length)
41
49
  targets.push('node');
@@ -49,7 +57,12 @@ export function applyPackageTargets(preset, targets) {
49
57
  const packages = { ...preset.packages };
50
58
  for (const [id, entry] of enabled) {
51
59
  const selected = targets[id];
52
- if (!Array.isArray(selected) || !selected.length || selected.length > 2 || new Set(selected).size !== selected.length || selected.some(target => target !== 'browser' && target !== 'node') || entry.targets && JSON.stringify(entry.targets) !== JSON.stringify(selected))
60
+ if (!Array.isArray(selected) ||
61
+ !selected.length ||
62
+ selected.length > 2 ||
63
+ new Set(selected).size !== selected.length ||
64
+ selected.some(target => target !== 'browser' && target !== 'node') ||
65
+ (entry.targets && JSON.stringify(entry.targets) !== JSON.stringify(selected)))
53
66
  throw new BundleError('BUNDLE_INTEGRITY', 'Invalid package target selection');
54
67
  packages[id] = { ...entry, targets: [...selected] };
55
68
  }
@@ -96,10 +109,14 @@ export async function preparePresetPackages(source, options, runtimes) {
96
109
  },
97
110
  });
98
111
  const targetsKnown = Object.values(preset.packages).every(entry => entry.enabled === false || Boolean(entry.targets?.length));
99
- const entries = targetsKnown ? presetPackages(preset, runtimes) : selectPresetPackages(preset, runtimes);
112
+ const entries = targetsKnown
113
+ ? presetPackages(preset, runtimes)
114
+ : selectPresetPackages(preset, runtimes);
100
115
  const bundles = [];
101
116
  const pending = [];
102
- const packageTargets = Object.fromEntries(Object.entries(preset.packages).filter(([, entry]) => entry.enabled !== false).map(([id, entry]) => [id, entry.targets ?? []]));
117
+ const packageTargets = Object.fromEntries(Object.entries(preset.packages)
118
+ .filter(([, entry]) => entry.enabled !== false)
119
+ .map(([id, entry]) => [id, entry.targets ?? []]));
103
120
  for (const [id, entry] of entries) {
104
121
  const manifestSource = bundleSourceUrl(entry.source);
105
122
  const bytes = Uint8Array.from(await load(manifestSource, { maxBytes: MAX_BUNDLE_MANIFEST_BYTES, signal: options.signal }));
@@ -121,25 +138,38 @@ export async function preparePresetPackages(source, options, runtimes) {
121
138
  if (targets.some(target => !available.includes(target)))
122
139
  throw new BundleError('BUNDLE_INCOMPATIBLE', 'Package does not support the selected target');
123
140
  packageTargets[id] = targets;
124
- pending.push({ id, entry, source: manifestSource, bytes });
141
+ pending.push({ source: manifestSource, manifest, bytes });
125
142
  }
126
143
  preset = applyPackageTargets(preset, packageTargets);
127
144
  const selected = new Set(presetPackages(preset, runtimes).map(([id]) => id));
128
- for (const candidate of pending) {
129
- if (!selected.has(candidate.id))
145
+ for (const { source: manifestSource, manifest, bytes } of pending) {
146
+ if (!selected.has(manifest.id))
130
147
  continue;
131
- bundles.push(await prepareBundle(candidate.source, { ...options, load: (url, request) => url === candidate.source ? Promise.resolve(candidate.bytes) : load(url, request), expectedId: candidate.id, version: candidate.entry.version }));
148
+ bundles.push(await loadBundleResources(manifestSource, manifest, {
149
+ // A resource at the manifest URL belongs to the same captured response.
150
+ load: (url, request) => url === manifestSource ? Promise.resolve(bytes) : load(url, request),
151
+ signal: options.signal,
152
+ }));
132
153
  }
133
- verifyPackageTargets(preset, bundles);
134
154
  options.signal?.throwIfAborted();
135
- return { source, manifests, preset, bundles: bundles.filter(bundle => selected.has(bundle.manifest.id)), packageTargets };
155
+ return { source, manifests, preset, bundles, packageTargets };
136
156
  }
137
157
  /** The exact graph is checked offline; installed resources are verified by the target store. */
138
158
  export async function verifyPresetGraph(value, mearlApiVersion, runtimes, full) {
139
159
  const json = clonePresetDefaults(value);
140
- const allowed = ['source', 'manifests', 'bundleRevisions', 'packageTargets', 'revision', ...(full ? ['schemaVersion'] : [])];
141
- if (Object.keys(json).some(key => !allowed.includes(key)) || (full && json.schemaVersion !== 1) ||
142
- typeof json.source !== 'string' || typeof json.revision !== 'string' || !/^[a-f0-9]{64}$/.test(json.revision)) {
160
+ const allowed = [
161
+ 'source',
162
+ 'manifests',
163
+ 'bundleRevisions',
164
+ 'packageTargets',
165
+ 'revision',
166
+ ...(full ? ['schemaVersion'] : []),
167
+ ];
168
+ if (Object.keys(json).some(key => !allowed.includes(key)) ||
169
+ (full && json.schemaVersion !== 1) ||
170
+ typeof json.source !== 'string' ||
171
+ typeof json.revision !== 'string' ||
172
+ !/^[a-f0-9]{64}$/.test(json.revision)) {
143
173
  throw new BundleError('BUNDLE_INTEGRITY', 'Invalid stored preset identity');
144
174
  }
145
175
  const source = bundleSourceUrl(json.source);
@@ -147,7 +177,8 @@ export async function verifyPresetGraph(value, mearlApiVersion, runtimes, full)
147
177
  if (Object.keys(manifests).length > 32)
148
178
  throw new BundleError('BUNDLE_QUOTA', 'Stored preset inheritance exceeds 32 manifests');
149
179
  const bundleRevisions = clonePresetDefaults(json.bundleRevisions);
150
- if (Object.keys(bundleRevisions).length > 64 || Object.values(bundleRevisions).some(revision => typeof revision !== 'string' || !/^[a-f0-9]{64}$/.test(revision))) {
180
+ if (Object.keys(bundleRevisions).length > 64 ||
181
+ Object.values(bundleRevisions).some(revision => typeof revision !== 'string' || !/^[a-f0-9]{64}$/.test(revision))) {
151
182
  throw new BundleError('BUNDLE_INTEGRITY', 'Invalid stored package revisions');
152
183
  }
153
184
  const validated = {};
@@ -157,8 +188,14 @@ export async function verifyPresetGraph(value, mearlApiVersion, runtimes, full)
157
188
  validated[url] = validatePreset(manifest);
158
189
  }
159
190
  const packageTargets = clonePresetDefaults(json.packageTargets);
160
- const data = { ...(full ? { schemaVersion: 1 } : {}), source, manifests: validated, bundleRevisions, packageTargets };
161
- if (await presetSnapshotRevision(data) !== json.revision)
191
+ const data = {
192
+ ...(full ? { schemaVersion: 1 } : {}),
193
+ source,
194
+ manifests: validated,
195
+ bundleRevisions,
196
+ packageTargets,
197
+ };
198
+ if ((await presetSnapshotRevision(data)) !== json.revision)
162
199
  throw new BundleError('BUNDLE_INTEGRITY', 'Stored preset revision does not match');
163
200
  let preset = await resolvePreset(source, {
164
201
  mearlApiVersion,
@@ -170,7 +207,9 @@ export async function verifyPresetGraph(value, mearlApiVersion, runtimes, full)
170
207
  });
171
208
  preset = applyPackageTargets(preset, packageTargets);
172
209
  const entries = presetPackages(preset, runtimes);
173
- if (preset.chain.length !== Object.keys(validated).length || entries.length !== Object.keys(bundleRevisions).length || entries.some(([id]) => !Object.hasOwn(bundleRevisions, id))) {
210
+ if (preset.chain.length !== Object.keys(validated).length ||
211
+ entries.length !== Object.keys(bundleRevisions).length ||
212
+ entries.some(([id]) => !Object.hasOwn(bundleRevisions, id))) {
174
213
  throw new BundleError('BUNDLE_INTEGRITY', 'Stored preset package graph does not match');
175
214
  }
176
215
  return { snapshot: { ...data, revision: json.revision }, preset };
package/dist/preset.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { browserPresetSnapshot } from './browserPreset.js';
2
- import { preparePresetPackages, presetSnapshotRevision, verifyPresetGraph, verifyPackageTargets } from './prepare.js';
3
- import { satisfies } from 'semver';
2
+ import { preparePresetPackages, presetSnapshotRevision, verifyPresetGraph, verifyPackageTargets, } from './prepare.js';
3
+ import satisfies from 'semver/functions/satisfies.js';
4
4
  import { BundleError, MAX_BROWSER_STORAGE_BYTES, verifyBundle } from './bundle.js';
5
5
  export async function preparePreset(source, options) {
6
6
  const prepared = await preparePresetPackages(source, options, ['browser', 'node']);
@@ -27,7 +27,9 @@ export async function verifyPreparedPreset(value, mearlApiVersion) {
27
27
  throw new BundleError('BUNDLE_QUOTA', 'Preset package count exceeds 64');
28
28
  let total = 0;
29
29
  for (const bundle of value.bundles) {
30
- if (!bundle?.resources || typeof bundle.resources !== 'object' || Array.isArray(bundle.resources))
30
+ if (!bundle?.resources ||
31
+ typeof bundle.resources !== 'object' ||
32
+ Array.isArray(bundle.resources))
31
33
  throw new BundleError('BUNDLE_INVALID', 'Expected package resource buffers');
32
34
  const resources = Object.values(bundle.resources);
33
35
  if (resources.length > 64)
@@ -46,10 +48,19 @@ export async function verifyPreparedPreset(value, mearlApiVersion) {
46
48
  ]);
47
49
  const { snapshot, preset } = graph;
48
50
  verifyPackageTargets(preset, bundles);
49
- if (bundles.length !== Object.keys(snapshot.bundleRevisions).length || new Set(bundles.map(bundle => bundle.manifest.id)).size !== bundles.length || bundles.some(bundle => {
50
- const entry = preset.packages[bundle.manifest.id];
51
- return snapshot.bundleRevisions[bundle.manifest.id] !== bundle.revision || entry?.source !== bundle.source || (entry.version && !satisfies(bundle.manifest.version, entry.version));
52
- }))
51
+ if (bundles.length !== Object.keys(snapshot.bundleRevisions).length ||
52
+ new Set(bundles.map(bundle => bundle.manifest.id)).size !== bundles.length ||
53
+ bundles.some(bundle => {
54
+ const entry = preset.packages[bundle.manifest.id];
55
+ return (snapshot.bundleRevisions[bundle.manifest.id] !== bundle.revision ||
56
+ entry?.source !== bundle.source ||
57
+ (entry.version && !satisfies(bundle.manifest.version, entry.version)));
58
+ }))
53
59
  throw new BundleError('BUNDLE_INTEGRITY', 'Preset installation requires every exact package');
54
- return { snapshot, preset, bundles, browser: await browserPresetSnapshot(snapshot.source, snapshot.manifests, preset, bundles) };
60
+ return {
61
+ snapshot,
62
+ preset,
63
+ bundles,
64
+ browser: await browserPresetSnapshot(snapshot.source, snapshot.manifests, preset, bundles),
65
+ };
55
66
  }
package/dist/resolve.js CHANGED
@@ -1,15 +1,17 @@
1
1
  import { parseToolboxCatalogs } from './toolboxCatalogs.js';
2
2
  import { parseSetupManagement } from './management.js';
3
- import { satisfies, valid } from 'semver';
3
+ import satisfies from 'semver/functions/satisfies.js';
4
+ import valid from 'semver/functions/valid.js';
4
5
  import { clonePresetDefaults, isJsonObject, PresetError, validatePreset } from './manifest.js';
5
6
  const kinds = ['packages', 'skills', 'providers'];
6
7
  /** Objects merge recursively; arrays, scalars and explicit null replace the previous value. */
7
8
  export function mergePresetDefaults(base, overrides) {
8
9
  const result = clonePresetDefaults(base);
9
10
  for (const [key, value] of Object.entries(clonePresetDefaults(overrides))) {
10
- result[key] = isJsonObject(value) && isJsonObject(result[key])
11
- ? mergePresetDefaults(result[key], value)
12
- : value;
11
+ result[key] =
12
+ isJsonObject(value) && isJsonObject(result[key])
13
+ ? mergePresetDefaults(result[key], value)
14
+ : value;
13
15
  }
14
16
  return result;
15
17
  }
@@ -93,7 +95,8 @@ export async function resolvePreset(source, options) {
93
95
  active.add(url);
94
96
  const manifest = validatePreset(await options.load(url));
95
97
  options.signal?.throwIfAborted();
96
- if (manifest.requires?.mearlApi && !satisfies(options.mearlApiVersion, manifest.requires.mearlApi)) {
98
+ if (manifest.requires?.mearlApi &&
99
+ !satisfies(options.mearlApiVersion, manifest.requires.mearlApi)) {
97
100
  throw new PresetError('PRESET_INCOMPATIBLE', `${manifest.id} requires Mearl API ${manifest.requires.mearlApi}`);
98
101
  }
99
102
  let parent;
@@ -106,21 +109,35 @@ export async function resolvePreset(source, options) {
106
109
  const result = {
107
110
  id: manifest.id,
108
111
  version: manifest.version,
109
- chain: [...(parent?.chain ?? []), { source: url, id: manifest.id, version: manifest.version }],
112
+ chain: [
113
+ ...(parent?.chain ?? []),
114
+ { source: url, id: manifest.id, version: manifest.version },
115
+ ],
110
116
  packages: { ...parent?.packages },
111
117
  skills: { ...parent?.skills },
112
118
  providers: { ...parent?.providers },
113
119
  appProfiles: { ...parent?.appProfiles, ...manifest.appProfiles },
114
120
  defaults: mergePresetDefaults(parent?.defaults ?? {}, manifest.defaults ?? {}),
115
- permissions: { origins: [...new Set([...(parent?.permissions.origins ?? []), ...(manifest.permissions?.origins ?? [])])] },
121
+ permissions: {
122
+ origins: [
123
+ ...new Set([
124
+ ...(parent?.permissions.origins ?? []),
125
+ ...(manifest.permissions?.origins ?? []),
126
+ ]),
127
+ ],
128
+ },
116
129
  };
117
130
  for (const kind of kinds) {
118
131
  for (const [id, patch] of Object.entries(manifest[kind] ?? {})) {
119
132
  result[kind][id] = {
120
133
  ...result[kind][id],
121
134
  ...patch,
122
- ...(patch.source === undefined ? {} : { source: componentSource(kind, patch.source, url) }),
123
- ...(patch.migrateFrom === undefined ? {} : { migrateFrom: patch.migrateFrom.map(source => componentSource(kind, source, url)) }),
135
+ ...(patch.source === undefined
136
+ ? {}
137
+ : { source: componentSource(kind, patch.source, url) }),
138
+ ...(patch.migrateFrom === undefined
139
+ ? {}
140
+ : { migrateFrom: patch.migrateFrom.map(source => componentSource(kind, source, url)) }),
124
141
  declaredBy: url,
125
142
  };
126
143
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mearl/preset",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Browser-compatible preset validation, inheritance and capability resolution for Mearl",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -19,6 +19,10 @@
19
19
  "types": "./dist/installation.d.ts",
20
20
  "import": "./dist/installation.js"
21
21
  },
22
+ "./pageRuntime": {
23
+ "types": "./dist/pageRuntime.d.ts",
24
+ "import": "./dist/pageRuntime.js"
25
+ },
22
26
  "./installation-site.json": "./installation-site.json",
23
27
  "./networkRoutes": {
24
28
  "types": "./dist/networkRoutes.d.ts",