@unbound-app/rollup-plugin-hermes 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/manifest.d.mts +5 -3
- package/dist/manifest.mjs +8 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -32,7 +32,7 @@ export type HermesPlugin = {
|
|
|
32
32
|
};
|
|
33
33
|
/**
|
|
34
34
|
* @description Compiles the bundle's output file to Hermes bytecode, once per held hermesc version, as `<name>.<version>.bundle` beside it.
|
|
35
|
-
* @param options A fixed hermesc directory, or
|
|
35
|
+
* @param options A fixed hermesc directory, or which of npm's bytecode versions to hold; plus extra hermesc flags.
|
|
36
36
|
* @returns The rollup plugin, which rolldown also accepts.
|
|
37
37
|
*/
|
|
38
38
|
export default function hermes(options?: HermesOptions): HermesPlugin;
|
package/dist/index.mjs
CHANGED
|
@@ -60,7 +60,7 @@ async function compile(ctx, dir, js, flags) {
|
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* @description Compiles the bundle's output file to Hermes bytecode, once per held hermesc version, as `<name>.<version>.bundle` beside it.
|
|
63
|
-
* @param options A fixed hermesc directory, or
|
|
63
|
+
* @param options A fixed hermesc directory, or which of npm's bytecode versions to hold; plus extra hermesc flags.
|
|
64
64
|
* @returns The rollup plugin, which rolldown also accepts.
|
|
65
65
|
*/
|
|
66
66
|
function hermes(options = {}) {
|
package/dist/manifest.d.mts
CHANGED
|
@@ -21,7 +21,8 @@ export type ManifestContext = {
|
|
|
21
21
|
export type ManifestOptions = {
|
|
22
22
|
registryUrl?: string;
|
|
23
23
|
cacheDir?: string;
|
|
24
|
-
versions
|
|
24
|
+
/** The exact bytecode versions to hold; the newest few the manifest publishes when omitted. */
|
|
25
|
+
versions?: number[];
|
|
25
26
|
};
|
|
26
27
|
export type ManifestDeps = {
|
|
27
28
|
fetch?: typeof fetch;
|
|
@@ -54,9 +55,10 @@ export declare function fetchManifest(ctx: ManifestContext, options?: ManifestOp
|
|
|
54
55
|
*/
|
|
55
56
|
export declare function hermescBinary(dir: string): string;
|
|
56
57
|
/**
|
|
57
|
-
* @description Downloads the
|
|
58
|
+
* @description Downloads the requested hermesc versions, or the newest few, into the cache, once each, and returns where each one lives.
|
|
59
|
+
* Reports an error through `ctx` when a requested version is not published.
|
|
58
60
|
* @param ctx The plugin context that reports warnings and errors.
|
|
59
|
-
* @param options
|
|
61
|
+
* @param options The bytecode versions to hold, the registry URL and the cache directory.
|
|
60
62
|
* @param deps Replacements for `fetch` and the download, for tests.
|
|
61
63
|
* @returns One target per held bytecode version, newest first.
|
|
62
64
|
*/
|
package/dist/manifest.mjs
CHANGED
|
@@ -172,9 +172,10 @@ async function downloadVersion(npmVersion, root) {
|
|
|
172
172
|
if (process.platform !== "win32" && existsSync(binary)) await chmod(binary, 493);
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
|
-
* @description Downloads the
|
|
175
|
+
* @description Downloads the requested hermesc versions, or the newest few, into the cache, once each, and returns where each one lives.
|
|
176
|
+
* Reports an error through `ctx` when a requested version is not published.
|
|
176
177
|
* @param ctx The plugin context that reports warnings and errors.
|
|
177
|
-
* @param options
|
|
178
|
+
* @param options The bytecode versions to hold, the registry URL and the cache directory.
|
|
178
179
|
* @param deps Replacements for `fetch` and the download, for tests.
|
|
179
180
|
* @returns One target per held bytecode version, newest first.
|
|
180
181
|
*/
|
|
@@ -182,8 +183,12 @@ async function resolveHermesTargets(ctx, options = {}, deps = {}) {
|
|
|
182
183
|
const download = deps.download ?? downloadVersion;
|
|
183
184
|
const cacheDir = options.cacheDir ?? defaultCacheDir();
|
|
184
185
|
const manifest = await fetchManifest(ctx, options, deps);
|
|
186
|
+
const wanted = options.versions;
|
|
187
|
+
const missing = wanted?.filter((version) => !manifest.latest.includes(version)) ?? [];
|
|
188
|
+
if (missing.length) ctx.error(`hermesc does not publish bytecode ${missing.join(", ")}.`);
|
|
189
|
+
const held = wanted ? manifest.latest.filter((version) => wanted.includes(version)) : manifest.latest.slice(0, DEFAULT_HELD_VERSIONS);
|
|
185
190
|
const targets = [];
|
|
186
|
-
for (const version of
|
|
191
|
+
for (const version of held) {
|
|
187
192
|
const entry = manifest.versions[String(version)];
|
|
188
193
|
if (!entry) {
|
|
189
194
|
ctx.warn(`The hermesc manifest has no package for bytecode ${version}, skipping it.`);
|
package/package.json
CHANGED