xanix 1.0.13 → 1.0.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.
@@ -15,7 +15,7 @@ const BuildServer = async ({ rootEntry, onBuildEnd }) => {
15
15
  fs.mkdirSync(outdirs.server, {
16
16
  recursive: true,
17
17
  });
18
- const entries = await generateClientEntries();
18
+ const entries = await generateClientEntries({ rootEntry });
19
19
  await createManifest(entries);
20
20
  const input = {
21
21
  index: path.resolve(root, rootEntry),
@@ -1,13 +1,10 @@
1
1
  import path from "node:path";
2
2
  import { rollup } from "rollup";
3
- import { nodeResolve } from "@rollup/plugin-node-resolve";
4
3
  import { build } from "esbuild";
5
4
  import { createRequire } from "node:module";
6
5
  import { getClientRuntimeFile } from "../include/utils.js";
7
- import esbuild from "rollup-plugin-esbuild";
8
- import url from "@rollup/plugin-url";
9
- import XanixDocument from "./plugins/XanixDocument/index.js";
10
6
  import outdirs from "../../outdirs.js";
7
+ import { xanixDefaultPlugins } from "./plugins/plugins.js";
11
8
  const require = createRequire(import.meta.url);
12
9
  const GenerateGraph = async (entries) => {
13
10
  const collector = new Map();
@@ -19,33 +16,10 @@ const GenerateGraph = async (entries) => {
19
16
  const bundle = await rollup({
20
17
  input,
21
18
  plugins: [
22
- nodeResolve({
23
- extensions: [".mjs", ".js", ".jsx", ".json", ".ts", ".tsx"],
24
- }),
25
- url({
26
- include: [
27
- "**/*.jpg",
28
- "**/*.jpeg",
29
- "**/*.png",
30
- "**/*.gif",
31
- "**/*.webp",
32
- "**/*.svg",
33
- "**/*.ico",
34
- "**/*.woff",
35
- "**/*.woff2",
36
- "**/*.ttf",
37
- "**/*.eot",
38
- "**/*.css",
39
- ],
40
- limit: 0,
41
- fileName: "assets/[name]-[hash][extname]",
42
- emitFiles: false,
43
- }),
44
- XanixDocument(),
45
- esbuild({
46
- target: "es2022",
47
- jsx: "automatic",
48
- tsconfig: false,
19
+ ...xanixDefaultPlugins({
20
+ target: "client",
21
+ development: true,
22
+ assetExternal: true,
49
23
  }),
50
24
  ],
51
25
  external(id) {
@@ -1,3 +1,5 @@
1
1
  import { type XanixClientEntry } from "../types.js";
2
- declare const generateClientEntries: () => Promise<XanixClientEntry[]>;
2
+ declare const generateClientEntries: ({ rootEntry, }: {
3
+ rootEntry: string;
4
+ }) => Promise<XanixClientEntry[]>;
3
5
  export default generateClientEntries;
@@ -1,46 +1,20 @@
1
1
  import { rollup } from "rollup";
2
2
  import path from "node:path";
3
3
  import { XanixEntryFinder } from "./plugins/XanixEntryFinder/index.js";
4
- import url from "@rollup/plugin-url";
5
- import esbuild from "rollup-plugin-esbuild";
6
- import XanixTsconfigAlias from "./plugins/XanixTsconfigAlias.js";
7
- import { nodeResolve } from "@rollup/plugin-node-resolve";
4
+ import { xanixDefaultPlugins } from "./plugins/plugins.js";
8
5
  const root = process.cwd();
9
- const generateClientEntries = async () => {
6
+ const generateClientEntries = async ({ rootEntry, }) => {
10
7
  const entries = new Map();
11
8
  const bundle = await rollup({
12
- input: path.resolve(root, "index.tsx"),
9
+ input: path.resolve(root, rootEntry),
13
10
  plugins: [
14
- XanixTsconfigAlias(),
15
- nodeResolve({
16
- extensions: [".mjs", ".js", ".jsx", ".json", ".ts", ".tsx"],
17
- }),
18
11
  XanixEntryFinder({
19
12
  entries,
20
13
  }),
21
- url({
22
- include: [
23
- "**/*.jpg",
24
- "**/*.jpeg",
25
- "**/*.png",
26
- "**/*.gif",
27
- "**/*.webp",
28
- "**/*.svg",
29
- "**/*.ico",
30
- "**/*.woff",
31
- "**/*.woff2",
32
- "**/*.ttf",
33
- "**/*.eot",
34
- "**/*.css",
35
- ],
36
- limit: 0,
37
- fileName: "assets/[name]-[hash][extname]",
38
- emitFiles: true,
39
- }),
40
- esbuild({
41
- target: "es2022",
42
- jsx: "automatic",
43
- tsconfig: false,
14
+ ...xanixDefaultPlugins({
15
+ target: "server",
16
+ development: true,
17
+ assetExternal: true,
44
18
  }),
45
19
  ],
46
20
  external(id) {
@@ -12,8 +12,7 @@ export default function xanixTsconfigAlias() {
12
12
  }
13
13
  const result = ts.readConfigFile(tsconfigPath, ts.sys.readFile);
14
14
  if (result.error) {
15
- const message = ts.flattenDiagnosticMessageText(result.error.messageText, "\n");
16
- throw new Error(`[xanix] Failed to read tsconfig.json:\n${message}`);
15
+ throw new Error(`[xanix] Failed to read tsconfig.json:\n${ts.flattenDiagnosticMessageText(result.error.messageText, "\n")}`);
17
16
  }
18
17
  const config = result.config;
19
18
  const compilerOptions = config.compilerOptions ?? {};
@@ -25,7 +24,6 @@ export default function xanixTsconfigAlias() {
25
24
  const replacement = replacements?.[0];
26
25
  if (!replacement)
27
26
  return null;
28
- // @components/*
29
27
  if (find.endsWith("/*")) {
30
28
  const findPrefix = find.slice(0, -2);
31
29
  const replacementPrefix = replacement.endsWith("/*")
@@ -33,17 +31,17 @@ export default function xanixTsconfigAlias() {
33
31
  : replacement;
34
32
  return {
35
33
  find: new RegExp(`^${escapeRegExp(findPrefix)}/(.+)$`),
36
- replacement: `${path.resolve(basePath, replacementPrefix)}/$1`,
34
+ replacement: path.resolve(basePath, replacementPrefix) + "/$1",
37
35
  };
38
36
  }
39
- // @foo
40
37
  return {
41
38
  find,
42
39
  replacement: path.resolve(basePath, replacement),
43
40
  };
44
41
  })
45
- .filter((entry) => entry !== null);
42
+ .filter(Boolean);
46
43
  return alias({
44
+ customResolver: undefined,
47
45
  entries,
48
46
  });
49
47
  }
@@ -27,6 +27,7 @@ export function xanixDefaultPlugins(options = {}) {
27
27
  }
28
28
  }
29
29
  return [
30
+ XanixTsconfigAlias(),
30
31
  {
31
32
  name: "watch",
32
33
  async watchChange(id, change) {
@@ -53,7 +54,6 @@ export function xanixDefaultPlugins(options = {}) {
53
54
  fileName: "assets/[name]-[hash][extname]",
54
55
  emitFiles: !(options?.assetExternal ?? false),
55
56
  }),
56
- XanixTsconfigAlias(),
57
57
  XanixEnvPlugin({
58
58
  mode: development ? "development" : "production",
59
59
  isClient,
@@ -16,7 +16,7 @@ const watchServer = async ({ rootEntry, onChange, onBuildEnd, onServerChange, on
16
16
  fs.mkdirSync(outdirs.server, {
17
17
  recursive: true,
18
18
  });
19
- const entries = await generateClientEntries();
19
+ const entries = await generateClientEntries({ rootEntry });
20
20
  await createManifest(entries);
21
21
  const input = {
22
22
  index: path.resolve(root, rootEntry),
@@ -62,7 +62,7 @@ const watchServer = async ({ rootEntry, onChange, onBuildEnd, onServerChange, on
62
62
  for (const entry of changedFiles) {
63
63
  const isClientEntry = Array.from(manifest.entries.values()).find((e) => e.file === entry);
64
64
  if (!isClientEntry) {
65
- const entries = await generateClientEntries();
65
+ const entries = await generateClientEntries({ rootEntry });
66
66
  const isEqual = await entriesEqual(entries);
67
67
  if (!isEqual) {
68
68
  await createManifest(entries);
@@ -0,0 +1,3 @@
1
+ declare const lightTheme: import("@xanui/core").ThemeOptions;
2
+ declare const darkTheme: import("@xanui/core").ThemeOptions;
3
+ export { lightTheme, darkTheme };
package/dist/theme.js ADDED
@@ -0,0 +1,10 @@
1
+ import { createTheme } from "@xanui/core";
2
+ const lightTheme = createTheme({
3
+ mode: "light",
4
+ name: "light",
5
+ });
6
+ const darkTheme = createTheme({
7
+ mode: "dark",
8
+ name: "dark",
9
+ });
10
+ export { lightTheme, darkTheme };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xanix",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",