create-fluixi 0.1.0-alpha.13 → 0.1.0-alpha.15

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Fluixi
3
+ Copyright (c) 2026 Ibrahima Touré
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/dist/index.js CHANGED
@@ -1,5 +1,47 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // ../compiler/dist/analyze/intrinsics.mjs
4
+ var REACTIVE_MODULE = "@fluixi/reactive/signal";
5
+ var INTRINSICS = {
6
+ $signal: { export: "signal", module: REACTIVE_MODULE, returns: "signal-handle" },
7
+ $memo: { export: "memo", module: REACTIVE_MODULE, returns: "memo-handle" },
8
+ $effect: { export: "effect", module: REACTIVE_MODULE, returns: "effect" },
9
+ $store: { export: "store", module: "@fluixi/reactive/store", returns: "store-handle" },
10
+ $resource: { export: "resource", module: REACTIVE_MODULE, returns: "resource-handle" },
11
+ $cachedResource: { export: "cachedResource", module: "@fluixi/reactive/cached-resource", returns: "resource-handle" },
12
+ // No short runtime form for these yet, so the intrinsic stands for the `create*`
13
+ // name. Still worth having: no import to write, and when a shorter form is
14
+ // designed, the change is this line rather than a compiler pass.
15
+ $selector: { export: "createSelector", module: REACTIVE_MODULE, returns: "memo-accessor" },
16
+ $deferred: { export: "createDeferred", module: REACTIVE_MODULE, returns: "memo-accessor" },
17
+ // Not value constructors, but the compiler has to know them: they change what a read
18
+ // does. `untrack` suppresses dependency collection, which is exactly the kind of thing
19
+ // dependency analysis must not guess at.
20
+ $untrack: { export: "untrack", module: REACTIVE_MODULE, returns: "plain" },
21
+ $untrackStore: { export: "untrackStore", module: "@fluixi/reactive/store", returns: "plain" },
22
+ // Scopes, scheduling and lifecycle: no value to classify, but the same authoring promise,
23
+ // no import to write. `$cleanup` registers a callback on the current owner (`onCleanup`).
24
+ $batch: { export: "batch", module: REACTIVE_MODULE, returns: "plain" },
25
+ $cleanup: { export: "onCleanup", module: REACTIVE_MODULE, returns: "plain" },
26
+ $root: { export: "root", module: REACTIVE_MODULE, returns: "plain" },
27
+ $context: { export: "context", module: REACTIVE_MODULE, returns: "plain" },
28
+ $renderEffect: { export: "renderEffect", module: REACTIVE_MODULE, returns: "effect" },
29
+ $computed: { export: "computed", module: REACTIVE_MODULE, returns: "effect" },
30
+ // Storage for where the code runs, and a signal kept in it. `$persisted` is a signal
31
+ // handle as far as reads go: the same accessor with `set` on it.
32
+ $storage: { export: "useStorage", module: "@fluixi/core/storage", returns: "plain" },
33
+ $asyncStorage: { export: "useAsyncStorage", module: "@fluixi/core/storage", returns: "plain" },
34
+ $persisted: { export: "persisted", module: "@fluixi/core/storage", returns: "signal-handle" },
35
+ // An environment variable, public or server-only; the browser build refuses a secret.
36
+ $env: { export: "env", module: "@fluixi/start/env", returns: "plain" }
37
+ };
38
+ var TAG_INTRINSICS = {
39
+ $html: { export: "html", module: "@fluixi/core" },
40
+ $svg: { export: "svg", module: "@fluixi/core" },
41
+ $css: { export: "css", module: "@fluixi/core" }
42
+ };
43
+ var INTRINSIC_CALL = new RegExp(`\\$(?:${Object.keys(INTRINSICS).map((n) => n.slice(1)).join("|")})\\s*\\(`);
44
+
3
45
  // src/index.ts
4
46
  import { cpSync, renameSync, readFileSync as readFileSync3, writeFileSync as writeFileSync3, existsSync as existsSync3 } from "node:fs";
5
47
  import { resolve, basename, join as join2 } from "node:path";
@@ -577,31 +619,44 @@ var UI_DEPS = {
577
619
  "@fluixi-ui/tokens": "alpha"
578
620
  };
