@octanejs/vite-plugin 0.1.10 → 0.1.12
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/package.json +5 -5
- package/src/index.js +20 -6
- package/src/server/render-route.js +1 -1
- package/types/index.d.ts +9 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octanejs/vite-plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -46,18 +46,18 @@
|
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@ripple-ts/adapter": "^0.3.
|
|
50
|
-
"@octanejs/app-core": "0.0.
|
|
49
|
+
"@ripple-ts/adapter": "^0.3.101",
|
|
50
|
+
"@octanejs/app-core": "0.0.8"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"vite": "^8.0.16",
|
|
54
|
-
"octane": "0.1.
|
|
54
|
+
"octane": "0.1.12"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/node": "^24.3.0",
|
|
58
58
|
"playwright": "^1.61.0",
|
|
59
59
|
"type-fest": "^5.6.0",
|
|
60
60
|
"vite": "^8.0.16",
|
|
61
|
-
"octane": "0.1.
|
|
61
|
+
"octane": "0.1.12"
|
|
62
62
|
}
|
|
63
63
|
}
|
package/src/index.js
CHANGED
|
@@ -210,9 +210,9 @@ function collect_hydrate_module_paths(config) {
|
|
|
210
210
|
* build is redirected to `{outDir}/client` with a manifest, the hydrate entry
|
|
211
211
|
* is injected into index.html (so Vite bundles + hashes it), and closeBundle
|
|
212
212
|
* runs a second, `ssr: true` build of a generated server entry to
|
|
213
|
-
* `{outDir}/server/entry.js
|
|
214
|
-
*
|
|
215
|
-
*
|
|
213
|
+
* `{outDir}/server/entry.js`. Node-target adapters get the existing bootable
|
|
214
|
+
* `handler`/`nodeHandler` module; webworker-target adapters get an importable
|
|
215
|
+
* `createWebWorkerHandler` factory for their deployment wrapper.
|
|
216
216
|
*
|
|
217
217
|
* @param {{ hmr?: boolean, profile?: boolean, exclude?: string[], requireDirective?: boolean, renderers?: import('@octanejs/app-core').ExperimentalRendererConfigOptions }} [inlineOptions]
|
|
218
218
|
* @returns {Plugin[]}
|
|
@@ -670,6 +670,7 @@ export function octane(inlineOptions = {}) {
|
|
|
670
670
|
async closeBundle() {
|
|
671
671
|
if (!isBuild || isSSRBuild || !has_route_config(buildOctaneConfig)) return;
|
|
672
672
|
const cfg = /** @type {ResolvedOctaneConfig} */ (buildOctaneConfig);
|
|
673
|
+
const webWorkerServer = cfg.adapter?.serverTarget === 'webworker';
|
|
673
674
|
|
|
674
675
|
console.log('[@octanejs/vite-plugin] Client build done. Building the server bundle…');
|
|
675
676
|
|
|
@@ -712,9 +713,11 @@ export function octane(inlineOptions = {}) {
|
|
|
712
713
|
rootBoundary: cfg.rootBoundary,
|
|
713
714
|
rpcModulePaths: [...serverModuleModules],
|
|
714
715
|
clientAssetMap,
|
|
716
|
+
...(webWorkerServer ? { mode: 'webworker' } : null),
|
|
715
717
|
// The virtual entry has no filesystem importer, so resolve app-core
|
|
716
718
|
// from this package before handing source to Vite. This also works
|
|
717
719
|
// when app-core is nested under the plugin by a package manager.
|
|
720
|
+
configModuleId: requireFromPlugin.resolve('@octanejs/app-core/config'),
|
|
718
721
|
productionModuleId: requireFromPlugin.resolve('@octanejs/app-core/production'),
|
|
719
722
|
nodeModuleId: requireFromPlugin.resolve('@octanejs/app-core/node'),
|
|
720
723
|
}),
|
|
@@ -739,6 +742,10 @@ export function octane(inlineOptions = {}) {
|
|
|
739
742
|
await viteBuild({
|
|
740
743
|
root,
|
|
741
744
|
appType: 'custom',
|
|
745
|
+
// Vite deliberately preserves process.env references in SSR/library
|
|
746
|
+
// output. Pin build intent here so Rollup can remove Octane's complete
|
|
747
|
+
// development error table even when the server bundle is not minified.
|
|
748
|
+
define: { 'process.env.NODE_ENV': JSON.stringify('production') },
|
|
742
749
|
plugins: [virtualEntryPlugin],
|
|
743
750
|
resolve: {
|
|
744
751
|
alias: [
|
|
@@ -760,6 +767,10 @@ export function octane(inlineOptions = {}) {
|
|
|
760
767
|
minify: cfg.build.minify ?? false,
|
|
761
768
|
rollupOptions: {
|
|
762
769
|
input: VIRTUAL_SERVER_ENTRY_ID,
|
|
770
|
+
// Cloudflare's nodejs_compat exposes `node:` modules directly.
|
|
771
|
+
// Preserve application imports as well as Octane's current runtime
|
|
772
|
+
// dependencies instead of replacing them with browser shims.
|
|
773
|
+
...(webWorkerServer ? { external: [/^node:/] } : null),
|
|
763
774
|
output: {
|
|
764
775
|
entryFileNames: ENTRY_FILENAME,
|
|
765
776
|
format: 'esm',
|
|
@@ -767,6 +778,7 @@ export function octane(inlineOptions = {}) {
|
|
|
767
778
|
},
|
|
768
779
|
},
|
|
769
780
|
ssr: {
|
|
781
|
+
...(webWorkerServer ? { target: 'webworker' } : null),
|
|
770
782
|
// Self-contained server bundle: everything except node builtins is
|
|
771
783
|
// bundled, so dist/server deploys without node_modules. 'vite'
|
|
772
784
|
// stays external as a guard — nothing should reach it (the facade
|
|
@@ -784,9 +796,11 @@ export function octane(inlineOptions = {}) {
|
|
|
784
796
|
}
|
|
785
797
|
|
|
786
798
|
console.log(`[@octanejs/vite-plugin] Server build complete: ${path.join(outDir, 'server')}`);
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
799
|
+
if (!webWorkerServer) {
|
|
800
|
+
console.log(
|
|
801
|
+
`[@octanejs/vite-plugin] Start with: node ${outDir}/server/${ENTRY_FILENAME} (or octane-preview)`,
|
|
802
|
+
);
|
|
803
|
+
}
|
|
790
804
|
|
|
791
805
|
// ------------------------------------------------------------------
|
|
792
806
|
// Deploy adapter (SvelteKit-style): with both bundles on disk, let the
|
|
@@ -266,7 +266,7 @@ pre { background: #2d2d2d; padding: 1rem; border-radius: 4px; overflow-x: auto;
|
|
|
266
266
|
</head>
|
|
267
267
|
<body>
|
|
268
268
|
<h1>SSR Render Error</h1>
|
|
269
|
-
<p class="route">Route: ${route.path} → ${route.entry}</p>
|
|
269
|
+
<p class="route">Route: ${route.path} → ${get_route_entry_path(route.entry)}</p>
|
|
270
270
|
<pre>${escapeHtml(message)}</pre>
|
|
271
271
|
${stack ? `<pre>${escapeHtml(stack)}</pre>` : ''}
|
|
272
272
|
</body>
|
package/types/index.d.ts
CHANGED
|
@@ -23,13 +23,15 @@ export interface OctanePluginOptions {
|
|
|
23
23
|
*/
|
|
24
24
|
exclude?: string[];
|
|
25
25
|
/**
|
|
26
|
-
* Mixed-toolchain ownership gate: when `true`,
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
26
|
+
* Mixed-toolchain ownership gate: when `true`, a project `.tsrx` is
|
|
27
|
+
* Octane's by extension, and a project `.tsx` (full compile) or plain
|
|
28
|
+
* `.ts`/`.js` (hook slotting) is Octane's only when it opens with a
|
|
29
|
+
* leading `@jsxImportSource octane` pragma comment (any registered
|
|
30
|
+
* renderer's intrinsics module also counts). A pragma naming a
|
|
31
|
+
* foreign source (e.g. `react`) does not claim the file. Unmarked
|
|
32
|
+
* project modules pass through to the host framework's own pipeline
|
|
33
|
+
* (e.g. React's JSX transform). Installed and linked packages keep
|
|
34
|
+
* their Octane package-manifest decision.
|
|
33
35
|
* @default false
|
|
34
36
|
*/
|
|
35
37
|
requireDirective?: boolean;
|