@weave-framework/cli 0.2.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,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aidas Josas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Published launcher: run the prebuilt CLI bundle. No runtime bundling, no cache
4
+ * dir, no monorepo-layout assumptions — works wherever @weave-framework/cli is installed.
5
+ */
6
+ import { main } from '../dist/cli.js';
7
+
8
+ await main(process.argv.slice(2));
package/bin/weave.mjs ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * DEV bin (monorepo): bundle the typed CLI source on the fly (esbuild inlines
4
+ * @weave-framework/compiler/@weave-framework/check; esbuild/typescript/sass stay external) and run it.
5
+ * Lets the CLI run from live `src/` with no build step during development.
6
+ *
7
+ * For the PUBLISHED package, package.json `publishConfig.bin` swaps this for
8
+ * bin/weave-dist.mjs (a thin launcher over the prebuilt dist/cli.js) — so end
9
+ * users get a fast, build-free launch with no monorepo-layout assumptions.
10
+ */
11
+ import { build as esbuild } from 'esbuild';
12
+ import { mkdirSync } from 'node:fs';
13
+ import { dirname, join, resolve } from 'node:path';
14
+ import { fileURLToPath, pathToFileURL } from 'node:url';
15
+
16
+ const here = dirname(fileURLToPath(import.meta.url));
17
+ const cacheDir = join(resolve(here, '../../..'), 'node_modules', '.weave');
18
+ mkdirSync(cacheDir, { recursive: true });
19
+ const out = join(cacheDir, 'cli.mjs');
20
+
21
+ await esbuild({
22
+ entryPoints: [join(here, '../src/cli.ts')],
23
+ bundle: true,
24
+ format: 'esm',
25
+ platform: 'node',
26
+ external: ['esbuild', 'typescript', 'sass'],
27
+ outfile: out,
28
+ });
29
+
30
+ const { main } = await import(pathToFileURL(out).href);
31
+ await main(process.argv.slice(2));
@@ -0,0 +1,23 @@
1
+ /** `weave build` — one-shot production bundle: JS via esbuild + one `app.css`. */
2
+ import { type StyleLang } from './styles.js';
3
+ export interface BuildConfig {
4
+ /** Hand-written entry module (absolute). Mutually exclusive with {@link virtualEntry}. */
5
+ entry?: string;
6
+ /** Framework-generated entry (Level C): the module source + the dir its imports resolve against. */
7
+ virtualEntry?: {
8
+ code: string;
9
+ resolveDir: string;
10
+ };
11
+ outDir: string;
12
+ minify?: boolean;
13
+ styleLang?: StyleLang;
14
+ /** Global entry stylesheets (absolute paths), compiled + prepended to `app.css` in order. */
15
+ styles?: string[];
16
+ /** Static web root copied verbatim into the output dir (favicons, manifest, …). */
17
+ publicDir?: string;
18
+ /** HTML shell to copy into the output dir, with `<script>`/`<link>` injected. */
19
+ index?: string;
20
+ /** Wipe the output dir before building so it is a clean, self-contained artifact (default false — config mode opts in). */
21
+ clean?: boolean;
22
+ }
23
+ export declare function build(config: BuildConfig): Promise<void>;
package/dist/cli.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ /** Weave CLI entry — `weave build` / `weave dev` / `weave check` / `weave routes`. */
2
+ export { defineConfig } from './config.js';
3
+ export type { WeaveConfig } from './config.js';
4
+ export declare function main(argv: string[]): Promise<void>;