@solidjs/start 2.0.0-beta.0 → 2.0.0-beta.2
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/CHANGELOG.md +14 -0
- package/dist/config/dev-server.js +3 -1
- package/dist/config/fs-router.d.ts +1 -1
- package/dist/http/index.d.ts +4 -4
- package/package.json +11 -5
- package/scripts/build.js +0 -15
- package/scripts/validate-imports.js +0 -316
- package/src/client/StartClient.tsx +0 -34
- package/src/client/index.tsx +0 -2
- package/src/client/mount.ts +0 -1
- package/src/client/spa/index.tsx +0 -9
- package/src/config/constants.ts +0 -19
- package/src/config/dev-server.ts +0 -157
- package/src/config/env.ts +0 -105
- package/src/config/fs-router.ts +0 -162
- package/src/config/fs-routes/fs-watcher.ts +0 -66
- package/src/config/fs-routes/index.ts +0 -136
- package/src/config/fs-routes/router.ts +0 -184
- package/src/config/fs-routes/tree-shake.ts +0 -324
- package/src/config/index.ts +0 -239
- package/src/config/lazy.ts +0 -132
- package/src/config/manifest.ts +0 -120
- package/src/config/utils.ts +0 -5
- package/src/config/vite-utils.ts +0 -113
- package/src/directives/bubble-function-declaration.ts +0 -33
- package/src/directives/compile.ts +0 -54
- package/src/directives/generate-unique-name.ts +0 -22
- package/src/directives/get-descriptive-name.ts +0 -39
- package/src/directives/get-import-identifier.ts +0 -34
- package/src/directives/get-root-statement-path.ts +0 -14
- package/src/directives/index.ts +0 -233
- package/src/directives/is-statement-top-level.ts +0 -13
- package/src/directives/paths.ts +0 -63
- package/src/directives/plugin.ts +0 -389
- package/src/directives/remove-unused-variables.ts +0 -70
- package/src/directives/types.ts +0 -12
- package/src/directives/xxhash32.ts +0 -214
- package/src/env.d.ts +0 -17
- package/src/fns/client.ts +0 -141
- package/src/fns/handler.spec.ts +0 -85
- package/src/fns/handler.ts +0 -287
- package/src/fns/registration.ts +0 -19
- package/src/fns/serialization.ts +0 -250
- package/src/fns/server.ts +0 -46
- package/src/fns/shared.ts +0 -116
- package/src/http/index.ts +0 -216
- package/src/index.tsx +0 -7
- package/src/internal.d.ts +0 -14
- package/src/middleware/index.ts +0 -92
- package/src/router.tsx +0 -37
- package/src/server/StartServer.tsx +0 -58
- package/src/server/assets/PatchVirtualDevStyles.tsx +0 -31
- package/src/server/assets/index.ts +0 -70
- package/src/server/assets/render.tsx +0 -46
- package/src/server/collect-styles.ts +0 -70
- package/src/server/fetchEvent.spec.ts +0 -85
- package/src/server/fetchEvent.ts +0 -36
- package/src/server/handler.ts +0 -261
- package/src/server/index.tsx +0 -29
- package/src/server/manifest/client-manifest.ts +0 -8
- package/src/server/manifest/dev-client-manifest.ts +0 -21
- package/src/server/manifest/dev-ssr-manifest.ts +0 -23
- package/src/server/manifest/prod-client-manifest.ts +0 -21
- package/src/server/manifest/prod-ssr-manifest.ts +0 -109
- package/src/server/manifest/ssr-manifest.ts +0 -10
- package/src/server/routes.ts +0 -126
- package/src/server/spa/StartServer.tsx +0 -42
- package/src/server/spa/handler.ts +0 -29
- package/src/server/spa/index.tsx +0 -5
- package/src/server/types.ts +0 -82
- package/src/server/util.ts +0 -12
- package/src/shared/ErrorBoundary.tsx +0 -52
- package/src/shared/GET.ts +0 -8
- package/src/shared/HttpHeader.tsx +0 -42
- package/src/shared/HttpStatusCode.ts +0 -27
- package/src/shared/clientOnly.ts +0 -44
- package/src/shared/dev-overlay/CodeView.tsx +0 -90
- package/src/shared/dev-overlay/DevOverlayDialog.tsx +0 -316
- package/src/shared/dev-overlay/createStackFrame.ts +0 -74
- package/src/shared/dev-overlay/download.ts +0 -6
- package/src/shared/dev-overlay/env.d.ts +0 -4
- package/src/shared/dev-overlay/get-source-map.ts +0 -33
- package/src/shared/dev-overlay/icons.tsx +0 -456
- package/src/shared/dev-overlay/index.tsx +0 -63
- package/src/shared/dev-overlay/styles.css +0 -292
- package/src/shared/lazy.ts +0 -52
- package/src/shared/serverFunction.ts +0 -10
- package/src/utils/debounce.ts +0 -10
- package/src/virtual.d.ts +0 -27
- package/tsconfig.json +0 -24
- package/vitest.config.ts +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @solidjs/start
|
|
2
2
|
|
|
3
|
+
## 2.0.0-beta.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3e961e0: Require Vite 8
|
|
8
|
+
- 11907a2: Fix published package missing `dist/`: pnpm 11 respects `.gitignore` when packing a package without a `files` field, so `2.0.0-beta.1` was published without its build output. Add an explicit `files` field.
|
|
9
|
+
|
|
10
|
+
## 2.0.0-beta.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- ee1193a: Update srvx to maintain response compatibility with Nitro v3.
|
|
15
|
+
- e263338: Fix `ERR_UNSUPPORTED_ESM_URL_SCHEME` when running `vite preview` on Windows
|
|
16
|
+
|
|
3
17
|
## 2.0.0-beta.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -6,6 +6,8 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
6
6
|
}
|
|
7
7
|
return path;
|
|
8
8
|
};
|
|
9
|
+
import { join } from "node:path";
|
|
10
|
+
import { pathToFileURL } from "node:url";
|
|
9
11
|
import { NodeRequest, sendNodeResponse } from "srvx/node";
|
|
10
12
|
import { isRunnableDevEnvironment, } from "vite";
|
|
11
13
|
import { VITE_ENVIRONMENTS } from "./constants.js";
|
|
@@ -18,7 +20,7 @@ export function devServer() {
|
|
|
18
20
|
server.middlewares.use(async (req, res) => {
|
|
19
21
|
res.setHeader("content-encoding", "identity");
|
|
20
22
|
const webReq = new NodeRequest({ req, res });
|
|
21
|
-
const def = await import(__rewriteRelativeImportExtension(process.cwd()
|
|
23
|
+
const def = await import(__rewriteRelativeImportExtension(pathToFileURL(join(process.cwd(), "dist/server/entry-server.js")).href, true));
|
|
22
24
|
sendNodeResponse(res, await def.default.fetch(webReq));
|
|
23
25
|
});
|
|
24
26
|
};
|
|
@@ -23,7 +23,6 @@ export declare class SolidStartServerFileRouter extends BaseFileSystemRouter {
|
|
|
23
23
|
});
|
|
24
24
|
toPath(src: string): string;
|
|
25
25
|
toRoute(src: string): {
|
|
26
|
-
path: string;
|
|
27
26
|
page: boolean;
|
|
28
27
|
$component: {
|
|
29
28
|
src: string;
|
|
@@ -33,5 +32,6 @@ export declare class SolidStartServerFileRouter extends BaseFileSystemRouter {
|
|
|
33
32
|
src: string;
|
|
34
33
|
pick: string[];
|
|
35
34
|
} | undefined;
|
|
35
|
+
path: string;
|
|
36
36
|
} | undefined;
|
|
37
37
|
}
|
package/dist/http/index.d.ts
CHANGED
|
@@ -63,10 +63,10 @@ export declare const handleCacheHeaders: WrapFunction<typeof h3.handleCacheHeade
|
|
|
63
63
|
export declare const handleCors: WrapFunction<typeof h3.handleCors>;
|
|
64
64
|
export declare const appendCorsHeaders: WrapFunction<typeof h3.appendCorsHeaders>;
|
|
65
65
|
export declare const appendCorsPreflightHeaders: WrapFunction<typeof h3.appendCorsPreflightHeaders>;
|
|
66
|
-
export declare const appendHeader:
|
|
67
|
-
export declare const appendHeaders:
|
|
68
|
-
export declare const setHeader:
|
|
69
|
-
export declare const setHeaders:
|
|
66
|
+
export declare const appendHeader: typeof appendResponseHeader;
|
|
67
|
+
export declare const appendHeaders: typeof appendResponseHeaders;
|
|
68
|
+
export declare const setHeader: typeof setResponseHeader;
|
|
69
|
+
export declare const setHeaders: typeof setResponseHeaders;
|
|
70
70
|
export declare const getHeader: WrapFunction<typeof h3.getRequestHeader>;
|
|
71
71
|
export declare const getHeaders: WrapFunction<typeof h3.getRequestHeaders>;
|
|
72
72
|
export declare const getRequestFingerprint: WrapFunction<typeof h3.getRequestFingerprint>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidjs/start",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.2",
|
|
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",
|
|
@@ -48,27 +53,28 @@
|
|
|
48
53
|
"shiki": "^1.29.2",
|
|
49
54
|
"solid-js": "^1.9.11",
|
|
50
55
|
"source-map-js": "^1.2.1",
|
|
51
|
-
"srvx": "^0.11.
|
|
56
|
+
"srvx": "^0.11.22",
|
|
52
57
|
"terracotta": "^1.1.0",
|
|
53
58
|
"vite-plugin-solid": "^2.11.11"
|
|
54
59
|
},
|
|
55
60
|
"engines": {
|
|
56
|
-
"node": ">=
|
|
61
|
+
"node": ">=24"
|
|
57
62
|
},
|
|
58
63
|
"devDependencies": {
|
|
59
64
|
"@types/babel__core": "^7.20.5",
|
|
60
65
|
"@types/node": "^25.5.0",
|
|
61
|
-
"vite": "^
|
|
66
|
+
"vite": "^8.0.0",
|
|
62
67
|
"vitest": "^4.1.0"
|
|
63
68
|
},
|
|
64
69
|
"peerDependencies": {
|
|
65
|
-
"vite": "^
|
|
70
|
+
"vite": "^8"
|
|
66
71
|
},
|
|
67
72
|
"scripts": {
|
|
68
73
|
"build": "pnpm validate-imports && tsc && node scripts/build.js",
|
|
69
74
|
"dev": "tsc --watch",
|
|
70
75
|
"test": "vitest",
|
|
71
76
|
"test:ci": "vitest run",
|
|
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
|
-
}
|
package/src/client/index.tsx
DELETED
package/src/client/mount.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { hydrate as mount } from "solid-js/web"
|
package/src/client/spa/index.tsx
DELETED
|
@@ -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";
|
package/src/config/constants.ts
DELETED
|
@@ -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
|
-
};
|
package/src/config/dev-server.ts
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { NodeRequest, sendNodeResponse } from "srvx/node";
|
|
2
|
-
import {
|
|
3
|
-
type Connect,
|
|
4
|
-
isRunnableDevEnvironment,
|
|
5
|
-
type PluginOption,
|
|
6
|
-
type ViteDevServer,
|
|
7
|
-
} from "vite";
|
|
8
|
-
import { VITE_ENVIRONMENTS } from "./constants.ts";
|
|
9
|
-
|
|
10
|
-
export function devServer(): Array<PluginOption> {
|
|
11
|
-
return [
|
|
12
|
-
{
|
|
13
|
-
name: "solid-start-dev-server",
|
|
14
|
-
configurePreviewServer(server) {
|
|
15
|
-
return () => {
|
|
16
|
-
server.middlewares.use(async (req, res) => {
|
|
17
|
-
res.setHeader("content-encoding", "identity");
|
|
18
|
-
const webReq = new NodeRequest({ req, res });
|
|
19
|
-
const def: {
|
|
20
|
-
default: { fetch: (req: Request) => Promise<Response> };
|
|
21
|
-
} = await import(process.cwd() + "/dist/server/entry-server.js");
|
|
22
|
-
sendNodeResponse(res, await def.default.fetch(webReq));
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
},
|
|
26
|
-
configureServer(viteDevServer) {
|
|
27
|
-
(globalThis as any).VITE_DEV_SERVER = viteDevServer;
|
|
28
|
-
return async () => {
|
|
29
|
-
if (viteDevServer.config.server.middlewareMode) return;
|
|
30
|
-
|
|
31
|
-
const serverEnv = viteDevServer.environments[VITE_ENVIRONMENTS.server];
|
|
32
|
-
|
|
33
|
-
if (!serverEnv) throw new Error("Server environment not found");
|
|
34
|
-
if (
|
|
35
|
-
// do not check via `isFetchableDevEnvironment` since nitro does implement the `FetchableDevEnvironment` interface but not via inheritance (which this helper checks)
|
|
36
|
-
"dispatchFetch" in serverEnv
|
|
37
|
-
)
|
|
38
|
-
return;
|
|
39
|
-
// another plugin is controlling the dev server
|
|
40
|
-
if (!isRunnableDevEnvironment(serverEnv)) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
globalThis.USING_SOLID_START_DEV_SERVER = true;
|
|
45
|
-
|
|
46
|
-
removeHtmlMiddlewares(viteDevServer);
|
|
47
|
-
|
|
48
|
-
viteDevServer.middlewares.use(async (req, res) => {
|
|
49
|
-
if (req.originalUrl) {
|
|
50
|
-
req.url = req.originalUrl;
|
|
51
|
-
}
|
|
52
|
-
const webReq = new NodeRequest({ req, res });
|
|
53
|
-
|
|
54
|
-
try {
|
|
55
|
-
const serverEntry: {
|
|
56
|
-
default: { fetch: (req: Request) => Promise<Response> };
|
|
57
|
-
} = await serverEnv.runner.import("./src/entry-server.tsx");
|
|
58
|
-
|
|
59
|
-
const webRes = await serverEntry.default.fetch(webReq);
|
|
60
|
-
|
|
61
|
-
return sendNodeResponse(res, webRes);
|
|
62
|
-
} catch (e: unknown) {
|
|
63
|
-
console.error(e);
|
|
64
|
-
viteDevServer.ssrFixStacktrace(e as Error);
|
|
65
|
-
|
|
66
|
-
if (webReq.headers.get("content-type")?.includes("application/json")) {
|
|
67
|
-
return sendNodeResponse(
|
|
68
|
-
res,
|
|
69
|
-
Response.json(
|
|
70
|
-
{
|
|
71
|
-
status: 500,
|
|
72
|
-
error: "Internal Server Error",
|
|
73
|
-
message: "An unexpected error occurred. Please try again later.",
|
|
74
|
-
timestamp: new Date().toISOString(),
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
status: 500,
|
|
78
|
-
headers: {
|
|
79
|
-
"Content-Type": "application/json",
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
),
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
return sendNodeResponse(
|
|
87
|
-
res,
|
|
88
|
-
new Response(
|
|
89
|
-
`
|
|
90
|
-
<!DOCTYPE html>
|
|
91
|
-
<html lang="en">
|
|
92
|
-
<head>
|
|
93
|
-
<meta charset="UTF-8" />
|
|
94
|
-
<title>Error</title>
|
|
95
|
-
<script type="module">
|
|
96
|
-
import { ErrorOverlay } from '/@vite/client'
|
|
97
|
-
document.body.appendChild(new ErrorOverlay(${JSON.stringify(
|
|
98
|
-
prepareError(req, e),
|
|
99
|
-
).replace(/</g, "\\u003c")}))
|
|
100
|
-
</script>
|
|
101
|
-
</head>
|
|
102
|
-
<body>
|
|
103
|
-
</body>
|
|
104
|
-
</html>
|
|
105
|
-
`,
|
|
106
|
-
{
|
|
107
|
-
status: 500,
|
|
108
|
-
headers: { "Content-Type": "text/html" },
|
|
109
|
-
},
|
|
110
|
-
),
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
];
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Removes Vite internal middleware
|
|
122
|
-
*
|
|
123
|
-
* @param server
|
|
124
|
-
*/
|
|
125
|
-
function removeHtmlMiddlewares(server: ViteDevServer) {
|
|
126
|
-
const html_middlewares = [
|
|
127
|
-
"viteIndexHtmlMiddleware",
|
|
128
|
-
"vite404Middleware",
|
|
129
|
-
"viteSpaFallbackMiddleware",
|
|
130
|
-
];
|
|
131
|
-
for (let i = server.middlewares.stack.length - 1; i > 0; i--) {
|
|
132
|
-
if (
|
|
133
|
-
html_middlewares.includes(
|
|
134
|
-
// @ts-expect-error
|
|
135
|
-
server.middlewares.stack[i].handle.name,
|
|
136
|
-
)
|
|
137
|
-
) {
|
|
138
|
-
server.middlewares.stack.splice(i, 1);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Formats error for SSR message in error overlay
|
|
145
|
-
* @param req
|
|
146
|
-
* @param error
|
|
147
|
-
* @returns
|
|
148
|
-
*/
|
|
149
|
-
function prepareError(req: Connect.IncomingMessage, error: unknown) {
|
|
150
|
-
const e = error as Error;
|
|
151
|
-
return {
|
|
152
|
-
message: `An error occured while server rendering ${req.url}:\n\n\t${
|
|
153
|
-
typeof e === "string" ? e : e.message
|
|
154
|
-
} `,
|
|
155
|
-
stack: typeof e === "string" ? "" : e.stack,
|
|
156
|
-
};
|
|
157
|
-
}
|