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

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.js CHANGED
@@ -1,5 +1,42 @@
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 INTRINSIC_CALL = new RegExp(`\\$(?:${Object.keys(INTRINSICS).map((n) => n.slice(1)).join("|")})\\s*\\(`);
39
+
3
40
  // src/index.ts
4
41
  import { cpSync, renameSync, readFileSync as readFileSync3, writeFileSync as writeFileSync3, existsSync as existsSync3 } from "node:fs";
5
42
  import { resolve, basename, join as join2 } from "node:path";
@@ -577,26 +614,24 @@ var UI_DEPS = {
577
614
  "@fluixi-ui/tokens": "alpha"
578
615
  };
579
616
  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;
617
+ var INTRINSICS_DTS = intrinsicsDts();
618
+ function intrinsicsDts() {
619
+ const reactive = Object.entries(INTRINSICS).filter(([, i]) => /^@fluixi\/(reactive|core)\//.test(i.module));
620
+ const alias = (module) => `__${module.slice(1).replace(/[/.-]/g, "_")}`;
621
+ const modules = [...new Set(reactive.map(([, i]) => i.module))].sort();
622
+ return [
623
+ "// GENERATED by @fluixi/compiler, do not edit.",
624
+ "//",
625
+ "// The reactive and storage intrinsics. They need no import. This file is rewritten on the first",
626
+ "// `fluixi dev`, which adds the components the resolver supplies without an import.",
627
+ ...modules.map((m) => `import * as ${alias(m)} from '${m}';`),
628
+ "",
629
+ "declare global {",
630
+ ...reactive.map(([name, i]) => ` const ${name}: typeof ${alias(i.module)}.${i.export};`),
631
+ "}",
632
+ ""
633
+ ].join("\n");
598
634
  }
599
- `;
600
635
  var LAYERS_CSS = `/* Cascade-layer order. Imported before any component CSS, because a layer ranks by
601
636
  where it is first declared and an undeclared one would rank last, above everything.
602
637
  Add this app's own layers only if you want them to rank BELOW the component styles. */
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.14",
4
4
  "license": "MIT",
5
5
  "author": "Ibrahima Touré",
6
6
  "description": "Scaffold a new Fluixi app — `npm create fluixi <dir>`.",
@@ -29,7 +29,8 @@
29
29
  "devDependencies": {
30
30
  "esbuild": "^0.24.0",
31
31
  "vitest": "^1.6.1",
32
- "@fluixi/cli": "0.1.0-alpha.83"
32
+ "@fluixi/cli": "0.1.0-alpha.84",
33
+ "@fluixi/compiler": "1.0.0-alpha.93"
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
@@ -2,3 +2,4 @@ node_modules
2
2
  dist
3
3
  *.log
4
4
  .DS_Store
5
+ .fluixi
@@ -2,3 +2,4 @@ node_modules
2
2
  dist
3
3
  *.log
4
4
  .DS_Store
5
+ .fluixi
@@ -2,3 +2,4 @@ node_modules
2
2
  dist
3
3
  *.log
4
4
  .DS_Store
5
+ .fluixi