@nola-lang/node-loader 0.1.2 → 0.1.3

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.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { bundleConfig, bundleSelfConfiguringConfig } from "./bundle-config.js";
2
2
  export { type BuildOptions, findProjectRoot, loadBuildOptions, loadCompilerOptions, loadNolaConfig, } from "./config.js";
3
- export { registerNola } from "./register.js";
3
+ export { assertNodeModuleHooks, registerNola } from "./register.js";
4
4
  export { formatDiagnostics, NolaTransformError, transformNola } from "./transform.js";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EACL,KAAK,YAAY,EACjB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EACL,KAAK,YAAY,EACjB,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export { bundleConfig, bundleSelfConfiguringConfig } from "./bundle-config.js";
2
2
  export { findProjectRoot, loadBuildOptions, loadCompilerOptions, loadNolaConfig, } from "./config.js";
3
- export { registerNola } from "./register.js";
3
+ export { assertNodeModuleHooks, registerNola } from "./register.js";
4
4
  export { formatDiagnostics, NolaTransformError, transformNola } from "./transform.js";
5
5
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAEL,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,EAEL,eAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,3 +1,12 @@
1
+ /**
2
+ * The loader IS Node's module customization hooks (`module.register`). Bun and
3
+ * Deno expose `node:module` but do not run the hooks (Bun's `register` is a
4
+ * silent no-op), so a `.tsi` import under them fails later with an opaque
5
+ * "export not found". Fail first, with the invocations that do work: every
6
+ * package manager is fine (`bun install`, `bun run start` — the `nola` bin is
7
+ * a Node script by shebang), only Bun/Deno AS THE RUNTIME is not.
8
+ */
9
+ export declare function assertNodeModuleHooks(versions?: Record<string, string | undefined>): void;
1
10
  /**
2
11
  * Config loads BEFORE the hooks register: the hooks worker gets no project
3
12
  * context of its own, so the compiler section rides in as `register` data —
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,IAAI,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAI7E"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAoB,GAAG,IAAI,CAQ3G;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,IAAI,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAK7E"}
package/dist/register.js CHANGED
@@ -1,6 +1,23 @@
1
1
  import { register } from "node:module";
2
+ import { Codes } from "@nola-lang/ast";
2
3
  import { nolaRuntime } from "@nola-lang/runtime";
3
4
  import { loadNolaConfig } from "./config.js";
5
+ /**
6
+ * The loader IS Node's module customization hooks (`module.register`). Bun and
7
+ * Deno expose `node:module` but do not run the hooks (Bun's `register` is a
8
+ * silent no-op), so a `.tsi` import under them fails later with an opaque
9
+ * "export not found". Fail first, with the invocations that do work: every
10
+ * package manager is fine (`bun install`, `bun run start` — the `nola` bin is
11
+ * a Node script by shebang), only Bun/Deno AS THE RUNTIME is not.
12
+ */
13
+ export function assertNodeModuleHooks(versions = process.versions) {
14
+ const other = versions.bun ? `Bun ${versions.bun}` : versions.deno ? `Deno ${versions.deno}` : undefined;
15
+ if (!other)
16
+ return;
17
+ throw new Error(`${Codes.LoaderHooksUnsupported}: the Nola loader needs Node.js module hooks, which ${other} does not run. ` +
18
+ "Run .tsi code on Node: `bun run start` / `npm start` (the nola bin runs on Node) or " +
19
+ "`node --import nola-lang/register src/main.ts`; `bun --bun` and `bun src/main.ts` cannot load .tsi files.");
20
+ }
4
21
  /**
5
22
  * Config loads BEFORE the hooks register: the hooks worker gets no project
6
23
  * context of its own, so the compiler section rides in as `register` data —
@@ -8,6 +25,7 @@ import { loadNolaConfig } from "./config.js";
8
25
  * (Consequence: nola.config.ts itself cannot import `.tsi` modules.)
9
26
  */
10
27
  export async function registerNola(opts = {}) {
28
+ assertNodeModuleHooks();
11
29
  const config = await loadNolaConfig(opts.dir ?? process.cwd());
12
30
  register("./hooks.js", { parentURL: import.meta.url, data: { compiler: config?.compiler } });
13
31
  if (config)
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAyB,EAAE;IAC5D,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/D,QAAQ,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC7F,IAAI,MAAM;QAAE,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC"}
1
+ {"version":3,"file":"register.js","sourceRoot":"","sources":["../src/register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,WAA+C,OAAO,CAAC,QAAQ;IACnG,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACzG,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,CAAC,sBAAsB,uDAAuD,KAAK,iBAAiB;QAC1G,sFAAsF;QACtF,2GAA2G,CAC9G,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,OAAyB,EAAE;IAC5D,qBAAqB,EAAE,CAAC;IACxB,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/D,QAAQ,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;IAC7F,IAAI,MAAM;QAAE,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAC5C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nola-lang/node-loader",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Node module hooks that compile .tsi on the fly (internal; powers nola run and nola-lang/register)",
5
5
  "keywords": [
6
6
  "nola"
@@ -33,10 +33,10 @@
33
33
  "!dist/.tsbuildinfo"
34
34
  ],
35
35
  "dependencies": {
36
- "@nola-lang/ast": "0.1.2",
37
- "@nola-lang/compiler": "0.1.2",
38
- "@nola-lang/parser": "0.1.2",
39
- "@nola-lang/runtime": "0.1.2",
36
+ "@nola-lang/ast": "0.1.3",
37
+ "@nola-lang/compiler": "0.1.3",
38
+ "@nola-lang/parser": "0.1.3",
39
+ "@nola-lang/runtime": "0.1.3",
40
40
  "@ampproject/remapping": "^2.3.0",
41
41
  "@jridgewell/sourcemap-codec": "^1.5.0",
42
42
  "esbuild": "^0.25.0"