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 +1 -1
- package/dist/index.js +80 -19
- package/package.json +4 -3
- package/template-spa/_gitignore +1 -0
- package/template-spa/package.json +2 -2
- package/template-spa-html/_gitignore +1 -0
- package/template-spa-html/package.json +2 -2
- package/template-ssr/_gitignore +1 -0
- package/template-ssr/package.json +2 -2
- package/template-ssr-html/_gitignore +1 -0
- package/template-ssr-html/package.json +2 -2
package/LICENSE
CHANGED
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 =
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
const $
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
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.
|
|
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": "^
|
|
32
|
-
"@fluixi/cli": "0.1.0-alpha.
|
|
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": {
|
package/template-spa/_gitignore
CHANGED
package/template-ssr/_gitignore
CHANGED