octane 0.1.12 → 0.1.13
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/dist/compiler/bundler.js +29 -51
- package/dist/compiler/compile-universal.js +921 -95
- package/dist/compiler/compile.js +1583 -137
- package/dist/compiler/hydrate-boundaries.js +449 -23
- package/dist/compiler/renderers.js +16 -1
- package/dist/compiler/vite.d.ts +2 -0
- package/dist/compiler/vite.js +9 -1
- package/dist/compiler/volar.js +8 -0
- package/dist/constants.d.ts +7 -1
- package/dist/constants.js +7 -1
- package/dist/dom-tables.d.ts +2 -0
- package/dist/dom-tables.js +145 -0
- package/dist/hydration/event-capture.d.ts +4 -1
- package/dist/hydration/event-capture.js +9 -2
- package/dist/hydration/types.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -0
- package/dist/runtime.d.ts +7 -0
- package/dist/runtime.js +484 -104
- package/dist/runtime.server.d.ts +1 -14
- package/dist/runtime.server.js +101 -18
- package/dist/stream-protocol.d.ts +20 -0
- package/dist/stream-protocol.js +68 -0
- package/dist/universal-core.js +18 -24
- package/package.json +11 -11
package/dist/compiler/bundler.js
CHANGED
|
@@ -14,17 +14,14 @@ import * as nodeFs from 'node:fs';
|
|
|
14
14
|
import * as nodeModule from 'node:module';
|
|
15
15
|
import * as nodePath from 'node:path';
|
|
16
16
|
import { parseModule } from '@tsrx/core';
|
|
17
|
-
import { compile, hasOnlyLowerableNullishExits, isVoidJsxCodeBlockFunction } from './compile.js';
|
|
18
17
|
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
prepareServerHydrateBoundaries,
|
|
27
|
-
} from './hydrate-boundaries.js';
|
|
18
|
+
compile,
|
|
19
|
+
compileForBundler,
|
|
20
|
+
hasOnlyLowerableNullishExits,
|
|
21
|
+
isVoidJsxCodeBlockFunction,
|
|
22
|
+
} from './compile.js';
|
|
23
|
+
import { validateRendererModuleSource } from './compile-universal.js';
|
|
24
|
+
import { HYDRATE_QUERY_PARAM, hydrateBoundaryPathFromId } from './hydrate-boundaries.js';
|
|
28
25
|
import {
|
|
29
26
|
DOM_RENDERER_MODULE,
|
|
30
27
|
normalizeRendererConfig,
|
|
@@ -32,10 +29,7 @@ import {
|
|
|
32
29
|
} from './renderers.js';
|
|
33
30
|
import { findLeadingJsxImportSourcePragma } from './pragma.js';
|
|
34
31
|
import { normalizeUniversalRuntime } from './universal-runtime.js';
|
|
35
|
-
import {
|
|
36
|
-
analyzeNativeChangeDiagnostics,
|
|
37
|
-
formatCompileDiagnostic,
|
|
38
|
-
} from './native-change-diagnostics.js';
|
|
32
|
+
import { formatCompileDiagnostic } from './native-change-diagnostics.js';
|
|
39
33
|
import { findVoidComponentImports, findVoidRootImports, slotHooks } from './slot-hooks.js';
|
|
40
34
|
import {
|
|
41
35
|
assertNoLiveClientOnlyImports,
|
|
@@ -883,36 +877,11 @@ class OctaneBundlerCompiler {
|
|
|
883
877
|
};
|
|
884
878
|
}
|
|
885
879
|
const hasRendererBoundaries = Object.keys(this.renderers.boundaries).length > 0;
|
|
886
|
-
const
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
dom: renderer.target === 'dom',
|
|
892
|
-
renderer,
|
|
893
|
-
rendererBoundaries: this.renderers.boundaries,
|
|
894
|
-
rendererRegistry: this.renderers.registry,
|
|
895
|
-
},
|
|
896
|
-
);
|
|
897
|
-
const nativeChangeDiagnostics = nativeChangeAnalysis.diagnostics;
|
|
898
|
-
const hydratePreparation =
|
|
899
|
-
environment === 'client'
|
|
900
|
-
? prepareHydrateBoundaries(code, filename, hydrateBoundaryPath)
|
|
901
|
-
: prepareServerHydrateBoundaries(code, filename);
|
|
902
|
-
const compileSource = hydratePreparation?.source ?? code;
|
|
903
|
-
const out = compile(compileSource, filename, {
|
|
904
|
-
__hydratePrepared: true,
|
|
905
|
-
__hydrateBoundaryModule: typeof hydratePreparation?.boundaryPath === 'string',
|
|
906
|
-
__nativeChangeDiagnostics: nativeChangeDiagnostics,
|
|
907
|
-
...(hydratePreparation === null && !hasRendererBoundaries
|
|
908
|
-
? { __nativeChangeAnalysis: nativeChangeAnalysis }
|
|
909
|
-
: null),
|
|
910
|
-
// Scoped-style hashes are position-derived; after the extraction
|
|
911
|
-
// rewrite the compiler restamps them from these authored
|
|
912
|
-
// coordinates so client and server compiles agree (compile.js).
|
|
913
|
-
...(hydratePreparation?.origins != null
|
|
914
|
-
? { __styleRemap: { authored: code, origins: hydratePreparation.origins } }
|
|
915
|
-
: null),
|
|
880
|
+
const compileFilename =
|
|
881
|
+
hydrateBoundaryPath === null
|
|
882
|
+
? filename
|
|
883
|
+
: `${filename}?${HYDRATE_QUERY_PARAM}=${encodeURIComponent(hydrateBoundaryPath)}`;
|
|
884
|
+
const compileOptions = {
|
|
916
885
|
hmr,
|
|
917
886
|
mode: environment,
|
|
918
887
|
dev,
|
|
@@ -933,10 +902,17 @@ class OctaneBundlerCompiler {
|
|
|
933
902
|
...(environment === 'client' && typeof options.isVoidComponentImport === 'function'
|
|
934
903
|
? { isVoidComponentImport: options.isVoidComponentImport }
|
|
935
904
|
: null),
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
905
|
+
};
|
|
906
|
+
const collectVoidComponentExports =
|
|
907
|
+
environment === 'client' && options.collectVoidComponentExports === true;
|
|
908
|
+
let out;
|
|
909
|
+
let voidComponentSource = null;
|
|
910
|
+
if (collectVoidComponentExports) {
|
|
911
|
+
const compilation = compileForBundler(code, compileFilename, compileOptions);
|
|
912
|
+
out = compilation.result;
|
|
913
|
+
voidComponentSource = compilation.hydrateSource;
|
|
914
|
+
} else {
|
|
915
|
+
out = compile(code, compileFilename, compileOptions);
|
|
940
916
|
}
|
|
941
917
|
this._forwardCompileDiagnostics(out.diagnostics);
|
|
942
918
|
return {
|
|
@@ -947,9 +923,11 @@ class OctaneBundlerCompiler {
|
|
|
947
923
|
renderer,
|
|
948
924
|
...(out.universalRuntime === undefined ? null : { universalRuntime: out.universalRuntime }),
|
|
949
925
|
...(clientReference === null ? null : { clientReference }),
|
|
950
|
-
...(
|
|
951
|
-
?
|
|
952
|
-
: {
|
|
926
|
+
...(voidComponentSource === null
|
|
927
|
+
? null
|
|
928
|
+
: {
|
|
929
|
+
voidComponentExports: findVoidComponentExports(voidComponentSource, filename),
|
|
930
|
+
}),
|
|
953
931
|
...finishMetadata(collected),
|
|
954
932
|
};
|
|
955
933
|
}
|