@bleedingdev/modern-js-renderer-octane 0.0.0-stage → 3.9.3-ultramodern.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 (154) hide show
  1. package/LICENSE +21 -0
  2. package/bin/octane-tsc.mjs +4 -0
  3. package/dist/cjs/bootstrap.js +68 -0
  4. package/dist/cjs/client.js +421 -0
  5. package/dist/cjs/entry-application.js +88 -0
  6. package/dist/cjs/entry-client.js +95 -0
  7. package/dist/cjs/entry-server.js +135 -0
  8. package/dist/cjs/federation-context.js +72 -0
  9. package/dist/cjs/federation.js +205 -0
  10. package/dist/cjs/i18n/I18nProvider.js +59 -0
  11. package/dist/cjs/i18n/LocalizedLink.js +80 -0
  12. package/dist/cjs/i18n/context.js +41 -0
  13. package/dist/cjs/i18n/index.js +83 -0
  14. package/dist/cjs/i18n/languageSync.js +99 -0
  15. package/dist/cjs/i18n/types.js +18 -0
  16. package/dist/cjs/i18n/useI18n.js +110 -0
  17. package/dist/cjs/i18n-external-snapshot.js +645 -0
  18. package/dist/cjs/index.js +46 -0
  19. package/dist/cjs/manifest.js +167 -0
  20. package/dist/cjs/plugin/compiler.js +122 -0
  21. package/dist/cjs/plugin/create.js +266 -0
  22. package/dist/cjs/plugin/index.js +151 -0
  23. package/dist/cjs/plugin/profile.js +91 -0
  24. package/dist/cjs/plugin/source.js +56 -0
  25. package/dist/cjs/router-client.js +139 -0
  26. package/dist/cjs/router-external-snapshot.js +291 -0
  27. package/dist/cjs/router-handler.js +171 -0
  28. package/dist/cjs/router-server-cleanup.js +46 -0
  29. package/dist/cjs/router-server-snapshot.js +405 -0
  30. package/dist/cjs/router-server.js +100 -0
  31. package/dist/cjs/router-snapshot.js +270 -0
  32. package/dist/cjs/router.js +218 -0
  33. package/dist/cjs/routes.js +190 -0
  34. package/dist/cjs/server.js +245 -0
  35. package/dist/cjs/typecheck.js +615 -0
  36. package/dist/cjs/worker-federation-context.js +63 -0
  37. package/dist/cjs/worker-federation-contexts.js +97 -0
  38. package/dist/cjs/worker-federation.js +97 -0
  39. package/dist/esm/bootstrap.mjs +24 -0
  40. package/dist/esm/client.mjs +377 -0
  41. package/dist/esm/entry-application.mjs +44 -0
  42. package/dist/esm/entry-client.mjs +57 -0
  43. package/dist/esm/entry-server.mjs +91 -0
  44. package/dist/esm/federation-context.mjs +25 -0
  45. package/dist/esm/federation.mjs +167 -0
  46. package/dist/esm/i18n/I18nProvider.mjs +21 -0
  47. package/dist/esm/i18n/LocalizedLink.mjs +42 -0
  48. package/dist/esm/i18n/context.mjs +3 -0
  49. package/dist/esm/i18n/index.mjs +8 -0
  50. package/dist/esm/i18n/languageSync.mjs +61 -0
  51. package/dist/esm/i18n/types.mjs +0 -0
  52. package/dist/esm/i18n/useI18n.mjs +72 -0
  53. package/dist/esm/i18n-external-snapshot.mjs +576 -0
  54. package/dist/esm/index.mjs +8 -0
  55. package/dist/esm/manifest.mjs +117 -0
  56. package/dist/esm/router-client.mjs +98 -0
  57. package/dist/esm/router-external-snapshot.mjs +244 -0
  58. package/dist/esm/router-handler.mjs +133 -0
  59. package/dist/esm/router-server-cleanup.mjs +8 -0
  60. package/dist/esm/router-server-snapshot.mjs +367 -0
  61. package/dist/esm/router-server.mjs +11 -0
  62. package/dist/esm/router-snapshot.mjs +199 -0
  63. package/dist/esm/router.mjs +94 -0
  64. package/dist/esm/routes.mjs +134 -0
  65. package/dist/esm/server.mjs +204 -0
  66. package/dist/esm/worker-federation-context.mjs +19 -0
  67. package/dist/esm/worker-federation-contexts.mjs +47 -0
  68. package/dist/esm/worker-federation.mjs +59 -0
  69. package/dist/esm-node/bootstrap.mjs +24 -0
  70. package/dist/esm-node/manifest.mjs +117 -0
  71. package/dist/esm-node/plugin/compiler.mjs +67 -0
  72. package/dist/esm-node/plugin/create.mjs +228 -0
  73. package/dist/esm-node/plugin/index.mjs +103 -0
  74. package/dist/esm-node/plugin/profile.mjs +53 -0
  75. package/dist/esm-node/plugin/source.mjs +7 -0
  76. package/dist/esm-node/typecheck.mjs +560 -0
  77. package/dist/types/bootstrap.d.ts +10 -0
  78. package/dist/types/client.d.ts +40 -0
  79. package/dist/types/entry-application.d.ts +19 -0
  80. package/dist/types/entry-client.d.ts +10 -0
  81. package/dist/types/entry-server.d.ts +14 -0
  82. package/dist/types/federation-context.d.ts +28 -0
  83. package/dist/types/federation.d.ts +20 -0
  84. package/dist/types/i18n/I18nProvider.d.ts +8 -0
  85. package/dist/types/i18n/LocalizedLink.d.ts +14 -0
  86. package/dist/types/i18n/context.d.ts +9 -0
  87. package/dist/types/i18n/index.d.ts +9 -0
  88. package/dist/types/i18n/languageSync.d.ts +26 -0
  89. package/dist/types/i18n/types.d.ts +34 -0
  90. package/dist/types/i18n/useI18n.d.ts +21 -0
  91. package/dist/types/i18n-external-snapshot.d.ts +43 -0
  92. package/dist/types/index.d.ts +9 -0
  93. package/dist/types/manifest.d.ts +34 -0
  94. package/dist/types/plugin/compiler-manifest.d.cts +10 -0
  95. package/dist/types/plugin/compiler.d.ts +5 -0
  96. package/dist/types/plugin/create.d.ts +23 -0
  97. package/dist/types/plugin/index.d.ts +3 -0
  98. package/dist/types/plugin/profile.d.ts +2 -0
  99. package/dist/types/plugin/source.d.ts +1 -0
  100. package/dist/types/plugin/svg-component-template.d.cts +6 -0
  101. package/dist/types/router-client.d.ts +12 -0
  102. package/dist/types/router-external-snapshot.d.ts +10 -0
  103. package/dist/types/router-handler.d.ts +13 -0
  104. package/dist/types/router-server-cleanup.d.ts +3 -0
  105. package/dist/types/router-server-snapshot.d.ts +15 -0
  106. package/dist/types/router-server.d.ts +11 -0
  107. package/dist/types/router-snapshot.d.ts +14 -0
  108. package/dist/types/router.d.ts +30 -0
  109. package/dist/types/routes.d.ts +20 -0
  110. package/dist/types/server.d.ts +47 -0
  111. package/dist/types/typecheck.d.ts +31 -0
  112. package/dist/types/worker-federation-context.d.ts +34 -0
  113. package/dist/types/worker-federation-contexts.d.ts +25 -0
  114. package/dist/types/worker-federation.d.ts +20 -0
  115. package/package.json +278 -4
  116. package/src/bootstrap.ts +60 -0
  117. package/src/client.ts +568 -0
  118. package/src/entry-application.ts +76 -0
  119. package/src/entry-client.ts +90 -0
  120. package/src/entry-server.ts +153 -0
  121. package/src/federation-context.ts +53 -0
  122. package/src/federation.ts +307 -0
  123. package/src/i18n/I18nProvider.ts +47 -0
  124. package/src/i18n/LocalizedLink.ts +86 -0
  125. package/src/i18n/context.ts +12 -0
  126. package/src/i18n/index.ts +31 -0
  127. package/src/i18n/languageSync.ts +132 -0
  128. package/src/i18n/types.ts +36 -0
  129. package/src/i18n/useI18n.ts +119 -0
  130. package/src/i18n-external-snapshot.ts +803 -0
  131. package/src/index.ts +10 -0
  132. package/src/manifest.ts +253 -0
  133. package/src/plugin/compiler-manifest.cjs +204 -0
  134. package/src/plugin/compiler.ts +104 -0
  135. package/src/plugin/create.ts +273 -0
  136. package/src/plugin/index.ts +107 -0
  137. package/src/plugin/profile.ts +50 -0
  138. package/src/plugin/source.ts +16 -0
  139. package/src/plugin/svg-component-template.cjs +17 -0
  140. package/src/router-client.ts +144 -0
  141. package/src/router-external-snapshot.ts +363 -0
  142. package/src/router-handler.ts +185 -0
  143. package/src/router-server-cleanup.ts +11 -0
  144. package/src/router-server-snapshot.ts +564 -0
  145. package/src/router-server.ts +21 -0
  146. package/src/router-snapshot.ts +251 -0
  147. package/src/router.ts +192 -0
  148. package/src/routes.ts +274 -0
  149. package/src/server.ts +340 -0
  150. package/src/typecheck.ts +723 -0
  151. package/src/worker-federation-context.ts +51 -0
  152. package/src/worker-federation-contexts.ts +91 -0
  153. package/src/worker-federation.ts +120 -0
  154. package/README.md +0 -3
