@solidjs/start 2.0.0-beta.0 → 2.0.0-beta.10

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 (117) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/dist/config/boundary-modules.d.ts +14 -0
  3. package/dist/config/boundary-modules.js +41 -0
  4. package/dist/config/dev-server.d.ts +3 -1
  5. package/dist/config/dev-server.js +25 -5
  6. package/dist/config/env.js +16 -12
  7. package/dist/config/fs-router.d.ts +1 -1
  8. package/dist/config/fs-router.js +28 -21
  9. package/dist/config/fs-routes/router.d.ts +2 -1
  10. package/dist/config/fs-routes/router.js +8 -10
  11. package/dist/config/index.js +42 -7
  12. package/dist/directives/index.js +39 -7
  13. package/dist/fns/handler.js +40 -4
  14. package/dist/fns/registration.d.ts +2 -1
  15. package/dist/fns/registration.js +4 -1
  16. package/dist/http/http.d.ts +81 -0
  17. package/dist/http/http.js +129 -0
  18. package/dist/http/index.d.ts +2 -81
  19. package/dist/http/index.js +6 -129
  20. package/dist/middleware/index.d.ts +1 -0
  21. package/dist/middleware/index.js +1 -0
  22. package/dist/server/StartServer.jsx +1 -1
  23. package/dist/server/handler.d.ts +3 -61
  24. package/dist/server/handler.js +4 -8
  25. package/dist/server/spa/StartServer.jsx +1 -1
  26. package/dist/server/spa/handler.d.ts +2 -30
  27. package/dist/server/web-stream.d.ts +9 -0
  28. package/dist/server/web-stream.js +26 -0
  29. package/dist/shared/HttpHeader.jsx +1 -1
  30. package/env.d.ts +12 -0
  31. package/package.json +14 -8
  32. package/scripts/build.js +0 -15
  33. package/scripts/validate-imports.js +0 -316
  34. package/src/client/StartClient.tsx +0 -34
  35. package/src/client/index.tsx +0 -2
  36. package/src/client/mount.ts +0 -1
  37. package/src/client/spa/index.tsx +0 -9
  38. package/src/config/constants.ts +0 -19
  39. package/src/config/dev-server.ts +0 -157
  40. package/src/config/env.ts +0 -105
  41. package/src/config/fs-router.ts +0 -162
  42. package/src/config/fs-routes/fs-watcher.ts +0 -66
  43. package/src/config/fs-routes/index.ts +0 -136
  44. package/src/config/fs-routes/router.ts +0 -184
  45. package/src/config/fs-routes/tree-shake.ts +0 -324
  46. package/src/config/index.ts +0 -239
  47. package/src/config/lazy.ts +0 -132
  48. package/src/config/manifest.ts +0 -120
  49. package/src/config/utils.ts +0 -5
  50. package/src/config/vite-utils.ts +0 -113
  51. package/src/directives/bubble-function-declaration.ts +0 -33
  52. package/src/directives/compile.ts +0 -54
  53. package/src/directives/generate-unique-name.ts +0 -22
  54. package/src/directives/get-descriptive-name.ts +0 -39
  55. package/src/directives/get-import-identifier.ts +0 -34
  56. package/src/directives/get-root-statement-path.ts +0 -14
  57. package/src/directives/index.ts +0 -233
  58. package/src/directives/is-statement-top-level.ts +0 -13
  59. package/src/directives/paths.ts +0 -63
  60. package/src/directives/plugin.ts +0 -389
  61. package/src/directives/remove-unused-variables.ts +0 -70
  62. package/src/directives/types.ts +0 -12
  63. package/src/directives/xxhash32.ts +0 -214
  64. package/src/env.d.ts +0 -17
  65. package/src/fns/client.ts +0 -141
  66. package/src/fns/handler.spec.ts +0 -85
  67. package/src/fns/handler.ts +0 -287
  68. package/src/fns/registration.ts +0 -19
  69. package/src/fns/serialization.ts +0 -250
  70. package/src/fns/server.ts +0 -46
  71. package/src/fns/shared.ts +0 -116
  72. package/src/http/index.ts +0 -216
  73. package/src/index.tsx +0 -7
  74. package/src/internal.d.ts +0 -14
  75. package/src/middleware/index.ts +0 -92
  76. package/src/router.tsx +0 -37
  77. package/src/server/StartServer.tsx +0 -58
  78. package/src/server/assets/PatchVirtualDevStyles.tsx +0 -31
  79. package/src/server/assets/index.ts +0 -70
  80. package/src/server/assets/render.tsx +0 -46
  81. package/src/server/collect-styles.ts +0 -70
  82. package/src/server/fetchEvent.spec.ts +0 -85
  83. package/src/server/fetchEvent.ts +0 -36
  84. package/src/server/handler.ts +0 -261
  85. package/src/server/index.tsx +0 -29
  86. package/src/server/manifest/client-manifest.ts +0 -8
  87. package/src/server/manifest/dev-client-manifest.ts +0 -21
  88. package/src/server/manifest/dev-ssr-manifest.ts +0 -23
  89. package/src/server/manifest/prod-client-manifest.ts +0 -21
  90. package/src/server/manifest/prod-ssr-manifest.ts +0 -109
  91. package/src/server/manifest/ssr-manifest.ts +0 -10
  92. package/src/server/routes.ts +0 -126
  93. package/src/server/spa/StartServer.tsx +0 -42
  94. package/src/server/spa/handler.ts +0 -29
  95. package/src/server/spa/index.tsx +0 -5
  96. package/src/server/types.ts +0 -82
  97. package/src/server/util.ts +0 -12
  98. package/src/shared/ErrorBoundary.tsx +0 -52
  99. package/src/shared/GET.ts +0 -8
  100. package/src/shared/HttpHeader.tsx +0 -42
  101. package/src/shared/HttpStatusCode.ts +0 -27
  102. package/src/shared/clientOnly.ts +0 -44
  103. package/src/shared/dev-overlay/CodeView.tsx +0 -90
  104. package/src/shared/dev-overlay/DevOverlayDialog.tsx +0 -316
  105. package/src/shared/dev-overlay/createStackFrame.ts +0 -74
  106. package/src/shared/dev-overlay/download.ts +0 -6
  107. package/src/shared/dev-overlay/env.d.ts +0 -4
  108. package/src/shared/dev-overlay/get-source-map.ts +0 -33
  109. package/src/shared/dev-overlay/icons.tsx +0 -456
  110. package/src/shared/dev-overlay/index.tsx +0 -63
  111. package/src/shared/dev-overlay/styles.css +0 -292
  112. package/src/shared/lazy.ts +0 -52
  113. package/src/shared/serverFunction.ts +0 -10
  114. package/src/utils/debounce.ts +0 -10
  115. package/src/virtual.d.ts +0 -27
  116. package/tsconfig.json +0 -24
  117. package/vitest.config.ts +0 -9
