@nola-lang/unplugin 0.1.0-alpha.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Evgen Mykhailenko
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # @nola-lang/unplugin
2
+
3
+ Universal bundler plugin for [Nola](https://github.com/nola-lang/nola) `.tsi` modules,
4
+ built on [unplugin](https://github.com/unjs/unplugin). One transform core serves
5
+ Vite, webpack, Rollup, esbuild, and Rspack through subpath exports:
6
+
7
+ ```ts
8
+ import nola from "@nola-lang/unplugin/vite"; // or /webpack, /rollup, /rolldown, /esbuild, /rspack
9
+ ```
10
+
11
+ Prefer the named wrapper packages (`@nola-lang/vite`, `@nola-lang/webpack`,
12
+ `@nola-lang/rollup`, `@nola-lang/rolldown`, `@nola-lang/esbuild`,
13
+ `@nola-lang/rspack`) — they re-export these adapters with per-bundler setup docs.
14
+
15
+ Nola execution is **server-only in v0**: the plugin lowers `.tsi` for server
16
+ builds (SSR entries, Node targets) and fails client bundles with `NOLA4001`.
@@ -0,0 +1,10 @@
1
+ export declare const COMPANION_PREFIX = "\0nola-companion:";
2
+ /** Loader-parity resolution (node-loader/hooks.ts): probe candidates next to the importer. */
3
+ export declare function resolveCompanionId(specifier: string, importerFile: string): string | null;
4
+ export declare function loadCompanionCode(id: string, sourceRoot: string): Promise<{
5
+ code: string;
6
+ watchFile: string;
7
+ }>;
8
+ /** Best-effort NOLA3012 parity: the immediate importer is all a bundler shows us. */
9
+ export declare function guardConfigGraphTsi(specifier: string, importerFile: string | undefined): void;
10
+ //# sourceMappingURL=companions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"companions.d.ts","sourceRoot":"","sources":["../src/companions.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB,sBAAsB,CAAC;AAEpD,8FAA8F;AAC9F,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiBzF;AAED,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CASpH;AAED,qFAAqF;AACrF,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAO7F"}
@@ -0,0 +1,44 @@
1
+ import { existsSync } from "node:fs";
2
+ import { readFile } from "node:fs/promises";
3
+ import { basename, dirname, resolve } from "node:path";
4
+ import { Codes } from "@nola-lang/ast";
5
+ import { companionSourceCandidates, compileCompanion, isCompanionSpecifier } from "@nola-lang/compiler";
6
+ import { transform } from "esbuild";
7
+ import { isWiringId } from "./core.js";
8
+ export const COMPANION_PREFIX = "\0nola-companion:";
9
+ /** Loader-parity resolution (node-loader/hooks.ts): probe candidates next to the importer. */
10
+ export function resolveCompanionId(specifier, importerFile) {
11
+ if (!isCompanionSpecifier(specifier) || !specifier.startsWith("."))
12
+ return null;
13
+ const importerDir = dirname(importerFile);
14
+ const literal = resolve(importerDir, specifier);
15
+ if (existsSync(literal)) {
16
+ // Never silently shadow: a real on-disk *.nola.* file is a reserved-namespace violation.
17
+ throw new Error(`${Codes.ReservedCompanionPath}: ${literal} matches the reserved *.nola.* companion namespace — rename the file.`);
18
+ }
19
+ for (const candidate of companionSourceCandidates(specifier)) {
20
+ const p = resolve(importerDir, candidate);
21
+ if (existsSync(p))
22
+ return `${COMPANION_PREFIX}${p}`;
23
+ }
24
+ throw new Error(`${Codes.CompanionUnavailable}: cannot locate the type source for "${specifier}" imported from ${importerFile}`);
25
+ }
26
+ export async function loadCompanionCode(id, sourceRoot) {
27
+ const file = id.slice(COMPANION_PREFIX.length);
28
+ const companion = compileCompanion(await readFile(file, "utf8"), file, { sourceRoot });
29
+ if (companion.code === "" || companion.diagnostics.length > 0) {
30
+ throw new Error(companion.diagnostics.map((d) => `${d.file}: ${d.code}: ${d.message}`).join("\n"));
31
+ }
32
+ // Plain TS with no meaningful original positions — strip types, skip the map (loader parity).
33
+ const js = await transform(companion.code, { loader: "ts", format: "esm" });
34
+ return { code: js.code, watchFile: file };
35
+ }
36
+ /** Best-effort NOLA3012 parity: the immediate importer is all a bundler shows us. */
37
+ export function guardConfigGraphTsi(specifier, importerFile) {
38
+ if (!specifier.endsWith(".tsi") || importerFile === undefined)
39
+ return;
40
+ if (isWiringId(importerFile) || basename(importerFile) === "nola.config.ts") {
41
+ throw new Error(`${Codes.ConfigImportsTsi}: nola.config.ts cannot import ".tsi" modules ("${specifier}" imported from ${importerFile}) — the config must be evaluable before Nola modules load.`);
42
+ }
43
+ }
44
+ //# sourceMappingURL=companions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"companions.js","sourceRoot":"","sources":["../src/companions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACxG,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AAEpD,8FAA8F;AAC9F,MAAM,UAAU,kBAAkB,CAAC,SAAiB,EAAE,YAAoB;IACxE,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC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,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACrG,CAAC;IACD,8FAA8F;IAC9F,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAC5E,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;AAC5C,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,mBAAmB,CAAC,SAAiB,EAAE,YAAgC;IACrF,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,YAAY,KAAK,SAAS;QAAE,OAAO;IACtE,IAAI,UAAU,CAAC,YAAY,CAAC,IAAI,QAAQ,CAAC,YAAY,CAAC,KAAK,gBAAgB,EAAE,CAAC;QAC5E,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,CAAC,gBAAgB,mDAAmD,SAAS,mBAAmB,YAAY,4DAA4D,CACjL,CAAC;IACJ,CAAC;AACH,CAAC"}
package/dist/core.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ import type { ProjectContext } from "./project.js";
2
+ /**
3
+ * The wiring virtual id carries the config path as a query param, so `load`
4
+ * needs no shared plugin state to find the config the importing module was
5
+ * compiled against. Deliberately SCHEME-LESS (no colon): webpack routes
6
+ * URI-scheme requests past enhanced-resolve, so a "virtual:" prefix would
7
+ * bypass unplugin's resolver hook there.
8
+ */
9
+ export declare const WIRING_ID = "virtual-nola-config";
10
+ export declare const RESOLVED_WIRING_ID = "\0virtual-nola-config";
11
+ export declare function wiringIdFor(configPath: string): string;
12
+ /** The config path out of a (resolved or unresolved) wiring id. */
13
+ export declare function configPathFromWiringId(id: string): string;
14
+ export declare function isWiringId(id: string): boolean;
15
+ /**
16
+ * The self-configuring wrapper as a virtual module. Mirrors
17
+ * bundleSelfConfiguringConfig (node-loader/bundle-config.ts) except the config
18
+ * is imported as a normal specifier so the BUNDLER bundles the config graph —
19
+ * watch/HMR for free, no nested esbuild pass. Importing is idempotent (ESM
20
+ * module cache); configure() before the first ask is legal from every module.
21
+ */
22
+ export declare function wiringSource(configPath: string): string;
23
+ /**
24
+ * Lower one .tsi to final JS + merged map. The wiring import is appended AFTER
25
+ * transformNola, at EOF — exactly like nola build appends its dist import:
26
+ * unmapped, original positions intact.
27
+ */
28
+ export declare function transformTsi(source: string, file: string, ctx: ProjectContext): Promise<{
29
+ code: string;
30
+ map: string;
31
+ }>;
32
+ //# sourceMappingURL=core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,wBAAwB,CAAC;AAC/C,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,mEAAmE;AACnE,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAOvD;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CASxC"}
package/dist/core.js ADDED
@@ -0,0 +1,52 @@
1
+ import { transformNola } from "@nola-lang/node-loader";
2
+ /**
3
+ * The wiring virtual id carries the config path as a query param, so `load`
4
+ * needs no shared plugin state to find the config the importing module was
5
+ * compiled against. Deliberately SCHEME-LESS (no colon): webpack routes
6
+ * URI-scheme requests past enhanced-resolve, so a "virtual:" prefix would
7
+ * bypass unplugin's resolver hook there.
8
+ */
9
+ export const WIRING_ID = "virtual-nola-config";
10
+ export const RESOLVED_WIRING_ID = "\0virtual-nola-config";
11
+ export function wiringIdFor(configPath) {
12
+ return `${WIRING_ID}?path=${encodeURIComponent(configPath)}`;
13
+ }
14
+ /** The config path out of a (resolved or unresolved) wiring id. */
15
+ export function configPathFromWiringId(id) {
16
+ const query = id.slice(id.indexOf("?path=") + "?path=".length);
17
+ return decodeURIComponent(query);
18
+ }
19
+ export function isWiringId(id) {
20
+ return id.startsWith(WIRING_ID) || id.startsWith(RESOLVED_WIRING_ID);
21
+ }
22
+ /**
23
+ * The self-configuring wrapper as a virtual module. Mirrors
24
+ * bundleSelfConfiguringConfig (node-loader/bundle-config.ts) except the config
25
+ * is imported as a normal specifier so the BUNDLER bundles the config graph —
26
+ * watch/HMR for free, no nested esbuild pass. Importing is idempotent (ESM
27
+ * module cache); configure() before the first ask is legal from every module.
28
+ */
29
+ export function wiringSource(configPath) {
30
+ return [
31
+ `import config from ${JSON.stringify(configPath.replace(/\\/g, "/"))};`,
32
+ `import { nolaRuntime } from "@nola-lang/runtime";`,
33
+ `nolaRuntime.configure(config, { source: "nola.config.ts" });`,
34
+ "",
35
+ ].join("\n");
36
+ }
37
+ /**
38
+ * Lower one .tsi to final JS + merged map. The wiring import is appended AFTER
39
+ * transformNola, at EOF — exactly like nola build appends its dist import:
40
+ * unmapped, original positions intact.
41
+ */
42
+ export async function transformTsi(source, file, ctx) {
43
+ const { code, map } = await transformNola(source, file, {
44
+ sourceRoot: ctx.sourceRoot,
45
+ underivableContextType: ctx.underivableContextType,
46
+ });
47
+ if (ctx.target === "app" && ctx.configPath !== null) {
48
+ return { code: `${code}\nimport ${JSON.stringify(wiringIdFor(ctx.configPath))};\n`, map };
49
+ }
50
+ return { code, map };
51
+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,GAAG,CAAC,UAAU;QAC1B,sBAAsB,EAAE,GAAG,CAAC,sBAAsB;KACnD,CAAC,CAAC;IACH,IAAI,GAAG,CAAC,MAAM,KAAK,KAAK,IAAI,GAAG,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;QACpD,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,YAAY,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC;IAC5F,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;AACvB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default: (options?: import("./project.js").NolaPluginOptions | undefined) => import("esbuild").Plugin;
2
+ export default _default;
3
+ //# sourceMappingURL=esbuild.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"esbuild.d.ts","sourceRoot":"","sources":["../src/esbuild.ts"],"names":[],"mappings":";AAEA,wBAAkC"}
@@ -0,0 +1,3 @@
1
+ import { NolaPlugin } from "./index.js";
2
+ export default NolaPlugin.esbuild;
3
+ //# sourceMappingURL=esbuild.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"esbuild.js","sourceRoot":"","sources":["../src/esbuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,eAAe,UAAU,CAAC,OAAO,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type UnpluginFactory, type UnpluginInstance } from "unplugin";
2
+ import { type NolaPluginOptions } from "./project.js";
3
+ export type { NolaPluginOptions } from "./project.js";
4
+ export declare const unpluginFactory: UnpluginFactory<NolaPluginOptions | undefined>;
5
+ export declare const NolaPlugin: UnpluginInstance<NolaPluginOptions | undefined>;
6
+ export default NolaPlugin;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAyC,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG9G,OAAO,EAAE,KAAK,iBAAiB,EAA6B,MAAM,cAAc,CAAC;AAEjF,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAMtD,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,iBAAiB,GAAG,SAAS,CAsG1E,CAAC;AAOF,eAAO,MAAM,UAAU,EAAE,gBAAgB,CAAC,iBAAiB,GAAG,SAAS,CAAmD,CAAC;AAC3H,eAAe,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,117 @@
1
+ import { Codes } from "@nola-lang/ast";
2
+ import { createUnplugin } from "unplugin";
3
+ import { COMPANION_PREFIX, guardConfigGraphTsi, loadCompanionCode, resolveCompanionId } from "./companions.js";
4
+ import { configPathFromWiringId, RESOLVED_WIRING_ID, transformTsi, WIRING_ID, wiringSource } from "./core.js";
5
+ import { projectFor, projectForDir } from "./project.js";
6
+ const CLIENT_ERROR = `${Codes.TsiInClientBundle}: .tsi modules are server-only in Nola v0 — this file is being bundled ` +
7
+ `for a browser target. Move the import behind a server boundary (SSR entry, route handler, server action).`;
8
+ export const unpluginFactory = (rawOptions) => {
9
+ const options = rawOptions ?? {};
10
+ // webpack/rspack: the compiler target is known at apply time; transform reads it.
11
+ let clientBuild = false;
12
+ let declTimer;
13
+ const declRoots = new Set();
14
+ // Adjacent d.tsi.ts so plain tsc / framework type checks resolve .tsi
15
+ // imports (allowArbitraryExtensions). nola-lang is imported lazily — it
16
+ // drags the TypeScript compiler API, which plugin import must not.
17
+ const emitDeclarationsFor = async (root) => {
18
+ const ctx = await projectForDir(root, options);
19
+ if (!ctx.declarations)
20
+ return;
21
+ const { emitAdjacentDeclarations } = await import("nola-lang");
22
+ const { errors } = await emitAdjacentDeclarations(ctx.sourceRoot);
23
+ for (const e of errors)
24
+ console.error(e);
25
+ };
26
+ const doTransform = async (source, id) => {
27
+ const ctx = await projectFor(id, options);
28
+ // Declarations are scoped to the project root of a .tsi ACTUALLY being
29
+ // bundled — never process.cwd(): a bundler API call can run from any
30
+ // directory (a monorepo root), and walking it would spray d.tsi.ts far
31
+ // outside the app. Once per root per build.
32
+ if (ctx.declarations && !declRoots.has(ctx.sourceRoot)) {
33
+ declRoots.add(ctx.sourceRoot);
34
+ await emitDeclarationsFor(ctx.sourceRoot);
35
+ }
36
+ return transformTsi(source, id, ctx);
37
+ };
38
+ return {
39
+ name: "nola",
40
+ enforce: "pre",
41
+ transformInclude: (id) => id.endsWith(".tsi"),
42
+ async buildStart() {
43
+ // Only an EXPLICIT root emits ahead of any transform — the safe default
44
+ // waits for the first .tsi to reveal the real project root.
45
+ if (options.root !== undefined)
46
+ await emitDeclarationsFor(options.root);
47
+ },
48
+ watchChange(id) {
49
+ if (!id.endsWith(".tsi"))
50
+ return;
51
+ clearTimeout(declTimer);
52
+ declTimer = setTimeout(() => {
53
+ for (const root of declRoots)
54
+ void emitDeclarationsFor(root);
55
+ if (options.root !== undefined)
56
+ void emitDeclarationsFor(options.root);
57
+ }, 150);
58
+ },
59
+ async transform(source, id) {
60
+ if (clientBuild)
61
+ this.error(CLIENT_ERROR);
62
+ const { code, map } = await doTransform(source, id);
63
+ return { code, map: JSON.parse(map) };
64
+ },
65
+ resolveId(id, importer) {
66
+ guardConfigGraphTsi(id, importer);
67
+ if (id.startsWith(WIRING_ID))
68
+ return `\0${id}`;
69
+ if (importer === undefined)
70
+ return null;
71
+ // A companion importing a companion arrives with the prefixed id as importer.
72
+ const importerFile = importer.startsWith(COMPANION_PREFIX) ? importer.slice(COMPANION_PREFIX.length) : importer;
73
+ return resolveCompanionId(id, importerFile);
74
+ },
75
+ async load(id) {
76
+ if (id.startsWith(RESOLVED_WIRING_ID)) {
77
+ const configPath = configPathFromWiringId(id);
78
+ this.addWatchFile(configPath);
79
+ return wiringSource(configPath);
80
+ }
81
+ if (id.startsWith(COMPANION_PREFIX)) {
82
+ const file = id.slice(COMPANION_PREFIX.length);
83
+ const ctx = await projectFor(file, options);
84
+ const { code, watchFile } = await loadCompanionCode(id, ctx.sourceRoot);
85
+ this.addWatchFile(watchFile);
86
+ return code;
87
+ }
88
+ return null;
89
+ },
90
+ vite: {
91
+ transform: {
92
+ // Vite hands the ssr flag per transform — the one reliable client/server signal.
93
+ async handler(source, id, viteOpts) {
94
+ if (!id.endsWith(".tsi"))
95
+ return null;
96
+ if (viteOpts?.ssr !== true)
97
+ this.error(CLIENT_ERROR);
98
+ // Rollup's SourceMapInput accepts the raw JSON string.
99
+ return doTransform(source, id);
100
+ },
101
+ },
102
+ },
103
+ webpack(compiler) {
104
+ clientBuild = isBrowserTarget(compiler.options.target);
105
+ },
106
+ rspack(compiler) {
107
+ clientBuild = isBrowserTarget(compiler.options.target);
108
+ },
109
+ };
110
+ };
111
+ function isBrowserTarget(target) {
112
+ const list = Array.isArray(target) ? target : typeof target === "string" ? [target] : [];
113
+ return list.some((t) => typeof t === "string" && (t === "web" || t === "webworker" || t.startsWith("browserslist")));
114
+ }
115
+ export const NolaPlugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
116
+ export default NolaPlugin;
117
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,cAAc,EAAsE,MAAM,UAAU,CAAC;AAC9G,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC/G,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9G,OAAO,EAA0B,UAAU,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAIjF,MAAM,YAAY,GAChB,GAAG,KAAK,CAAC,iB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;oBACtC,IAAI,QAAQ,EAAE,GAAG,KAAK,IAAI;wBAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;oBACrD,uDAAuD;oBACvD,OAAO,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBACjC,CAAC;aACF;SACF;QAED,OAAO,CAAC,QAAQ;YACd,WAAW,GAAG,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzD,CAAC;QACD,MAAM,CAAC,QAAQ;YACb,WAAW,GAAG,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACzD,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,SAAS,eAAe,CAAC,MAAe;IACtC,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACzF,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,WAAW,IAAI,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AACvH,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAoD,eAAe,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC;AAC3H,eAAe,UAAU,CAAC"}
@@ -0,0 +1,22 @@
1
+ export interface NolaPluginOptions {
2
+ /** default: build.target from nola.config.ts ("app" when absent) */
3
+ target?: "app" | "lib";
4
+ /** config path override, or false to disable auto-wiring */
5
+ config?: string | false;
6
+ /** emit d.tsi.ts declarations at buildStart; default: target === "app" */
7
+ declarations?: boolean;
8
+ /** project directory for buildStart-time work (declarations); default process.cwd() */
9
+ root?: string;
10
+ }
11
+ export interface ProjectContext {
12
+ sourceRoot: string;
13
+ underivableContextType: "error" | "prune" | "omit";
14
+ target: "app" | "lib";
15
+ configPath: string | null;
16
+ declarations: boolean;
17
+ }
18
+ export declare function projectFor(file: string, options: NolaPluginOptions): Promise<ProjectContext>;
19
+ export declare function projectForDir(dir: string, options: NolaPluginOptions): Promise<ProjectContext>;
20
+ /** Test seam + watch-mode invalidation: drop memoized contexts. */
21
+ export declare function resetProjects(): void;
22
+ //# sourceMappingURL=project.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,oEAAoE;IACpE,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACvB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACxB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uFAAuF;IACvF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;IACnD,MAAM,EAAE,KAAK,GAAG,KAAK,CAAC;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,OAAO,CAAC;CACvB;AAMD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAE5F;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAS9F;AAgBD,mEAAmE;AACnE,wBAAgB,aAAa,IAAI,IAAI,CAEpC"}
Binary file
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"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,CAAC;IAC1F,OAAO;QACL,UAAU,EAAE,IAAI;QAChB,sBAAsB,EAAE,QAAQ,CAAC,sBAAsB;QACvD,MAAM;QACN,UAAU;QACV,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,MAAM,KAAK,KAAK;KACvD,CAAC;AACJ,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,aAAa;IAC3B,QAAQ,CAAC,KAAK,EAAE,CAAC;AACnB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default: (options?: import("./project.js").NolaPluginOptions | undefined) => import("rolldown").Plugin<any> | import("rolldown").Plugin<any>[];
2
+ export default _default;
3
+ //# sourceMappingURL=rolldown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rolldown.d.ts","sourceRoot":"","sources":["../src/rolldown.ts"],"names":[],"mappings":";AAEA,wBAAmC"}
@@ -0,0 +1,3 @@
1
+ import { NolaPlugin } from "./index.js";
2
+ export default NolaPlugin.rolldown;
3
+ //# sourceMappingURL=rolldown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rolldown.js","sourceRoot":"","sources":["../src/rolldown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,eAAe,UAAU,CAAC,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default: (options?: import("./project.js").NolaPluginOptions | undefined) => import("rollup").Plugin<any> | import("rollup").Plugin<any>[];
2
+ export default _default;
3
+ //# sourceMappingURL=rollup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollup.d.ts","sourceRoot":"","sources":["../src/rollup.ts"],"names":[],"mappings":";AAEA,wBAAiC"}
package/dist/rollup.js ADDED
@@ -0,0 +1,3 @@
1
+ import { NolaPlugin } from "./index.js";
2
+ export default NolaPlugin.rollup;
3
+ //# sourceMappingURL=rollup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollup.js","sourceRoot":"","sources":["../src/rollup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,eAAe,UAAU,CAAC,MAAM,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default: (options?: import("./project.js").NolaPluginOptions | undefined) => import("unplugin").RspackPluginInstance;
2
+ export default _default;
3
+ //# sourceMappingURL=rspack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rspack.d.ts","sourceRoot":"","sources":["../src/rspack.ts"],"names":[],"mappings":";AAEA,wBAAiC"}
package/dist/rspack.js ADDED
@@ -0,0 +1,3 @@
1
+ import { NolaPlugin } from "./index.js";
2
+ export default NolaPlugin.rspack;
3
+ //# sourceMappingURL=rspack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rspack.js","sourceRoot":"","sources":["../src/rspack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,eAAe,UAAU,CAAC,MAAM,CAAC"}
package/dist/vite.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ declare const _default: (options?: import("./project.js").NolaPluginOptions | undefined) => import("vite").Plugin<any> | import("vite").Plugin<any>[];
2
+ export default _default;
3
+ //# sourceMappingURL=vite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":";AAEA,wBAA+B"}
package/dist/vite.js ADDED
@@ -0,0 +1,3 @@
1
+ import { NolaPlugin } from "./index.js";
2
+ export default NolaPlugin.vite;
3
+ //# sourceMappingURL=vite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.js","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,eAAe,UAAU,CAAC,IAAI,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const _default: (options?: import("./project.js").NolaPluginOptions | undefined) => import("webpack").WebpackPluginInstance;
2
+ export default _default;
3
+ //# sourceMappingURL=webpack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":";AAEA,wBAAkC"}
@@ -0,0 +1,3 @@
1
+ import { NolaPlugin } from "./index.js";
2
+ export default NolaPlugin.webpack;
3
+ //# sourceMappingURL=webpack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webpack.js","sourceRoot":"","sources":["../src/webpack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,eAAe,UAAU,CAAC,OAAO,CAAC"}
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@nola-lang/unplugin",
3
+ "version": "0.1.0-alpha.0",
4
+ "description": "Universal bundler plugin for Nola (.tsi): Vite, webpack, Rollup, esbuild, Rspack via unplugin",
5
+ "keywords": [
6
+ "nola",
7
+ "unplugin",
8
+ "vite",
9
+ "webpack",
10
+ "rollup",
11
+ "esbuild",
12
+ "rspack"
13
+ ],
14
+ "license": "Apache-2.0",
15
+ "author": "Evgen Mykhailenko",
16
+ "homepage": "https://github.com/nola-lang/nola#readme",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/nola-lang/nola.git",
20
+ "directory": "packages/unplugin"
21
+ },
22
+ "bugs": {
23
+ "url": "https://github.com/nola-lang/nola/issues"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "type": "module",
29
+ "exports": {
30
+ ".": {
31
+ "types": "./dist/index.d.ts",
32
+ "default": "./dist/index.js"
33
+ },
34
+ "./vite": {
35
+ "types": "./dist/vite.d.ts",
36
+ "default": "./dist/vite.js"
37
+ },
38
+ "./webpack": {
39
+ "types": "./dist/webpack.d.ts",
40
+ "default": "./dist/webpack.js"
41
+ },
42
+ "./rollup": {
43
+ "types": "./dist/rollup.d.ts",
44
+ "default": "./dist/rollup.js"
45
+ },
46
+ "./rolldown": {
47
+ "types": "./dist/rolldown.d.ts",
48
+ "default": "./dist/rolldown.js"
49
+ },
50
+ "./esbuild": {
51
+ "types": "./dist/esbuild.d.ts",
52
+ "default": "./dist/esbuild.js"
53
+ },
54
+ "./rspack": {
55
+ "types": "./dist/rspack.d.ts",
56
+ "default": "./dist/rspack.js"
57
+ }
58
+ },
59
+ "files": [
60
+ "dist",
61
+ "!dist/.tsbuildinfo"
62
+ ],
63
+ "dependencies": {
64
+ "@nola-lang/ast": "0.1.0-alpha.0",
65
+ "@nola-lang/compiler": "0.1.0-alpha.0",
66
+ "@nola-lang/node-loader": "0.1.0-alpha.0",
67
+ "nola-lang": "0.1.0-alpha.0",
68
+ "unplugin": "^2.1.0"
69
+ },
70
+ "engines": {
71
+ "node": ">=22"
72
+ }
73
+ }