579
621
  var UI_DEV_DEPS = { "@fluixi-ui/resolver": "alpha" };
580
- var INTRINSICS_DTS = `// GENERATED by @fluixi/compiler, do not edit.
581
- //
582
- // The reactive intrinsics, which the compiler lowers to their \`create*\` calls. They
583
- // need no import. This file is rewritten on the first \`fluixi dev\`, which adds the
584
- // components the resolver supplies without an import.
585
- import * as __fluixi_reactive_signal from '@fluixi/reactive/signal';
586
- import * as __fluixi_reactive_store from '@fluixi/reactive/store';
587
-
588
- declare global {
589
- const $signal: typeof __fluixi_reactive_signal.signal;
590
- const $memo: typeof __fluixi_reactive_signal.memo;
591
- const $effect: typeof __fluixi_reactive_signal.effect;
592
- const $store: typeof __fluixi_reactive_store.store;
593
- const $resource: typeof __fluixi_reactive_signal.resource;
594
- const $selector: typeof __fluixi_reactive_signal.createSelector;
595
- const $deferred: typeof __fluixi_reactive_signal.createDeferred;
596
- const $untrack: typeof __fluixi_reactive_signal.untrack;
597
- const $untrackStore: typeof __fluixi_reactive_store.untrackStore;
622
+ var INTRINSICS_DTS = intrinsicsDts();
623
+ function intrinsicsDts() {
624
+ const reactive = Object.entries({ ...INTRINSICS, ...TAG_INTRINSICS }).filter(([, i]) => /^@fluixi\/(reactive|core)(\/|$)/.test(i.module));
625
+ const alias = (module) => `__${module.slice(1).replace(/[/.-]/g, "_")}`;
626
+ const modules = [...new Set(reactive.map(([, i]) => i.module))].sort();
627
+ return [
628
+ "// GENERATED by @fluixi/compiler, do not edit.",
629
+ "//",
630
+ "// The reactive, storage and template intrinsics. They need no import. This file is rewritten on the first",
631
+ "// `fluixi dev`, which adds the components the resolver supplies without an import.",
632
+ ...modules.map((m) => `import * as ${alias(m)} from '${m}';`),
633
+ "",
634
+ "declare global {",
635
+ ...reactive.map(([name, i]) => ` const ${name}: typeof ${alias(i.module)}.${i.export};`),
636
+ "}",
637
+ ""
638
+ ].join("\n");
598
639
  }
599
- `;
600
640
  var LAYERS_CSS = `/* Cascade-layer order. Imported before any component CSS, because a layer ranks by
601
641
  where it is first declared and an undeclared one would rank last, above everything.
602
642
  Add this app's own layers only if you want them to rank BELOW the component styles. */
603
643
  @layer app-reset, flx.reset, flx.base, flx.tokens, flx.components, flx.skin;
604
644
  `;