@@ -8,6 +8,7 @@ import { getSsrManifest } from "./manifest/ssr-manifest.js";
8
8
  import { matchAPIRoute } from "./routes.js";
9
9
  import { handleServerFunction } from "../fns/handler.js";
10
10
  import { getExpectedRedirectStatus } from "./util.js";
11
+ import { toWebReadableStream } from "./web-stream.js";
11
12
  const SERVER_FN_BASE = "/_server";
12
13
  export function createBaseHandler(createPageEvent, fn, options = {}) {
13
14
  const handler = defineHandler({
@@ -93,14 +94,9 @@ export function createBaseHandler(createPageEvent, fn, options = {}) {
93
94
  if (mode === "async")
94
95
  return await stream;
95
96
  delete stream.then;
96
- // using TransformStream in dev can cause solid-start-dev-server to crash
97
- // when stream is cancelled
98
- if (globalThis.USING_SOLID_START_DEV_SERVER)
99
- return stream;
100
- // returning stream directly breaks cloudflare workers
101
- const { writable, readable } = new TransformStream();
102
- stream.pipeTo(writable);
103
- return readable;
97
+ // h3 expects a standard web ReadableStream across runtimes. The adapter
98
+ // also tolerates cancellation while Solid finishes outstanding work.
99
+ return toWebReadableStream(stream);
104
100
  }),
105
101
  });
