xanix 1.0.15 → 1.0.16

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.
Files changed (86) hide show
  1. package/dist/bin/bundler/buildServer.js +4 -10
  2. package/dist/bin/bundler/cacheNpmModules.js +13 -24
  3. package/dist/bin/bundler/config/defines.d.ts +20 -0
  4. package/dist/bin/bundler/config/defines.js +21 -0
  5. package/dist/bin/bundler/config/external.d.ts +1 -0
  6. package/dist/bin/bundler/config/external.js +12 -0
  7. package/dist/bin/bundler/config/output.js +0 -1
  8. package/dist/bin/bundler/dep-generateClientEntries.d.ts +5 -0
  9. package/dist/bin/bundler/dep-generateClientEntries.js +25 -0
  10. package/dist/bin/bundler/generateClientEntries.js +4 -12
  11. package/dist/bin/bundler/plugins/XanixDocument/index.js +15 -5
  12. package/dist/bin/bundler/plugins/XanixEntryFinder/finder.js +4 -6
  13. package/dist/bin/bundler/plugins/XanixEntryFinder/index.js +12 -11
  14. package/dist/bin/bundler/plugins/XanixEnv.js +5 -14
  15. package/dist/bin/bundler/plugins/XanixPageTransform/index.js +28 -0
  16. package/dist/bin/bundler/plugins/XanixPageTransform/transformer.d.ts +8 -6
  17. package/dist/bin/bundler/plugins/XanixPageTransform/transformer.js +111 -198
  18. package/dist/bin/bundler/plugins/XanixReactRefresh.js +30 -30
  19. package/dist/bin/bundler/plugins/XanixTsconfigAlias.d.ts +17 -0
  20. package/dist/bin/bundler/plugins/XanixTsconfigAlias.js +176 -29
  21. package/dist/bin/bundler/plugins/XanixUseServer.d.ts +7 -0
  22. package/dist/bin/bundler/plugins/XanixUseServer.js +382 -0
  23. package/dist/bin/bundler/plugins/plugins.d.ts +5 -1
  24. package/dist/bin/bundler/plugins/plugins.js +114 -16
  25. package/dist/bin/bundler/watchClient.d.ts +3 -2
  26. package/dist/bin/bundler/watchClient.js +32 -5
  27. package/dist/bin/bundler/watchServer.d.ts +4 -4
  28. package/dist/bin/bundler/watchServer.js +27 -25
  29. package/dist/bin/cli/dev.js +64 -45
  30. package/dist/bin/include/entry.d.ts +0 -1
  31. package/dist/bin/include/entry.js +0 -7
  32. package/dist/bin/include/manifest.d.ts +2 -1
  33. package/dist/bin/include/manifest.js +26 -7
  34. package/dist/bin/include/utils.d.ts +1 -0
  35. package/dist/bin/include/utils.js +3 -0
  36. package/dist/bin/index.js +0 -0
  37. package/dist/bin/types.d.ts +0 -1
  38. package/dist/classes/XanixRedirect.d.ts +6 -0
  39. package/dist/classes/XanixRedirect.js +8 -0
  40. package/dist/client-runtime.d.ts +0 -1
  41. package/dist/client-runtime.js +17 -25
  42. package/dist/components/BaseDocument.d.ts +2 -2
  43. package/dist/components/DocumentContext.d.ts +5 -7
  44. package/dist/components/Head.js +6 -19
  45. package/dist/db/index.d.ts +2 -0
  46. package/dist/db/index.js +1 -0
  47. package/dist/db/test.d.ts +2 -0
  48. package/dist/db/test.js +1 -0
  49. package/dist/hooks/useCookies.d.ts +16 -1
  50. package/dist/hooks/useCookies.js +114 -6
  51. package/dist/hooks/useData.js +10 -11
  52. package/dist/hooks/useLocation.js +52 -13
  53. package/dist/hooks/useMetadata.d.ts +2 -0
  54. package/dist/hooks/useMetadata.js +6 -0
  55. package/dist/hooks/usePathname.js +4 -2
  56. package/dist/hooks/useRequest.js +1 -1
  57. package/dist/hooks/useResponse.d.ts +2 -0
  58. package/dist/hooks/useResponse.js +8 -0
  59. package/dist/hooks/useSearchParams.d.ts +40 -1
  60. package/dist/hooks/useSearchParams.js +154 -22
  61. package/dist/hooks/useServer/context.d.ts +7 -0
  62. package/dist/hooks/useServer/context.js +19 -0
  63. package/dist/hooks/useServer/core.d.ts +20 -0
  64. package/dist/hooks/useServer/core.js +72 -0
  65. package/dist/hooks/useServer/index.d.ts +20 -0
  66. package/dist/hooks/useServer/index.js +76 -0
  67. package/dist/hooks/useServer/registerUseServer.d.ts +3 -0
  68. package/dist/hooks/useServer/registerUseServer.js +5 -0
  69. package/dist/hooks/useServer/registry.d.ts +7 -0
  70. package/dist/hooks/useServer/registry.js +12 -0
  71. package/dist/hooks/useServer/state.d.ts +9 -0
  72. package/dist/hooks/useServer/state.js +33 -0
  73. package/dist/index.d.ts +15 -4
  74. package/dist/index.js +5 -6
  75. package/dist/navigate.d.ts +4 -1
  76. package/dist/navigate.js +10 -4
  77. package/dist/server/runtime/createServer.js +34 -22
  78. package/dist/server/runtime/xanixPage.d.ts +4 -2
  79. package/dist/server/runtime/xanixPage.js +47 -33
  80. package/dist/types/assets.d.ts +34 -34
  81. package/dist/types/express.d.ts +7 -12
  82. package/dist/types/globals.d.ts +26 -25
  83. package/dist/types/xanix-virtual.d.ts +41 -26
  84. package/package.json +72 -73
  85. package/dist/server/index.d.ts +0 -0
  86. package/dist/server/index.js +0 -1