@@ -0,0 +1,67 @@
1
+ import node_fs from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import node_path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { OCTANE_COMPILER_VERSION, OCTANE_RUNTIME_VERSION, octaneModuleManifestFileName, validateOctaneModuleManifest } from "../manifest.mjs";
6
+ function pluginSourceDirectory() {
7
+ let directory = node_path.dirname(fileURLToPath(import.meta.url));
8
+ while(true){
9
+ const compiler = node_path.join(directory, 'src/plugin');
10
+ if (node_fs.existsSync(node_path.join(directory, 'package.json')) && node_fs.existsSync(node_path.join(compiler, 'compiler-manifest.cjs'))) return compiler;
11
+ const parent = node_path.dirname(directory);
12
+ if (parent === directory) throw new Error('Cannot locate the UltraModern Octane compiler package.');
13
+ directory = parent;
14
+ }
15
+ }
16
+ function createOctaneCompilerPlugin(options) {
17
+ return {
18
+ name: 'ultramodern:octane:compiler',
19
+ setup (api) {
20
+ const directory = pluginSourceDirectory();
21
+ const require = createRequire(node_path.join(directory, 'index.cjs'));
22
+ const { OctaneCompilerManifestPlugin } = require('./compiler-manifest.cjs');
23
+ const appRequire = createRequire(node_path.join(api.context.rootPath, 'package.json'));
24
+ const { inferRspackEnvironment, OctaneRspackPlugin } = appRequire('@octanejs/rspack-plugin');
25
+ api.modifyRsbuildConfig((config, { mergeRsbuildConfig })=>mergeRsbuildConfig(config, {
26
+ source: {
27
+ include: [
28
+ /[/\\]@octanejs[/\\]/u
29
+ ]
30
+ }
31
+ }));
32
+ api.modifyRspackConfig((config, { environment: rsbuildEnvironment })=>{
33
+ const environment = rsbuildEnvironment.name === options.workerEnvironmentName ? 'server' : inferRspackEnvironment(config.target);
34
+ config.plugins ??= [];
35
+ config.plugins.push(new OctaneRspackPlugin({
36
+ root: api.context.rootPath,
37
+ environment,
38
+ transpile: false
39
+ }));
40
+ config.plugins.push(new OctaneCompilerManifestPlugin({
41
+ emitClientManifest: 'client' === environment,
42
+ root: api.context.rootPath,
43
+ runtimeVersion: OCTANE_RUNTIME_VERSION,
44
+ compilerVersion: OCTANE_COMPILER_VERSION,
45
+ rendererIdentities: options.rendererIdentities,
46
+ manifestFilename: octaneModuleManifestFileName,
47
+ validateManifest: validateOctaneModuleManifest
48
+ }));
49
+ config.module ??= {};
50
+ config.module.rules ??= [];
51
+ config.module.rules.push({
52
+ test: /\.tsrx$/u,
53
+ type: "javascript/auto",
54
+ use: [
55
+ {
56
+ loader: 'builtin:swc-loader',
57
+ options: {
58
+ detectSyntax: 'auto'
59
+ }
60
+ }
61
+ ]
62
+ });
63
+ });
64
+ }
65
+ };
66
+ }
67
+ export { createOctaneCompilerPlugin, pluginSourceDirectory };
@@ -0,0 +1,228 @@
1
+ function generateOctaneAppSources(options) {
2
+ if ((options.entryName ?? 'main') !== 'main') throw new Error('The Octane app template supports the main entry only. The create-time workspace writer places src/modern-app-env.d.ts, src/routes/index.css and the package manifest at the app root regardless of entryName, so it cannot yet route a second entry into src/<entryName>/. Add that entry by hand after generation (mirror src/routes under src/<entryName>/routes) until an admitted native multi-entry create template exists; the native entry generator itself already supports arbitrary entry names.');
3
+ if (!options.appId.trim() || !options.title.trim()) throw new Error('The Octane app template requires an appId and title.');
4
+ if ('.tsx' !== options.sourceExtension) throw new Error('The Octane app template requires the admitted .tsx source profile. .tsrx generation requires an admitted native template profile.');
5
+ if ('octane' !== options.jsxImportSource) throw new Error('The Octane app template requires jsxImportSource: "octane" from the admitted profile.');
6
+ if ('boolean' != typeof options.capabilities.ssr || 'boolean' != typeof options.capabilities.federation) throw new Error('The Octane app template requires admitted capabilities.');
7
+ const title = JSON.stringify(options.title);
8
+ const aboutTitle = JSON.stringify(`${options.title} - About`);
9
+ const appId = JSON.stringify(options.appId);
10
+ return {
11
+ sourceExtension: '.tsx',
12
+ jsxImportSource: 'octane',
13
+ artifacts: [
14
+ {
15
+ path: 'src/routes/layout.tsx',
16
+ content: `import { Link, Outlet } from '@modern-js/renderer-octane/router';
17
+ import Stable from '../components/stable';
18
+ import './index.css';
19
+
20
+ const appTitle = ${title};
21
+
22
+ export default function Layout() {
23
+ return (
24
+ <main data-testid="native-layout">
25
+ <header>
26
+ <p>{appTitle}</p>
27
+ <nav aria-label="Application">
28
+ <Link to="/">Home</Link>
29
+ <Link to="/about">About</Link>
30
+ ${options.capabilities.federation ? ' <Link to="/remotes">Federated applications</Link>\n' : ''}
31
+ </nav>
32
+ </header>
33
+ <Stable />
34
+ <Outlet />
35
+ </main>
36
+ );
37
+ }
38
+ `
39
+ },
40
+ {
41
+ path: 'src/routes/page.tsx',
42
+ content: `import {
43
+ Link,
44
+ useLoaderData,
45
+ useOctaneRouteAction,
46
+ } from '@modern-js/renderer-octane/router';
47
+ import { useActionState } from 'octane';
48
+ import Counter from '../components/counter';
49
+
50
+ const appId = ${appId};
51
+ const appTitle = ${title};
52
+
53
+ export default function HomePage() {
54
+ const data = useLoaderData({ strict: false });
55
+ const submit = useOctaneRouteAction();
56
+ const [result, action, pending] = useActionState(submit, undefined);
57
+ return (
58
+ <section data-app-id={appId} data-testid="native-route" data-renderer="octane">
59
+ <h1>{appTitle}</h1>
60
+ <Counter />
61
+ <pre data-testid="native-loader-value">{JSON.stringify(data)}</pre>
62
+ <form action={action}>
63
+ <label>
64
+ Name <input name="name" />
65
+ </label>
66
+ <button type="submit" disabled={pending}>
67
+ Save
68
+ </button>
69
+ <button type="submit" name="intent" value="redirect">
70
+ Save and redirect
71
+ </button>
72
+ </form>
73
+ <pre data-testid="native-action-value">{JSON.stringify(result)}</pre>
74
+ <Link to="/about">Open native about route</Link>
75
+ </section>
76
+ );
77
+ }
78
+ `
79
+ },
80
+ {
81
+ path: 'src/routes/page.head.ts',
82
+ content: `import type { FileSystemRouteModule } from '@modern-js/renderer-octane/router';
83
+
84
+ export const head: NonNullable<FileSystemRouteModule['head']> = () => ({
85
+ meta: [
86
+ { title: ${title} },
87
+ { name: 'description', content: 'Built with the native Octane renderer' },
88
+ ],
89
+ });
90
+ `
91
+ },
92
+ {
93
+ path: 'src/routes/about/page.tsx',
94
+ content: `import { Link } from '@modern-js/renderer-octane/router';
95
+
96
+ export default function AboutPage() {
97
+ return (
98
+ <section data-testid="native-about">
99
+ <h1>Native Octane navigation</h1>
100
+ <Link to="/">Home</Link>
101
+ </section>
102
+ );
103
+ }
104
+ `
105
+ },
106
+ {
107
+ path: 'src/routes/about/page.head.ts',
108
+ content: `import type { FileSystemRouteModule } from '@modern-js/renderer-octane/router';
109
+
110
+ export const head: NonNullable<FileSystemRouteModule['head']> = () => ({
111
+ meta: [
112
+ { title: ${aboutTitle} },
113
+ { name: 'description', content: 'Built with the native Octane renderer' },
114
+ ],
115
+ });
116
+ `
117
+ },
118
+ {
119
+ path: 'src/components/counter.tsx',
120
+ content: `import { useState } from 'octane';
121
+
122
+ export default function Counter() {
123
+ const [count, setCount] = useState(0);
124
+ return (
125
+ <section data-testid="native-edited-component">
126
+ <span data-testid="native-hmr-marker">Counter before native edit</span>
127
+ <button type="button" onClick={() => setCount(value => value + 1)}>
128
+ Increment
129
+ </button>
130
+ <output data-testid="native-count">{count}</output>
131
+ </section>
132
+ );
133
+ }
134
+ `
135
+ },
136
+ {
137
+ path: 'src/components/stable.tsx',
138
+ content: `import { useState } from 'octane';
139
+
140
+ export default function Stable() {
141
+ const [count, setCount] = useState(0);
142
+ return (
143
+ <section data-testid="native-unaffected-component">
144
+ <button type="button" onClick={() => setCount(value => value + 1)}>
145
+ Increment stable state
146
+ </button>
147
+ <output data-testid="native-unaffected-count">{count}</output>
148
+ </section>
149
+ );
150
+ }
151
+ `
152
+ },
153
+ {
154
+ path: 'src/routes/page.data.ts',
155
+ content: `import type { DataHandlerInput } from '@modern-js/renderer-core/data';
156
+
157
+ export function loader({ request }: DataHandlerInput) {
158
+ const url = new URL(request.url);
159
+ if (url.searchParams.get('case') === 'not-found')
160
+ throw new Response('Native route not found', { status: 404 });
161
+ if (url.searchParams.get('case') === 'error')
162
+ throw new Error('Native loader failure');
163
+ if (url.searchParams.get('case') === 'redirect')
164
+ return new Response(null, { headers: { location: '/about' }, status: 302 });
165
+ return {
166
+ message: 'Native loader value',
167
+ privateValue: request.headers.get('x-conformance-private'),
168
+ };
169
+ }
170
+
171
+ export function action({ request }: DataHandlerInput) {
172
+ return request.formData().then(form => {
173
+ const name = form.get('name');
174
+ if (typeof name !== 'string' || name.trim().length === 0)
175
+ return Response.json(
176
+ { fieldErrors: { name: 'Name required' } },
177
+ { status: 422 },
178
+ );
179
+ if (form.get('intent') === 'redirect')
180
+ return new Response(null, {
181
+ headers: {
182
+ location: '/about',
183
+ 'set-cookie': 'conformance-saved=1; Path=/; SameSite=Lax',
184
+ },
185
+ status: 303,
186
+ });
187
+ if (form.get('intent') === 'throw') throw new Error('Native action failure');
188
+ return {
189
+ saved: name,
190
+ privateValue: request.headers.get('x-conformance-private'),
191
+ };
192
+ });
193
+ }
194
+ `
195
+ },
196
+ {
197
+ path: 'src/routes/error.tsx',
198
+ content: `import type { ErrorRouteComponent } from '@modern-js/renderer-octane/router';
199
+
200
+ const ErrorBoundary: ErrorRouteComponent = props => (
201
+ <section data-testid="native-error">
202
+ <h1>Something went wrong</h1>
203
+ <output>
204
+ {props.error instanceof Error ? props.error.message : String(props.error)}
205
+ </output>
206
+ </section>
207
+ );
208
+
209
+ export default ErrorBoundary;
210
+ `
211
+ },
212
+ {
213
+ path: 'src/routes/not-found.tsx',
214
+ content: `import type { NotFoundRouteComponent } from '@modern-js/renderer-octane/router';
215
+
216
+ const NotFound: NotFoundRouteComponent = () => (
217
+ <section data-testid="native-not-found">
218
+ <h1>Page not found</h1>
219
+ </section>
220
+ );
221
+
222
+ export default NotFound;
223
+ `
224
+ }
225
+ ]
226
+ };
227
+ }
228
+ export { generateOctaneAppSources };
@@ -0,0 +1,103 @@
1
+ import node_path from "node:path";
2
+ import { defineRendererAdapter, nativeRendererDependencies } from "@modern-js/renderer-core/adapter";
3
+ import { compilerArtifacts } from "../manifest.mjs";
4
+ import { createOctaneCompilerPlugin, pluginSourceDirectory } from "./compiler.mjs";
5
+ import { generateOctaneAppSources } from "./create.mjs";
6
+ import { octaneProfile } from "./profile.mjs";
7
+ import { assertOctaneEntrySource } from "./source.mjs";
8
+ const rendererAdapter = defineRendererAdapter({
9
+ name: 'octane',
10
+ kind: 'native',
11
+ profile: octaneProfile,
12
+ routerFrameworks: [
13
+ 'octane'
14
+ ],
15
+ runtime: {
16
+ package: 'octane',
17
+ bootstrap: '@modern-js/renderer-octane',
18
+ entryClient: '@modern-js/renderer-octane/entry-client',
19
+ entryServer: '@modern-js/renderer-octane/entry-server',
20
+ router: '@modern-js/renderer-octane/router',
21
+ i18n: '@modern-js/renderer-octane/i18n',
22
+ manifest: '@modern-js/renderer-octane/manifest'
23
+ },
24
+ federation: {
25
+ library: 'module',
26
+ ssr: true,
27
+ shared: [
28
+ 'octane',
29
+ 'octane/',
30
+ 'octane/internal/context',
31
+ 'octane/internal/signal-read',
32
+ 'octane/signals',
33
+ '@octanejs/tanstack-router',
34
+ '@octanejs/tanstack-router/',
35
+ '@modern-js/renderer-octane',
36
+ '@modern-js/renderer-octane/',
37
+ '@modern-js/renderer-octane/router',
38
+ '@modern-js/renderer-octane/federation',
39
+ '@modern-js/renderer-core',
40
+ '@modern-js/renderer-core/',
41
+ '@tanstack/router-core',
42
+ '@tanstack/history',
43
+ 'seroval',
44
+ 'seroval-plugins'
45
+ ],
46
+ sharedByEnvironment: {
47
+ client: {
48
+ 'octane/internal/client': 'octane/internal/client',
49
+ 'octane/signals/client': 'octane/signals/client',
50
+ 'octane/profiling': 'octane/profiling',
51
+ 'octane/hydration/streamed-signals': 'octane/hydration/streamed-signals',
52
+ '@modern-js/renderer-octane/client': '@modern-js/renderer-octane/client'
53
+ },
54
+ server: {
55
+ octane: 'octane/server',
56
+ 'octane/server': 'octane/server',
57
+ 'octane/internal/server': 'octane/internal/server',
58
+ 'octane/signals/server': 'octane/signals/server'
59
+ }
60
+ }
61
+ },
62
+ worker: {
63
+ nativeDocuments: true,
64
+ rsc: false
65
+ },
66
+ lazyStyles: 'document',
67
+ entryClient: {
68
+ declarations: 'declare const __webpack_hash__: string;\n',
69
+ fields: {
70
+ nativeHydrationBuildId: '__webpack_hash__'
71
+ }
72
+ },
73
+ svgComponentTemplate: ()=>node_path.join(pluginSourceDirectory(), 'svg-component-template.cjs'),
74
+ compiler: createOctaneCompilerPlugin,
75
+ artifacts: compilerArtifacts,
76
+ assertSupportedSource: assertOctaneEntrySource,
77
+ create: {
78
+ templates: {
79
+ federation: true,
80
+ workers: true
81
+ },
82
+ dependencies: (profile, { typescriptVersion })=>({
83
+ frameworkDependencies: [
84
+ '@modern-js/renderer-core',
85
+ '@modern-js/renderer-octane'
86
+ ],
87
+ dependencies: nativeRendererDependencies(profile),
88
+ devDependencies: {
89
+ [profile.compiler.name]: profile.dependencies[profile.compiler.name] ?? profile.compiler.version,
90
+ typescript: typescriptVersion
91
+ },
92
+ typecheckCommand: 'octane-tsc --noEmit --project tsconfig.json',
93
+ tsconfig: {
94
+ tsrx: {
95
+ compiler: 'octane/compiler/volar',
96
+ platform: 'web'
97
+ }
98
+ }
99
+ }),
100
+ generateAppSources: generateOctaneAppSources
101
+ }
102
+ });
103
+ export { rendererAdapter };
@@ -0,0 +1,53 @@
1
+ const octaneProfile = {
2
+ renderer: 'octane',
3
+ status: 'preview',
4
+ protocolVersion: 1,
5
+ minimumNode: '26.12.0',
6
+ hmr: {
7
+ editedBoundary: 'may-reset',
8
+ unaffectedComponents: 'preserved',
9
+ document: 'preserved',
10
+ roots: 'single',
11
+ cleanup: 'exactly-once'
12
+ },
13
+ compiler: {
14
+ name: '@octanejs/rspack-plugin',
15
+ version: '0.2.4'
16
+ },
17
+ hydration: {
18
+ name: 'octane',
19
+ version: '0.13.8'
20
+ },
21
+ router: {
22
+ name: '@octanejs/tanstack-router',
23
+ version: '0.2.10',
24
+ coreName: '@tanstack/router-core',
25
+ coreVersion: '1.171.38'
26
+ },
27
+ sourceExtensions: [
28
+ '.tsx',
29
+ '.tsrx',
30
+ '.ts',
31
+ '.js'
32
+ ],
33
+ jsxImportSource: 'octane',
34
+ dependencies: {
35
+ '@tsrx/oxc': '0.20.0',
36
+ octane: 'https://github.com/BleedingDev/octane/releases/download/ultramodern-octane-2383d2ab1e70/octane-0.13.8.tgz',
37
+ '@octanejs/tanstack-router': 'https://github.com/BleedingDev/octane/releases/download/ultramodern-octane-2383d2ab1e70/octanejs-tanstack-router-0.2.10.tgz',
38
+ '@octanejs/rspack-plugin': 'https://github.com/BleedingDev/octane/releases/download/ultramodern-octane-2383d2ab1e70/octanejs-rspack-plugin-0.2.4.tgz',
39
+ '@tanstack/router-core': 'https://github.com/BleedingDev/router/releases/download/ultramodern-router-core-585d3233f7f5/tanstack-router-core-1.171.38.tgz',
40
+ '@modern-js/renderer-octane': '3.8.3',
41
+ seroval: '1.6.9',
42
+ 'seroval-plugins': '1.6.9'
43
+ },
44
+ capabilities: {
45
+ worker: true,
46
+ moduleFederation: true,
47
+ rsc: false,
48
+ ssg: true,
49
+ i18n: true,
50
+ svgComponent: true
51
+ }
52
+ };
53
+ export { octaneProfile };
@@ -0,0 +1,7 @@
1
+ import promises from "node:fs/promises";
2
+ import node_path from "node:path";
3
+ import { octaneProfile } from "./profile.mjs";
4
+ async function assertOctaneEntrySource(source) {
5
+ if (source && '.jsx' === node_path.extname(source).toLowerCase() && (await promises.stat(source)).isFile()) throw new Error(`unsupported-renderer-capability: Octane does not support .jsx source: ${source}. Supported source extensions: ${octaneProfile.sourceExtensions.join(', ')}.`);
6
+ }
7
+ export { assertOctaneEntrySource };