106
102
  const app = new H3();
@@ -18,7 +18,7 @@ export function StartServer(props) {
18
18
  <TopErrorBoundary>
19
19
  <props.document scripts={<>
20
20
  <PatchVirtualDevStyles nonce={nonce}/>
21
- <script type="module" src={getSsrManifest("client").path(import.meta.env.START_CLIENT_ENTRY)}/>
21
+ <script type="module" src={getSsrManifest("client").path(import.meta.env.START_CLIENT_ENTRY_URL)}/>
22
22
  </>}/>
23
23
  </TopErrorBoundary>
24
24
  </NoHydration>);
@@ -1,36 +1,8 @@
1
+ import type { H3 } from "h3/generic";
1
2
  import type { JSX } from "solid-js";
2
3
  import type { HandlerOptions, PageEvent } from "../types.ts";
3
4
  /**
4
5
  *
5
6
  * Read more: https://docs.solidjs.com/solid-start/reference/server/create-handler
6
7
  */
7
- export declare function createHandler(fn: (context: PageEvent) => JSX.Element, options?: HandlerOptions | ((context: PageEvent) => HandlerOptions)): {
8
- "~rou3": import("h3").RouterContext;
9
- request(request: import("srvx").ServerRequest | URL | string, options?: RequestInit, context?: import("h3").H3EventContext): Response | Promise<Response>;
10
- use(route: string, handler: import("h3").Middleware, opts?: import("h3").MiddlewareOptions): /*elided*/ any;
11
- use(handler: import("h3").Middleware, opts?: import("h3").MiddlewareOptions): /*elided*/ any;
12
- on(method: import("h3").HTTPMethod | Lowercase<import("h3").HTTPMethod> | "", route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
13
- register(plugin: import("h3").H3Plugin): /*elided*/ any;
14
- mount(base: string, input: import("srvx").FetchHandler | {
15
- fetch: import("srvx").FetchHandler;
16
- } | /*elided*/ any): /*elided*/ any;
17
- all(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
18
- get(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
19
- post(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
20
- put(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
21
- delete(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
22
- patch(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
23
- head(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
24
- options(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
25
- connect(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
26
- trace(route: string, handler: import("h3").HTTPHandler, opts?: import("h3").RouteOptions): /*elided*/ any;
27
- readonly config: import("h3").H3Config;
28
- "~middleware": import("h3").Middleware[];
29
- "~routes": import("h3").H3Route[];
30
- fetch(_request: import("srvx").ServerRequest): Response | Promise<Response>;
31
- handler(event: import("h3").H3Event): unknown | Promise<unknown>;
32
- "~request"(request: import("srvx").ServerRequest, context?: import("h3").H3EventContext): Response | Promise<Response>;
33
- "~findRoute"(_event: import("h3").H3Event): import("h3").MatchedRoute<import("h3").H3Route> | void;
34
- "~getMiddleware"(event: import("h3").H3Event, route: import("h3").MatchedRoute<import("h3").H3Route> | undefined): import("h3").Middleware[];
35
- "~addRoute"(_route: import("h3").H3Route): void;
36
- };
8
+ export declare function createHandler(fn: (context: PageEvent) => JSX.Element, options?: HandlerOptions | ((context: PageEvent) => HandlerOptions)): H3;
@@ -0,0 +1,9 @@
1
+ type PipeableStream = {
2
+ pipe(writable: {
3
+ write(payload: string): void;
4
+ end(): void;
5
+ }): void;
6
+ };
7
+ /** Convert Solid's streaming SSR result into a cancellation-safe web stream. */
8
+ export declare function toWebReadableStream(stream: PipeableStream): ReadableStream<Uint8Array>;
9
+ export {};
@@ -0,0 +1,26 @@
1
+ /** Convert Solid's streaming SSR result into a cancellation-safe web stream. */
2
+ export function toWebReadableStream(stream) {
3
+ const encoder = new TextEncoder();
4
+ let active = true;
5
+ return new ReadableStream({
6
+ start(controller) {
7
+ stream.pipe({
8
+ write(payload) {
9
+ if (active)
10
+ controller.enqueue(encoder.encode(payload));
11
+ },
12
+ end() {
13
+ if (!active)
14
+ return;
15
+ active = false;
16
+ controller.close();
17
+ },
18
+ });
19
+ },
20
+ cancel() {
21
+ // Solid may still resolve Suspense resources after the response is
22
+ // cancelled. Ignore those writes and let Solid finish its cleanup.
23
+ active = false;
24
+ },
25
+ });
26
+ }
@@ -1,7 +1,7 @@
1
1
  // @refresh skip
2
2
  import { onCleanup } from "solid-js";
3
3
  import { getRequestEvent, isServer } from "solid-js/web";
4
- import { appendHeader, setHeader } from "../http/index.js";
4
+ import { appendHeader, setHeader } from "../http/http.js";
5
5
  /**
6
6
  *
7
7
  * Read more: https://docs.solidjs.com/solid-start/reference/server/http-header
package/env.d.ts CHANGED
@@ -7,3 +7,15 @@ declare namespace App {
7
7
  [key: string | symbol]: any;
8
8
  }
9
9
  }
10
+
11
+ /**
12
+ * Import `server-only` to ensure this module is never bundled for the client.
13
+ * Importing it in a client module will throw a build error.
14
+ */
15
+ declare module "server-only" {}
16
+
17
+ /**
18
+ * Import `client-only` to ensure this module is never bundled for the server.
19
+ * Importing it in a server module will throw a build error.
20
+ */
21
+ declare module "client-only" {}
package/package.json CHANGED
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "name": "@solidjs/start",
3
- "version": "2.0.0-beta.0",
3
+ "version": "2.0.0-beta.10",
4
4
  "type": "module",
5
+ "files": [
6
+ "dist",
7
+ "env.d.ts",
8
+ "CHANGELOG.md"
9
+ ],
5
10
  "repository": {
6
11
  "type": "git",
7
12
  "url": "git+https://github.com/solidjs/solid-start.git",
@@ -34,12 +39,11 @@
34
39
  "cookie-es": "^2.0.0",
35
40
  "defu": "^6.1.4",
36
41
  "error-stack-parser": "^2.1.4",
37
- "es-module-lexer": "^2.0.0",
38
- "esbuild": "^0.27.4",
39
42
  "fast-glob": "^3.3.3",
40
- "h3": "2.0.1-rc.16",
43
+ "h3": "^2.0.1-rc.25",
41
44
  "html-to-image": "^1.11.13",
42
45
  "micromatch": "^4.0.8",
46
+ "oxc-parser": "^0.139.0",
43
47
  "path-to-regexp": "^8.3.0",
44
48
  "pathe": "^2.0.3",
45
49
  "radix3": "^1.1.2",
@@ -48,27 +52,29 @@
48
52
  "shiki": "^1.29.2",
49
53
  "solid-js": "^1.9.11",
50
54
  "source-map-js": "^1.2.1",
51
- "srvx": "^0.11.9",
55
+ "srvx": "^0.11.22",
52
56
  "terracotta": "^1.1.0",
53
57
  "vite-plugin-solid": "^2.11.11"
54
58
  },
55
59
  "engines": {
56
- "node": ">=22"
60
+ "node": ">=24"
57
61
  },
58
62
  "devDependencies": {
59
63
  "@types/babel__core": "^7.20.5",
60
64
  "@types/node": "^25.5.0",
61
- "vite": "^7.3.1",
65
+ "vite": "^8.0.0",
62
66
  "vitest": "^4.1.0"
63
67
  },
64
68
  "peerDependencies": {
65
- "vite": "^7 || ^8"
69
+ "vite": "^8 || ^9"
66
70
  },
67
71
  "scripts": {
68
72
  "build": "pnpm validate-imports && tsc && node scripts/build.js",
69
73
  "dev": "tsc --watch",
70
74
  "test": "vitest",
71
75
  "test:ci": "vitest run",
76
+ "typecheck": "tsc --noEmit",
77
+ "typecheck:dist": "pnpm build && pnpx @arethetypeswrong/cli --pack . --profile esm-only",
72
78
  "validate-imports": "node scripts/validate-imports.js"
73
79
  }
74
80
  }
package/scripts/build.js DELETED
@@ -1,15 +0,0 @@
1
- import * as fs from "node:fs/promises";
2
- import * as path from "node:path";
3
- import glob from "fast-glob";
4
-
5
- const files = await glob("**/*.{js,css}", { cwd: `${process.cwd()}/src` });
6
-
7
- await Promise.all(
8
- files.map(file =>
9
- fs.cp(
10
- path.join(import.meta.dirname, "../src", file),
11
- path.join(import.meta.dirname, "../dist", file),
12
- { recursive: true },
13
- ),
14
- ),
15
- );
@@ -1,316 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Import Extension Validation Script for SolidStart
5
- *
6
- * This script validates that all relative imports in the src/ directory have
7
- * explicit file extensions, which is mandated by Node.js ESM (ES Modules).
8
- *
9
- * Node.js requires explicit file extensions for relative imports when using
10
- * ES modules to avoid ambiguity and improve performance. This script ensures
11
- * compliance with this requirement.
12
- *
13
- * Features:
14
- * - Scans all .ts and .tsx files in the src/ directory recursively
15
- * - Detects relative imports (starting with ./ or ../) without extensions
16
- * - Prevents .js/.jsx imports in TypeScript files (should use .ts/.tsx)
17
- * - Ignores commented code, CSS imports, and dynamic imports (handled by bundlers)
18
- * - Provides detailed error reporting with line numbers and suggestions
19
- * - Exits with appropriate status codes for CI/CD integration
20
- *
21
- * Usage:
22
- * npm run validate-imports
23
- *
24
- * Exit codes:
25
- * 0 - All relative imports have valid extensions
26
- * 1 - Found relative imports without extensions
27
- *
28
- * Valid extensions for TypeScript files: .ts, .tsx, .json
29
- * Invalid extensions for TypeScript files: .js, .jsx (use .ts/.tsx instead)
30
- *
31
- * @example
32
- * // ❌ Invalid - missing extension
33
- * import { config } from "./config/index";
34
- *
35
- * // ❌ Invalid - .js extension in TypeScript file
36
- * import { config } from "./config/index.js";
37
- *
38
- * // ✅ Valid - has .ts extension
39
- * import { config } from "./config/index.ts";
40
- *
41
- * // ✅ Valid - external package import (no extension needed)
42
- * import { something } from "external-package";
43
- */
44
-
45
- import { readFileSync, readdirSync, statSync } from "node:fs";
46
- import { join, dirname, extname } from "node:path";
47
- import { fileURLToPath } from "node:url";
48
-
49
- const __filename = fileURLToPath(import.meta.url);
50
- const __dirname = dirname(__filename);
51
-
52
- // Configuration
53
- const SRC_DIR = join(__dirname, "..", "src");
54
- const VALID_EXTENSIONS = [".ts", ".tsx", ".json"];
55
- const INVALID_EXTENSIONS = [".js", ".jsx"];
56
- const FILE_EXTENSIONS = [".ts", ".tsx"];
57
-
58
- /**
59
- * Recursively find all files with specified extensions
60
- */
61
- function findFiles(dir, extensions, files = []) {
62
- try {
63
- const entries = readdirSync(dir);
64
-
65
- for (const entry of entries) {
66
- const fullPath = join(dir, entry);
67
- const stat = statSync(fullPath);
68
-
69
- if (stat.isDirectory()) {
70
- findFiles(fullPath, extensions, files);
71
- } else if (extensions.includes(extname(entry))) {
72
- files.push(fullPath);
73
- }
74
- }
75
- } catch (error) {
76
- console.error(`Error reading directory ${dir}: ${error.message}`);
77
- }
78
-
79
- return files;
80
- }
81
-
82
- /**
83
- * Check if a path is a relative import (starts with . or ..)
84
- */
85
- function isRelativeImport(path) {
86
- return path.startsWith("./") || path.startsWith("../");
87
- }
88
-
89
- /**
90
- * Check if an import path has a valid file extension
91
- */
92
- function hasValidExtension(path) {
93
- return VALID_EXTENSIONS.some(ext => path.endsWith(ext));
94
- }
95
-
96
- /**
97
- * Check if an import path has an invalid extension for TypeScript files
98
- */
99
- function hasInvalidExtension(path) {
100
- return INVALID_EXTENSIONS.some(ext => path.endsWith(ext));
101
- }
102
-
103
- /**
104
- * Extract import/export statements from file content
105
- * Matches both import and export statements with from clauses
106
- */
107
- function extractImportExportStatements(content, filePath) {
108
- const statements = [];
109
- const lines = content.split("\n");
110
-
111
- // Regex patterns for different import/export statements
112
- const patterns = [
113
- // Standard imports: import { ... } from '...'
114
- /import\s+(?:(?:\{[^}]*\}|\*\s+as\s+\w+|\w+)\s+from\s+)?['"`]([^'"`]+)['"`]/g,
115
- // Export from: export { ... } from '...'
116
- /export\s+(?:\{[^}]*\}|\*)\s+from\s+['"`]([^'"`]+)['"`]/g,
117
- // Export default from: export { default } from '...'
118
- /export\s+\{\s*default\s*\}\s+from\s+['"`]([^'"`]+)['"`]/g,
119
- // Note: Dynamic imports are excluded as they're handled by bundlers
120
- ];
121
-
122
- lines.forEach((line, lineNumber) => {
123
- const trimmedLine = line.trim();
124
-
125
- // Skip commented lines, dynamic imports, and TypeScript type-only imports in d.ts files
126
- if (
127
- trimmedLine.startsWith("//") ||
128
- trimmedLine.startsWith("/*") ||
129
- trimmedLine.startsWith("*") ||
130
- (filePath.endsWith(".d.ts") && trimmedLine.includes("import(")) ||
131
- // Skip CSS imports as they're handled by bundlers
132
- /import\s+['"`][^'"`]*\.css['"`]/.test(trimmedLine) ||
133
- // Skip dynamic imports as they're handled by bundlers
134
- /import\s*\(\s*['"`]/.test(trimmedLine)
135
- ) {
136
- return;
137
- }
138
-
139
- patterns.forEach(pattern => {
140
- let match;
141
- // Reset regex lastIndex to avoid issues with global flag
142
- pattern.lastIndex = 0;
143
- while ((match = pattern.exec(line)) !== null) {
144
- const importPath = match[1];
145
- if (importPath) {
146
- statements.push({
147
- path: importPath,
148
- line: lineNumber + 1,
149
- fullLine: line.trim(),
150
- filePath,
151
- });
152
- }
153
- }
154
- });
155
- });
156
-
157
- return statements;
158
- }
159
-
160
- /**
161
- * Validate a single file for relative imports without extensions
162
- */
163
- function validateFile(filePath) {
164
- const errors = [];
165
-
166
- try {
167
- const content = readFileSync(filePath, "utf8");
168
- const statements = extractImportExportStatements(content, filePath);
169
-
170
- statements.forEach(statement => {
171
- if (isRelativeImport(statement.path)) {
172
- if (hasInvalidExtension(statement.path)) {
173
- errors.push({
174
- file: filePath,
175
- line: statement.line,
176
- importPath: statement.path,
177
- fullLine: statement.fullLine,
178
- type: "invalid-extension",
179
- });
180
- } else if (!hasValidExtension(statement.path)) {
181
- errors.push({
182
- file: filePath,
183
- line: statement.line,
184
- importPath: statement.path,
185
- fullLine: statement.fullLine,
186
- type: "missing-extension",
187
- });
188
- }
189
- }
190
- });
191
- } catch (error) {
192
- console.error(`Error reading file ${filePath}: ${error.message}`);
193
- }
194
-
195
- return errors;
196
- }
197
-
198
- /**
199
- * Main validation function
200
- */
201
- function validateImports() {
202
- console.log("🔍 Validating relative imports in src/ directory...\n");
203
-
204
- // Find all TypeScript/TSX files in src directory
205
- const files = findFiles(SRC_DIR, FILE_EXTENSIONS);
206
-
207
- if (files.length === 0) {
208
- console.log("⚠️ No TypeScript files found in src/ directory");
209
- process.exit(0);
210
- }
211
-
212
- console.log(`📁 Scanning ${files.length} files...\n`);
213
-
214
- let totalErrors = 0;
215
- const errorsByFile = new Map();
216
-
217
- // Validate each file
218
- files.forEach(file => {
219
- const errors = validateFile(file);
220
- if (errors.length > 0) {
221
- errorsByFile.set(file, errors);
222
- totalErrors += errors.length;
223
- }
224
- });
225
-
226
- // Report results
227
- if (totalErrors === 0) {
228
- console.log("✅ All relative imports have valid extensions!");
229
- process.exit(0);
230
- } else {
231
- const missingExtensionErrors = [];
232
- const invalidExtensionErrors = [];
233
-
234
- errorsByFile.forEach(errors => {
235
- errors.forEach(error => {
236
- if (error.type === "missing-extension") {
237
- missingExtensionErrors.push(error);
238
- } else if (error.type === "invalid-extension") {
239
- invalidExtensionErrors.push(error);
240
- }
241
- });
242
- });
243
-
244
- if (missingExtensionErrors.length > 0) {
245
- console.log(
246
- `❌ Found ${missingExtensionErrors.length} relative import(s) without extensions:\n`,
247
- );
248
-
249
- const missingByFile = new Map();
250
- missingExtensionErrors.forEach(error => {
251
- if (!missingByFile.has(error.file)) {
252
- missingByFile.set(error.file, []);
253
- }
254
- missingByFile.get(error.file).push(error);
255
- });
256
-
257
- missingByFile.forEach((errors, file) => {
258
- const relativePath = file.replace(process.cwd(), "").replace(/^\//, "");
259
- console.log(`📄 ${relativePath}:`);
260
-
261
- errors.forEach(error => {
262
- console.log(` Line ${error.line}: ${error.importPath}`);
263
- console.log(` ${error.fullLine}`);
264
- console.log(
265
- ` ${"".padStart(error.fullLine.indexOf(error.importPath), " ")}${"".padStart(error.importPath.length, "^")}`,
266
- );
267
- });
268
- console.log("");
269
- });
270
- }
271
-
272
- if (invalidExtensionErrors.length > 0) {
273
- console.log(
274
- `❌ Found ${invalidExtensionErrors.length} relative import(s) with invalid extensions:\n`,
275
- );
276
-
277
- const invalidByFile = new Map();
278
- invalidExtensionErrors.forEach(error => {
279
- if (!invalidByFile.has(error.file)) {
280
- invalidByFile.set(error.file, []);
281
- }
282
- invalidByFile.get(error.file).push(error);
283
- });
284
-
285
- invalidByFile.forEach((errors, file) => {
286
- const relativePath = file.replace(process.cwd(), "").replace(/^\//, "");
287
- console.log(`📄 ${relativePath}:`);
288
-
289
- errors.forEach(error => {
290
- console.log(` Line ${error.line}: ${error.importPath}`);
291
- console.log(` ${error.fullLine}`);
292
- console.log(
293
- ` ${"".padStart(error.fullLine.indexOf(error.importPath), " ")}${"".padStart(error.importPath.length, "^")}`,
294
- );
295
- });
296
- console.log("");
297
- });
298
- }
299
-
300
- console.log("💡 Tips:");
301
- if (missingExtensionErrors.length > 0) {
302
- console.log(' - Add file extensions to relative imports (e.g., "./file" → "./file.ts")');
303
- }
304
- if (invalidExtensionErrors.length > 0) {
305
- console.log(" - Replace .js/.jsx with .ts/.tsx in TypeScript files");
306
- }
307
- console.log(" - This is required by Node.js ESM modules");
308
- console.log(" - Valid extensions for TypeScript files: " + VALID_EXTENSIONS.join(", "));
309
- console.log(" - Invalid extensions for TypeScript files: " + INVALID_EXTENSIONS.join(", "));
310
-
311
- process.exit(1);
312
- }
313
- }
314
-
315
- // Run the validation
316
- validateImports();
@@ -1,34 +0,0 @@
1
- // @refresh skip
2
- import App from "solid-start:app";
3
- import type { JSX } from "solid-js";
4
- import { ErrorBoundary } from "../shared/ErrorBoundary.tsx";
5
-
6
- function Dummy(props: { children: JSX.Element }) {
7
- return props.children;
8
- }
9
-
10
- /**
11
- *
12
- * Read more: https://docs.solidjs.com/solid-start/reference/client/start-client
13
- */
14
- export function StartClient() {
15
- return (
16
- <Dummy>
17
- <Dummy>
18
- <ErrorBoundary>
19
- <App />
20
- </ErrorBoundary>
21
- </Dummy>
22
- </Dummy>
23
- );
24
- }
25
-
26
- export function StartClientTanstack() {
27
- return (
28
- <Dummy>
29
- <ErrorBoundary>
30
- <App />
31
- </ErrorBoundary>
32
- </Dummy>
33
- );
34
- }
@@ -1,2 +0,0 @@
1
- export { mount } from "./mount.ts";
2
- export { StartClient, StartClientTanstack } from "./StartClient.tsx";
@@ -1 +0,0 @@
1
- export { hydrate as mount } from "solid-js/web"
@@ -1,9 +0,0 @@
1
- // @refresh skip
2
- import type { JSX } from "solid-js";
3
- import { render, type MountableElement } from "solid-js/web";
4
-
5
- export function mount(fn: () => JSX.Element, el: MountableElement) {
6
- render(fn, el);
7
- }
8
-
9
- export { StartClient } from "../StartClient.tsx";
@@ -1,19 +0,0 @@
1
- export const DEFAULT_EXTENSIONS = ["js", "jsx", "ts", "tsx"];
2
-
3
- export const CLIENT_BASE_PATH = "_build";
4
-
5
- export const VIRTUAL_MODULES = {
6
- clientViteManifest: "solid-start:client-vite-manifest",
7
- getClientManifest: "solid-start:get-client-manifest",
8
- getManifest: "solid-start:get-manifest",
9
- middleware: "solid-start:middleware",
10
- serverFnManifest: "solid-start:server-fn-manifest",
11
- clientEntry: "solid-start:client-entry",
12
- serverEntry: "solid-start:server-entry",
13
- app: "solid-start:app",
14
- } as const;
15
-
16
- export const VITE_ENVIRONMENTS = {
17
- client: "client" as const,
18
- server: "ssr" as const,
19
- };