645
+ var USAGE = `Usage: create-fluixi [dir] [options]
646
+
647
+ Scaffold a Fluixi app in dir. What is not given is asked for.
648
+
649
+ --ssr | --spa server-rendered with @fluixi/start, or client-only with vite
650
+ --jsx | --html template syntax
651
+ --ui | --no-ui @fluixi-ui components
652
+ --fluixi-css | --tailwind | --no-css
653
+ --auth=oauth2|better-auth SSR only; --no-auth for none
654
+ --provider=<name> with --auth=oauth2: ${PROVIDERS.join(", ")}
655
+ --tokens=browser|server with --auth=oauth2: where the tokens live
656
+ -h, --help this help
657
+ `;
658
+ var FLAGS = /* @__PURE__ */ new Set(["--ssr", "--spa", "--jsx", "--html", "--ui", "--no-ui", "--tailwind", "--fluixi-css", "--no-css", "--no-auth", "--help", "-h"]);
659
+ var VALUED = ["auth", "provider", "tokens"];
605
660
  var option = (args, name) => {
606
661
  const i = args.indexOf(`--${name}`);
607
662
  if (i !== -1 && args[i + 1] && !args[i + 1].startsWith("-")) return args[i + 1];
@@ -684,6 +739,10 @@ function importStyles(target, mode, ui, css) {
684
739
  }
685
740
  async function main() {
686
741
  const args = argv.slice(2);
742
+ if (args.includes("--help") || args.includes("-h")) {
743
+ output2.write(USAGE);
744
+ exit2(0);
745
+ }
687
746
  let dir = args.find((a) => !a.startsWith("-"));
688
747
  let mode = args.includes("--spa") ? "spa" : args.includes("--ssr") ? "ssr" : void 0;
689
748
  let format = args.includes("--html") ? "html" : args.includes("--jsx") ? "jsx" : void 0;
@@ -697,6 +756,8 @@ async function main() {
697
756
  `);
698
757
  exit2(1);
699
758
  };
759
+ const unknown = args.find((a) => a.startsWith("-") && !FLAGS.has(a) && !VALUED.some((n) => a === `--${n}` || a.startsWith(`--${n}=`)));
760
+ if (unknown) refuse(`unknown option ${unknown}: create-fluixi --help lists them`);
700
761
  if (auth && !["none", "oauth2", "better-auth"].includes(auth)) refuse(`--auth is oauth2, better-auth or none`);
701
762
  if (provider && !PROVIDERS.includes(provider)) refuse(`--provider is one of ${PROVIDERS.join(", ")}`);
702
763
  if (tokens && tokens !== "browser" && tokens !== "server") refuse(`--tokens is browser or server`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fluixi",
3
- "version": "0.1.0-alpha.13",
3
+ "version": "0.1.0-alpha.15",
4
4
  "license": "MIT",
5
5
  "author": "Ibrahima Touré",
6
6
  "description": "Scaffold a new Fluixi app — `npm create fluixi <dir>`.",
@@ -28,8 +28,9 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "esbuild": "^0.24.0",
31
- "vitest": "^1.6.1",
32
- "@fluixi/cli": "0.1.0-alpha.83"
31
+ "vitest": "^5.0.3",
32
+ "@fluixi/cli": "0.1.0-alpha.86",
33
+ "@fluixi/compiler": "1.0.0-alpha.95"
33
34
  },
34
35
  "nx": {
35
36
  "targets": {
@@ -2,3 +2,4 @@ node_modules
2
2
  dist
3
3
  *.log
4
4
  .DS_Store
5
+ .fluixi
@@ -17,7 +17,7 @@
17
17
  "devDependencies": {
18
18
  "@fluixi/ts-plugin": "alpha",
19
19
  "@fluixi/vite-plugin": "alpha",
20
- "typescript": "^5.9.0",
21
- "vite": "^5.0.0"
20
+ "typescript": "^7.0.2",
21
+ "vite": "^8.3.2"
22
22
  }
23
23
  }
@@ -2,3 +2,4 @@ node_modules
2
2
  dist
3
3
  *.log
4
4
  .DS_Store
5
+ .fluixi
@@ -16,7 +16,7 @@
16
16
  "devDependencies": {
17
17
  "@fluixi/ts-plugin": "alpha",
18
18
  "@fluixi/vite-plugin": "alpha",
19
- "typescript": "^5.9.0",
20
- "vite": "^5.0.0"
19
+ "typescript": "^7.0.2",
20
+ "vite": "^8.3.2"
21
21
  }
22
22
  }
@@ -2,3 +2,4 @@ node_modules
2
2
  dist
3
3
  *.log
4
4
  .DS_Store
5
+ .fluixi
@@ -20,7 +20,7 @@
20
20
  "devDependencies": {
21
21
  "@fluixi/ts-plugin": "alpha",
22
22
  "@types/node": "^20.0.0",
23
- "typescript": "^5.9.0",
24
- "vite": "^5.0.0"
23
+ "typescript": "^7.0.2",
24
+ "vite": "^8.3.2"
25
25
  }
26
26
  }
@@ -2,3 +2,4 @@ node_modules
2
2
  dist
3
3
  *.log
4
4
  .DS_Store
5
+ .fluixi
@@ -19,7 +19,7 @@
19
19
  "devDependencies": {
20
20
  "@fluixi/ts-plugin": "alpha",
21
21
  "@types/node": "^20.0.0",
22
- "typescript": "^5.9.0",
23
- "vite": "^5.0.0"
22
+ "typescript": "^7.0.2",
23
+ "vite": "^8.3.2"
24
24
  }
25
25
  }