@loomcli/loom 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  The Loom CLI toolchain. Its public surface is `@loomcli/loom/build`, which exports `packet()`.
4
4
 
5
- `packet()` is a `Bun.build` plugin. A Loom application keeps a `loom.packet.json` that reads `{ "build": "development" }` at its package root and passes it to its `Application` as `packet`. While Bun bundles the application, `packet()` writes `distributed` into the packet the bundle carries, so an operator sees one generic message for a defect, and the source file keeps reading `development`. The plugin also carries the data files core's Unicode tables read at run time, so a bundled application needs it to start.
5
+ `packet()` is a `Bun.build` plugin. A Loom application keeps a `loom.packet.json` that reads `{ "build": "development" }` at its package root and passes it to its `Application` as `packet`. While Bun bundles the application, `packet()` writes `distributed` into the packet the bundle carries, so an operator sees one generic message for a defect, and the source file keeps reading `development`. An application bundled without it, by any bundler, starts and reads the source packet, `development`, so it is a development build.
6
6
 
7
7
  ## Install
8
8
 
package/dist/build.d.ts CHANGED
@@ -8,7 +8,7 @@ interface PacketBuilder {
8
8
  filter: RegExp;
9
9
  }, callback: (args: PacketLoad) => Promise<{
10
10
  contents: string;
11
- loader: 'js' | 'json';
11
+ loader: 'json';
12
12
  }>): unknown;
13
13
  }
14
14
  /**
@@ -24,9 +24,8 @@ interface PacketPlugin {
24
24
  * The `Bun.build` plugin that makes a bundle a distributed build. While Bun bundles, it answers the
25
25
  * import of every `loom.packet.json` with the file's members and `build` set to `distributed`, and
26
26
  * it never writes to the source tree, so the source run keeps reading `development`. A compiled
27
- * binary built through `Bun.build` with this plugin is distributed too. It also carries the data
28
- * files core's Unicode tables read beside their own modules into the bundle, without which neither
29
- * a bundle nor a compiled binary can start.
27
+ * binary built through `Bun.build` with this plugin is distributed too. It answers no other module,
28
+ * so the bundle holds every other module as Bun bundles it.
30
29
  */
31
30
  export declare function packet(): PacketPlugin;
32
31
  export type { PacketBuilder, PacketLoad, PacketPlugin };
package/dist/build.js CHANGED
@@ -1,30 +1,6 @@
1
1
  import { readFile } from 'node:fs/promises';
2
2
  /** Every module whose file name is the packet's, wherever the entry imports it from. */
3
3
  const packetFile = /(?:^|[\\/])loom\.packet\.json$/u;
4
- /** The generated modules of core's Unicode tables, which read their data files at run time. */
5
- const unicodeTables = /[\\/]@rockorager[\\/]uucode[\\/]dist[\\/]src[\\/]generated[\\/][\w-]+\.js$/u;
6
- /** One table module's read of the data file beside it. */
7
- const tableRead = /JSON\.parse\(readFileSync\(new URL\("\.\/(?<file>[\w-]+\.json)", import\.meta\.url\), "utf8"\)\)/gu;
8
- /**
9
- * A table module with each data file it reads beside itself imported as a JSON module instead, so
10
- * the bundle carries the data. A bundle, and a compiled binary most of all, holds no file beside
11
- * the module that the original read could find. A table module with no read of that shape fails
12
- * the build, because a bundle built from it would fail at run time instead.
13
- */
14
- async function inlinedTables(path) {
15
- const source = await readFile(path, 'utf8');
16
- const imports = [];
17
- // The one capture is the data file's name, which the callback receives after the whole match.
18
- const contents = source.replaceAll(tableRead, (_read, file) => {
19
- const name = `table${String(imports.length)}`;
20
- imports.push(`import ${name} from './${file}' with { type: 'json' };`);
21
- return name;
22
- });
23
- if (imports.length === 0) {
24
- throw new Error(`packet() found no data file read in the Unicode table module ${path}. Update @loomcli/loom to a version that supports the installed @rockorager/uucode.`);
25
- }
26
- return [...imports, contents].join('\n');
27
- }
28
4
  /** Whether a parsed JSON value is a plain object, whose members the writer keeps. */
29
5
  function isRecord(value) {
30
6
  return typeof value === 'object' && value !== null && !Array.isArray(value);
@@ -45,9 +21,8 @@ async function distributedPacket(path) {
45
21
  * The `Bun.build` plugin that makes a bundle a distributed build. While Bun bundles, it answers the
46
22
  * import of every `loom.packet.json` with the file's members and `build` set to `distributed`, and
47
23
  * it never writes to the source tree, so the source run keeps reading `development`. A compiled
48
- * binary built through `Bun.build` with this plugin is distributed too. It also carries the data
49
- * files core's Unicode tables read beside their own modules into the bundle, without which neither
50
- * a bundle nor a compiled binary can start.
24
+ * binary built through `Bun.build` with this plugin is distributed too. It answers no other module,
25
+ * so the bundle holds every other module as Bun bundles it.
51
26
  */
52
27
  export function packet() {
53
28
  return {
@@ -57,10 +32,6 @@ export function packet() {
57
32
  contents: await distributedPacket(path),
58
33
  loader: 'json',
59
34
  }));
60
- build.onLoad({ filter: unicodeTables }, async ({ path }) => ({
61
- contents: await inlinedTables(path),
62
- loader: 'js',
63
- }));
64
35
  },
65
36
  };
66
37
  }
@@ -33,7 +33,7 @@ function pnpmManifestPath(resolve = (specifier) => import.meta.resolve(specifier
33
33
  return fileURLToPath(resolve('pnpm/package.json'));
34
34
  }
35
35
  catch (error) {
36
- throw new Error('Preparing pnpm-lock.yaml requires pnpm, an optional peer dependency of @loomcli/loom. Install pnpm 12.3.2 beside @loomcli/loom and run the command again.', { cause: error });
36
+ throw new Error('Preparing pnpm-lock.yaml requires pnpm, an optional peer dependency of @loomcli/loom. Install pnpm 12.8.1 beside @loomcli/loom and run the command again.', { cause: error });
37
37
  }
38
38
  }
39
39
  function updateLockfile(root) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loomcli/loom",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "The Loom CLI toolchain. Provides the packet() Bun.build plugin that marks a bundled Loom CLI application as a distributed build.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -19,16 +19,16 @@
19
19
  }
20
20
  },
21
21
  "dependencies": {
22
- "@loomcli/core": "0.6.0",
22
+ "@loomcli/core": "0.7.0",
23
23
  "mdast-util-from-markdown": "^2.0.3",
24
- "yaml": "^2.9.0",
25
- "zod": "^4.5.4"
24
+ "yaml": "^2.9.1",
25
+ "zod": "^4.6.5"
26
26
  },
27
27
  "devDependencies": {
28
- "pnpm": "12.3.2"
28
+ "pnpm": "12.8.1"
29
29
  },
30
30
  "peerDependencies": {
31
- "pnpm": "12.3.2"
31
+ "pnpm": "12.8.1"
32
32
  },
33
33
  "peerDependenciesMeta": {
34
34
  "pnpm": {