@@ -2,10 +2,10 @@ import { rollup } from "rollup";
2
2
  import path from "node:path";
3
3
  import bundlerOutput from "./config/output.js";
4
4
  import fs from "node:fs";
5
- import { createManifest } from "../include/manifest.js";
6
- import generateClientEntries from "./generateClientEntries.js";
5
+ import external from "./config/external.js";
7
6
  import { xanixDefaultPlugins } from "./plugins/plugins.js";
8
7
  import outdirs from "../../outdirs.js";
8
+ import { getEntries } from "../include/manifest.js";
9
9
  const root = process.cwd();
10
10
  const BuildServer = async ({ rootEntry, onBuildEnd }) => {
11
11
  fs.rmSync(outdirs.server, {
@@ -15,8 +15,6 @@ const BuildServer = async ({ rootEntry, onBuildEnd }) => {
15
15
  fs.mkdirSync(outdirs.server, {
16
16
  recursive: true,
17
17
  });
18
- const entries = await generateClientEntries({ rootEntry });
19
- await createManifest(entries);
20
18
  const input = {
21
19
  index: path.resolve(root, rootEntry),
22
20
  };
@@ -38,17 +36,13 @@ const BuildServer = async ({ rootEntry, onBuildEnd }) => {
38
36
  }),
39
37
  ],
40
38
  external(id) {
41
- if (id.startsWith(".") ||
42
- path.isAbsolute(id) ||
43
- id === "@" ||
44
- id.startsWith("@/") ||
45
- id.startsWith("xanix") ||
46
- id === "virtual:xanix-document") {
39
+ if (!external(id)) {
47
40
  return false;
48
41
  }
49
42
  return true;
50
43
  },
51
44
  });
45
+ const entries = await getEntries();
52
46
  await build.write(bundlerOutput.server({ isDev: false }));
53
47
  await build.close();
54
48
  await onBuildEnd(entries);
@@ -4,7 +4,10 @@ import { build } from "esbuild";
4
4
  import { createRequire } from "node:module";
5
5
  import { getClientRuntimeFile } from "../include/utils.js";
6
6
  import outdirs from "../../outdirs.js";
7
- import { xanixDefaultPlugins } from "./plugins/plugins.js";
7
+ import { xanixCachePlugins } from "./plugins/plugins.js";
8
+ import defines from "./config/defines.js";
9
+ import { pathToFileURL } from "node:url";
10
+ import external from "./config/external.js";
8
11
  const require = createRequire(import.meta.url);
9
12
  const GenerateGraph = async (entries) => {
10
13
  const collector = new Map();
@@ -15,19 +18,9 @@ const GenerateGraph = async (entries) => {
15
18
  input.push(getClientRuntimeFile());
16
19
  const bundle = await rollup({
17
20
  input,
18
- plugins: [
19
- ...xanixDefaultPlugins({
20
- target: "client",
21
- development: true,
22
- assetExternal: true,
23
- }),
24
- ],
21
+ plugins: [...xanixCachePlugins()],
25
22
  external(id) {
26
- if (id.startsWith(".") ||
27
- path.isAbsolute(id) ||
28
- id === "@" ||
29
- id.startsWith("@/") ||
30
- id === "virtual:xanix-document") {
23
+ if (!external(id)) {
31
24
  return false;
32
25
  }
33
26
  collector.set(id, {
@@ -57,7 +50,7 @@ const makeCjsWrapperPlugin = (wrappers) => ({
57
50
  });
58
51
  },
59
52
  });
60
- const buildWrappers = (input) => {
53
+ const buildWrappers = async (input) => {
61
54
  const wrappers = new Map();
62
55
  const wrappedInput = {};
63
56
  for (const [name, resolved] of Object.entries(input)) {
@@ -65,7 +58,8 @@ const buildWrappers = (input) => {
65
58
  let namedExports = [];
66
59
  let hasDefault = false;
67
60
  try {
68
- const mod = require(resolved);
61
+ // Node: inspect the actual module
62
+ const mod = await import(pathToFileURL(resolved).href);
69
63
  hasDefault =
70
64
  mod &&
71
65
  (typeof mod === "object" || typeof mod === "function") &&
@@ -73,8 +67,9 @@ const buildWrappers = (input) => {
73
67
  namedExports = Object.keys(mod).filter((key) => key !== "__esModule" && key !== "default");
74
68
  }
75
69
  catch (err) {
76
- // console.log(err);
70
+ console.log(`Failed to inspect ${name}:`, err);
77
71
  }
72
+ // esbuild: use a normal filesystem path
78
73
  const lines = [`import * as __mod from ${JSON.stringify(resolved)};`];
79
74
  if (hasDefault) {
80
75
  lines.push(`export default __mod.default;`);
@@ -82,7 +77,6 @@ const buildWrappers = (input) => {
82
77
  else {
83
78
  lines.push(`export default __mod;`);
84
79
  }
85
- lines.push("");
86
80
  for (const exportName of namedExports) {
87
81
  if (/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(exportName)) {
88
82
  lines.push(`export const ${exportName} = __mod[${JSON.stringify(exportName)}];`);
@@ -97,7 +91,7 @@ const buildWrappers = (input) => {
97
91
  };
98
92
  };
99
93
  const bundleDeps = async (input, outdir) => {
100
- const { wrappers, wrappedInput } = buildWrappers(input);
94
+ const { wrappers, wrappedInput } = await buildWrappers(input);
101
95
  await build({
102
96
  entryPoints: wrappedInput,
103
97
  bundle: true,
@@ -109,12 +103,7 @@ const bundleDeps = async (input, outdir) => {
109
103
  chunkNames: "chunks/[hash]",
110
104
  platform: "browser",
111
105
  sourcemap: true,
112
- define: {
113
- __XANIX_CLIENT__: "true",
114
- __XANIX_SERVER__: "false",
115
- __XANIX_DEV__: "true",
116
- __XANIX_PROD__: "false",
117
- },
106
+ define: defines({ mode: "development", isClient: true }),
118
107
  plugins: [makeCjsWrapperPlugin(wrappers)],
119
108
  });
120
109
  };
@@ -0,0 +1,20 @@
1
+ declare const defines: ({ mode, isClient, }: {
2
+ mode: "development" | "production";
3
+ isClient: boolean;
4
+ }) => {
5
+ "process.env.NODE_ENV": string;
6
+ __XANIX_PAGE_NAVIGATION_HEADER_VALUE__: string;
7
+ __XANIX_CLIENT_RUNTIME_FILE_NAME__: string;
8
+ __XANIX_CLIENT__: string;
9
+ __XANIX_SERVER__: string;
10
+ __XANIX_DEV__: string;
11
+ __XANIX_PROD__: string;
12
+ XANIX_NAVIGATE: string;
13
+ XANIX_NAVIGATE_START: string;
14
+ XANIX_NAVIGATE_END: string;
15
+ XANIX_NAVIGATE_RELOAD: string;
16
+ XANIX_PRELOAD: string;
17
+ XANIX_PRELOAD_START: string;
18
+ XANIX_PRELOAD_END: string;
19
+ };
20
+ export default defines;
@@ -0,0 +1,21 @@
1
+ import { getClientRuntimeFileName, uid } from "../../include/utils.js";
2
+ const HEARDER_VALUE = uid(Math.random().toString(36), 32);
3
+ const defines = ({ mode, isClient, }) => {
4
+ return {
5
+ "process.env.NODE_ENV": JSON.stringify(mode),
6
+ __XANIX_PAGE_NAVIGATION_HEADER_VALUE__: JSON.stringify(HEARDER_VALUE),
7
+ __XANIX_CLIENT_RUNTIME_FILE_NAME__: JSON.stringify(getClientRuntimeFileName(mode)),
8
+ __XANIX_CLIENT__: isClient ? "true" : "false",
9
+ __XANIX_SERVER__: isClient ? "false" : "true",
10
+ __XANIX_DEV__: mode === "development" ? "true" : "false",
11
+ __XANIX_PROD__: mode === "production" ? "true" : "false",
12
+ XANIX_NAVIGATE: JSON.stringify("xanix:navigate"),
13
+ XANIX_NAVIGATE_START: JSON.stringify("xanix:navigate:start"),
14
+ XANIX_NAVIGATE_END: JSON.stringify("xanix:navigate:end"),
15
+ XANIX_NAVIGATE_RELOAD: JSON.stringify("xanix:navigate:reload"),
16
+ XANIX_PRELOAD: JSON.stringify("xanix:preload"),
17
+ XANIX_PRELOAD_START: JSON.stringify("xanix:preload:start"),
18
+ XANIX_PRELOAD_END: JSON.stringify("xanix:preload:end"),
19
+ };
20
+ };
21
+ export default defines;
@@ -0,0 +1 @@
1
+ export default function external(id: string): boolean;
@@ -0,0 +1,12 @@
1
+ import path from "node:path";
2
+ import { tsconfigPathsMatcher } from "../plugins/XanixTsconfigAlias.js";
3
+ export default function external(id) {
4
+ if (id.startsWith(".") ||
5
+ path.isAbsolute(id) ||
6
+ id.startsWith("xanix") ||
7
+ id === "virtual:xanix-document" ||
8
+ tsconfigPathsMatcher(id)) {
9
+ return false;
10
+ }
11
+ return true;
12
+ }
@@ -1,5 +1,4 @@
1
1
  import outdirs from "../../../outdirs.js";
2
- const root = process.cwd();
3
2
  const client = (entries, { isDev }) => {
4
3
  const _entries = {};
5
4
  for (const entry of entries) {
@@ -0,0 +1,5 @@
1
+ import { type XanixClientEntry } from "../types.js";
2
+ declare const generateClientEntries: ({ rootEntry, }: {
3
+ rootEntry: string;
4
+ }) => Promise<XanixClientEntry[]>;
5
+ export default generateClientEntries;
@@ -0,0 +1,25 @@
1
+ import { rollup } from "rollup";
2
+ import path from "node:path";
3
+ import { xanixGenerateClientEntryPlugins } from "./plugins/plugins.js";
4
+ import external from "./config/external.js";
5
+ const root = process.cwd();
6
+ const generateClientEntries = async ({ rootEntry, }) => {
7
+ const entries = new Map();
8
+ const bundle = await rollup({
9
+ input: path.resolve(root, rootEntry),
10
+ plugins: [
11
+ ...xanixGenerateClientEntryPlugins({
12
+ entries,
13
+ }),
14
+ ],
15
+ external(id) {
16
+ if (!external(id)) {
17
+ return false;
18
+ }
19
+ return true;
20
+ },
21
+ });
22
+ await bundle.close();
23
+ return Array.from(entries.values());
24
+ };
25
+ export default generateClientEntries;
@@ -1,27 +1,19 @@
1
1
  import { rollup } from "rollup";
2
2
  import path from "node:path";
3
- import { XanixEntryFinder } from "./plugins/XanixEntryFinder/index.js";
4
- import { xanixDefaultPlugins } from "./plugins/plugins.js";
3
+ import { xanixGenerateClientEntryPlugins, } from "./plugins/plugins.js";
4
+ import external from "./config/external.js";
5
5
  const root = process.cwd();
6
6
  const generateClientEntries = async ({ rootEntry, }) => {
7
7
  const entries = new Map();
8
8
  const bundle = await rollup({
9
9
  input: path.resolve(root, rootEntry),
10
10
  plugins: [
11
- XanixEntryFinder({
11
+ ...xanixGenerateClientEntryPlugins({
12
12
  entries,
13
13
  }),
14
- ...xanixDefaultPlugins({
15
- target: "server",
16
- development: true,
17
- assetExternal: true,
18
- }),
19
14
  ],
20
15
  external(id) {
21
- if (id.startsWith(".") ||
22
- path.isAbsolute(id) ||
23
- id === "@" ||
24
- id.startsWith("@/")) {
16
+ if (!external(id)) {
25
17
  return false;
26
18
  }
27
19
  return true;
@@ -23,11 +23,21 @@ export default function xanixDocument() {
23
23
  const document = fs.existsSync(userDocument)
24
24
  ? userDocument
25
25
  : baseDocument;
26
- return `
27
- import Document from ${JSON.stringify(document)};
28
-
29
- export default Document;
30
- `;
26
+ const source = fs.readFileSync(document, "utf8");
27
+ // Detect common metadata export forms.
28
+ const hasMetadata = /\bexport\s+(?:const|let|var|function|class)\s+metadata\b/.test(source) || /\bexport\s*\{\s*[^}]*\bmetadata\b[^}]*\}/.test(source);
29
+ if (hasMetadata) {
30
+ return `
31
+ import Document, * as DocumentModule from ${JSON.stringify(document)};
32
+ export const metadata = DocumentModule.metadata;
33
+ export default Document;
34
+ `;
35
+ }
36
+ return `
37
+ import Document from ${JSON.stringify(document)};
38
+ export const metadata = async () => ({});
39
+ export default Document;
40
+ `;
31
41
  },
32
42
  };
33
43
  }
@@ -5,10 +5,8 @@ import { parse } from "@babel/parser";
5
5
  import traverse from "@babel/traverse";
6
6
  import * as t from "@babel/types";
7
7
  import outdirs from "../../../../outdirs.js";
8
+ import { normalizePath } from "../../../include/utils.js";
8
9
  const SOURCE_EXTENSIONS = [".tsx", ".ts", ".jsx", ".js", ".mjs", ".cjs"];
9
- function normalizeFilePath(file) {
10
- return path.resolve(file).split(path.sep).join("/");
11
- }
12
10
  export function resolveFile(file) {
13
11
  const absolute = path.resolve(file);
14
12
  if (fs.existsSync(absolute)) {
@@ -136,18 +134,18 @@ export function entryFinder(code, id) {
136
134
  if (!path.isAbsolute(componentFile)) {
137
135
  return;
138
136
  }
139
- const normalizedFile = normalizeFilePath(componentFile);
137
+ const normalizedFile = normalizePath(componentFile);
140
138
  const clientId = createClientId(normalizedFile);
141
139
  const root = process.cwd();
142
140
  const relativeSource = path.relative(root, componentFile);
143
141
  const parsed = path.parse(relativeSource);
144
- const buildPath = normalizeFilePath(path.resolve(root, outdirs.root, parsed.dir, `${parsed.name}.js`));
142
+ const buildPath = normalizePath(path.resolve(root, outdirs.root, parsed.dir, `${parsed.name}.js`));
145
143
  const entry = {
146
144
  id: clientId,
147
145
  name: componentName,
148
146
  file: normalizedFile,
149
147
  path: componentImportPath,
150
- build: buildPath,
148
+ // build: buildPath,
151
149
  export: componentImport.export,
152
150
  };
153
151
  entries.set(clientId, entry);
@@ -21,16 +21,17 @@ export function XanixEntryFinder({ entries }) {
21
21
  }
22
22
  return null;
23
23
  },
24
- generateBundle() {
25
- const manifest = {
26
- version: 1,
27
- entries: [...entries.values()],
28
- };
29
- this.emitFile({
30
- type: "asset",
31
- fileName: "client-manifest.json",
32
- source: JSON.stringify(manifest, null, 2),
33
- });
34
- },
24
+ // generateBundle() {
25
+ // const manifest = {
26
+ // version: 1,
27
+ // entries: [...entries.values()],
28
+ // };
29
+ // console.log(manifest);
30
+ // this.emitFile({
31
+ // type: "asset",
32
+ // fileName: "client-manifest.json",
33
+ // source: JSON.stringify(manifest, null, 2),
34
+ // });
35
+ // },
35
36
  };
36
37
  }
@@ -2,7 +2,7 @@ import fs from "node:fs";
2
2
  import path from "node:path";
3
3
  import dotenv from "dotenv";
4
4
  import replace from "@rollup/plugin-replace";
5
- import { getClientRuntimeFileName } from "../../include/utils.js";
5
+ import defines from "../config/defines.js";
6
6
  export default function XanixEnvPlugin(options = {}) {
7
7
  const root = process.cwd();
8
8
  const mode = options.mode ?? "development";
@@ -31,20 +31,11 @@ export default function XanixEnvPlugin(options = {}) {
31
31
  }
32
32
  }
33
33
  const envs = {
34
- "process.env.NODE_ENV": JSON.stringify(mode),
35
34
  ...(isClient ? clientEnv : serverEnv),
36
- __XANIX_CLIENT_RUNTIME_FILE_NAME__: JSON.stringify(getClientRuntimeFileName(mode)),
37
- __XANIX_CLIENT__: JSON.stringify(isClient),
38
- __XANIX_SERVER__: JSON.stringify(!isClient),
39
- __XANIX_DEV__: JSON.stringify(mode === "development"),
40
- __XANIX_PROD__: JSON.stringify(mode === "production"),
41
- XANIX_NAVIGATE: JSON.stringify("xanix:navigate"),
42
- XANIX_NAVIGATE_START: JSON.stringify("xanix:navigate:start"),
43
- XANIX_NAVIGATE_END: JSON.stringify("xanix:navigate:end"),
44
- XANIX_NAVIGATE_RELOAD: JSON.stringify("xanix:navigate:reload"),
45
- XANIX_PRELOAD: JSON.stringify("xanix:preload"),
46
- XANIX_PRELOAD_START: JSON.stringify("xanix:preload:start"),
47
- XANIX_PRELOAD_END: JSON.stringify("xanix:preload:end"),
35
+ ...defines({
36
+ mode,
37
+ isClient,
38
+ }),
48
39
  };
49
40
  return replace({
50
41
  preventAssignment: true,
@@ -1,7 +1,15 @@
1
1
  import { transformer } from "./transformer.js";
2
2
  export default function XanixPageTransform() {
3
+ const entries = new Map();
4
+ let pending = false;
3
5
  return {
4
6
  name: "xanix-page-transform",
7
+ watchChange() {
8
+ entries.clear();
9
+ },
10
+ buildStart() {
11
+ entries.clear();
12
+ },
5
13
  async transform(code, id) {
6
14
  if (id.includes("node_modules") || !/\.(tsx?|jsx?)$/.test(id)) {
7
15
  return null;
@@ -10,10 +18,30 @@ export default function XanixPageTransform() {
10
18
  if (!result) {
11
19
  return null;
12
20
  }
21
+ for (const entry of result.entries) {
22
+ entries.set(entry.id, entry);
23
+ }
24
+ if (result.entries.length) {
25
+ pending = true;
26
+ }
13
27
  return {
14
28
  code: result.code,
15
29
  map: result.map,
16
30
  };
17
31
  },
32
+ async generateBundle() {
33
+ if (pending) {
34
+ const manifest = {
35
+ id: `id_`,
36
+ entries: [...entries.values()],
37
+ };
38
+ this.emitFile({
39
+ type: "asset",
40
+ fileName: "client-manifest.json",
41
+ source: JSON.stringify(manifest, null, 2),
42
+ });
43
+ pending = false;
44
+ }
45
+ },
18
46
  };
19
47
  }
@@ -1,16 +1,18 @@
1
1
  import * as t from "@babel/types";
2
+ export interface XanixPageEntry {
3
+ id: string;
4
+ name: string;
5
+ file: string;
6
+ path: string;
7
+ export: string;
8
+ }
2
9
  export interface XanixTransformResult {
3
10
  code: string;
4
11
  map: any;
12
+ entries: XanixPageEntry[];
5
13
  }
6
14
  export declare function resolveFile(file: string): string;
7
15
  export declare function resolveComponentFile(importer: string, importPath: string): string;
8
16
  export declare function createPageId(file: string): string;
9
17
  export declare function getJSXComponentName(node: t.JSXElement): string | null;
10
- export declare function findComponentImport(ast: t.File, componentName: string): {
11
- file: string;
12
- export: string;
13
- declaration: t.ImportDeclaration;
14
- specifier: t.ImportSpecifier | t.ImportDefaultSpecifier;
15
- } | null;
16
18
  export declare function transformer(code: string, id: string): XanixTransformResult | null;