vite-plugin-taro 0.6.0 → 0.6.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.
Files changed (68) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/dist/node/plugins/h5/transform-app.js +1 -1
  4. package/dist/node/plugins/wx/dev/plugins.js +1 -1
  5. package/dist/node/plugins/wx/dev/wx-dev-options.js +22 -1
  6. package/dist/node/plugins/wx/module/chunk-path.d.ts +8 -0
  7. package/dist/node/plugins/wx/module/chunk-path.js +18 -0
  8. package/dist/node/plugins/wx/{module.js → module/module.js} +2 -2
  9. package/dist/node/plugins/wx/native/create-native-component-output.d.ts +3 -1
  10. package/dist/node/plugins/wx/native/create-native-component-output.js +3 -5
  11. package/dist/node/plugins/wx/output/files.d.ts +3 -2
  12. package/dist/node/plugins/wx/output/files.js +2 -2
  13. package/dist/node/plugins/wx/output/json.d.ts +1 -1
  14. package/dist/node/plugins/wx/output/json.js +1 -1
  15. package/dist/node/plugins/wx/placer/placement.d.ts +51 -0
  16. package/dist/node/plugins/wx/placer/placement.js +245 -0
  17. package/dist/node/plugins/wx/placer/placer.d.ts +76 -0
  18. package/dist/node/plugins/wx/placer/placer.js +147 -0
  19. package/dist/node/plugins/wx/plugins.js +17 -17
  20. package/dist/node/plugins/wx/render/capsule.d.ts +35 -3
  21. package/dist/node/plugins/wx/render/capsule.js +53 -12
  22. package/dist/node/plugins/wx/render/native.d.ts +20 -2
  23. package/dist/node/plugins/wx/render/native.js +539 -35
  24. package/dist/node/plugins/wx/render/system-js/string-editor.d.ts +24 -0
  25. package/dist/node/plugins/wx/render/system-js/string-editor.js +93 -0
  26. package/dist/node/plugins/wx/render/system-js/system-js.d.ts +23 -0
  27. package/dist/node/plugins/wx/render/system-js/system-js.js +602 -0
  28. package/dist/node/plugins/wx/render/transport.d.ts +7 -3
  29. package/dist/node/plugins/wx/render/transport.js +19 -10
  30. package/dist/node/plugins/wx/resolve/resolver.js +1 -1
  31. package/dist/node/plugins/wx/resolve/specialize-bootstrap.js +1 -1
  32. package/dist/node/plugins/wx/resolve/specialize-page-capsule.js +1 -1
  33. package/dist/node/utils/modules.d.ts +0 -2
  34. package/dist/node/utils/modules.js +0 -7
  35. package/dist/node/utils/transform.d.ts +0 -3
  36. package/dist/node/utils/transform.js +0 -23
  37. package/package.json +8 -6
  38. package/src/node/plugins/h5/transform-app.ts +1 -1
  39. package/src/node/plugins/wx/dev/plugins.ts +1 -1
  40. package/src/node/plugins/wx/dev/wx-dev-options.ts +22 -1
  41. package/src/node/plugins/wx/module/chunk-path.ts +22 -0
  42. package/src/node/plugins/wx/{module.ts → module/module.ts} +2 -2
  43. package/src/node/plugins/wx/native/create-native-component-output.ts +6 -5
  44. package/src/node/plugins/wx/output/files.ts +5 -3
  45. package/src/node/plugins/wx/output/json.ts +1 -2
  46. package/src/node/plugins/wx/placer/placement.ts +364 -0
  47. package/src/node/plugins/wx/placer/placer.ts +179 -0
  48. package/src/node/plugins/wx/plugins.ts +19 -19
  49. package/src/node/plugins/wx/render/capsule.ts +53 -17
  50. package/src/node/plugins/wx/render/native.ts +670 -55
  51. package/src/node/plugins/wx/render/system-js/string-editor.ts +115 -0
  52. package/src/node/plugins/wx/render/system-js/system-js.ts +831 -0
  53. package/src/node/plugins/wx/render/transport.ts +25 -9
  54. package/src/node/plugins/wx/resolve/resolver.ts +1 -1
  55. package/src/node/plugins/wx/resolve/specialize-bootstrap.ts +1 -1
  56. package/src/node/plugins/wx/resolve/specialize-page-capsule.ts +1 -1
  57. package/src/node/utils/modules.ts +0 -8
  58. package/src/node/utils/transform.ts +0 -30
  59. package/dist/node/plugins/wx/placement/placer.d.ts +0 -78
  60. package/dist/node/plugins/wx/placement/placer.js +0 -158
  61. package/dist/node/plugins/wx/placement/plan.d.ts +0 -46
  62. package/dist/node/plugins/wx/placement/plan.js +0 -210
  63. package/dist/node/plugins/wx/render/capsule-wrapper.d.ts +0 -3
  64. package/dist/node/plugins/wx/render/capsule-wrapper.js +0 -64
  65. package/src/node/plugins/wx/placement/placer.ts +0 -187
  66. package/src/node/plugins/wx/placement/plan.ts +0 -306
  67. package/src/node/plugins/wx/render/capsule-wrapper.ts +0 -86
  68. /package/dist/node/plugins/wx/{module.d.ts → module/module.d.ts} +0 -0
@@ -0,0 +1,147 @@
1
+ import { normalizePath } from 'vite';
2
+ import { getWxExecutionKind, isTransportModule } from '../module/module.js';
3
+ import { getNativeComponentAssetBytes } from '../native/native-component-assets.js';
4
+ import { createPlacement } from './placement.js';
5
+ const pnpmFrameworkPackagePattern = /\/node_modules\/\.pnpm\/(?:@tarojs\+|react(?:-dom|-reconciler)?@|scheduler@)/;
6
+ const workspaceFrameworkPackagePattern = /\/packages\/(?:taro-react|taro-plugin-framework-react)\//;
7
+ /** Selects the explicit React/Taro roots whose complete dependency closure forms the framework vendor chunk. */
8
+ export function isWxFrameworkVendorModule(moduleId) {
9
+ const normalizedId = normalizePath(moduleId);
10
+ return pnpmFrameworkPackagePattern.test(normalizedId) || workspaceFrameworkPackagePattern.test(normalizedId);
11
+ }
12
+ /**
13
+ * Rolldown options owned by WX placement. Every field enforces a distinct output invariant. The plugin returns this object
14
+ * from its config hook, while direct Rolldown integration tests reuse the same value to exercise the identical lifecycle.
15
+ */
16
+ export const placementRolldownOptions = {
17
+ /**
18
+ * Output-stage naming remains under Rolldown's ownership. These options establish physical candidates and hash
19
+ * participation only; LTHP mutates the resulting OutputChunk filenames later without replacing the chunks.
20
+ */
21
+ output: {
22
+ /**
23
+ * React and Taro form one stable framework boundary shared by the App and every Page capsule. Keeping their complete
24
+ * dependency closure together prevents application edits from invalidating framework chunk identity and makes later
25
+ * development generations eligible to reuse the unchanged vendor. All remaining modules use Rolldown's automatic
26
+ * chunking; physical WX package placement operates on those final chunks without imposing another split strategy.
27
+ */
28
+ codeSplitting: {
29
+ groups: [
30
+ {
31
+ name: 'vendor',
32
+ test: isWxFrameworkVendorModule,
33
+ priority: 100,
34
+ includeDependenciesRecursively: true
35
+ }
36
+ ]
37
+ },
38
+ /**
39
+ * Native App/Page/Component shells are files addressed directly by WeChat and must retain the exact names configured
40
+ * in `input`, such as `app.js` and `pages/home/index.js`. Transport is excluded even though it is CommonJS:
41
+ * application chunks import its content-hashed path, so it belongs with hashed runtime/capsule entries. `[hash]`
42
+ * remains a Rolldown placeholder here and is resolved only after renderChunk transforms finish.
43
+ */
44
+ entryFileNames(chunk) {
45
+ return getWxExecutionKind(chunk) === 'native' && !isTransportModule(chunk)
46
+ ? '[name]'
47
+ : 'assets/[name]-[hash].js';
48
+ },
49
+ /**
50
+ * Leaves chunk identity and collision handling entirely to Rolldown. This package-neutral physical pattern deliberately
51
+ * contains no LTHP owner; generateBundle adds only the selected package root to the existing Rolldown filename.
52
+ */
53
+ chunkFileNames: 'assets/[name]-[hash].js',
54
+ /**
55
+ * Emits generic Rolldown assets under one collision-resistant hashed namespace. Native-component folders are not
56
+ * governed by this option: createNativeComponentOutput preserves their required relative filenames and relocates the
57
+ * complete folder beside its owning JavaScript chunk after LTHP finalization.
58
+ */
59
+ assetFileNames: 'assets/[name]-[hash][extname]'
60
+ },
61
+ /**
62
+ * Keeps every native entry's required exports while allowing Rolldown to add cross-chunk bindings created by natural code
63
+ * splitting. `strict` can reject those extensions; `exports-only` can merge away native boundaries; `allow-extension`
64
+ * preserves the shell/capsule contract without forcing source-module placement groups.
65
+ */
66
+ preserveEntrySignatures: 'allow-extension'
67
+ };
68
+ /**
69
+ * Creates the `vpt:wx-placer` lifecycle owner:
70
+ *
71
+ * 1. Its config hook installs package-neutral Rolldown names and entry-signature semantics.
72
+ * 2. `renderStart` atomically starts a generation in `awaiting-chunks`; no stale placement remains reachable.
73
+ * 3. Its first pre-order `renderChunk` creates one immutable LTHP placement from the complete tree-shaken graph.
74
+ * 4. `vpt:wx` asks this plugin only for package ownership, physical relocation, and native loading mode.
75
+ * 5. Its pre-order `generateBundle` assigns each OutputChunk its package-qualified filename and publishes app.json declarations.
76
+ *
77
+ * The discriminated state is the only generation-local mutation: `idle → awaiting-chunks → planned → finalized`. Each hook
78
+ * performs one whole-state transition, so stale graph state, duplicate planning, and partially reset generations are
79
+ * unrepresentable.
80
+ */
81
+ export function createWxPlacementPlugin() {
82
+ // This one mutable cell is the output-generation state machine described above; hooks replace it atomically by phase.
83
+ let state = { phase: 'idle' };
84
+ function requirePlacement() {
85
+ if (state.phase === 'idle' || state.phase === 'awaiting-chunks') {
86
+ throw new Error('wx placement is unavailable before Rolldown exposes the final chunk graph');
87
+ }
88
+ return state.placement;
89
+ }
90
+ return {
91
+ name: 'vpt:wx-placer',
92
+ config() {
93
+ return {
94
+ build: {
95
+ rolldownOptions: placementRolldownOptions
96
+ }
97
+ };
98
+ },
99
+ renderStart() {
100
+ state = { phase: 'awaiting-chunks' };
101
+ },
102
+ renderChunk: {
103
+ order: 'pre',
104
+ handler(_code, _chunk, _outputOptions, meta) {
105
+ if (state.phase === 'planned') {
106
+ return;
107
+ }
108
+ if (state.phase !== 'awaiting-chunks') {
109
+ throw new Error(`wx placement received final chunks during the ${state.phase} phase`);
110
+ }
111
+ state = {
112
+ phase: 'planned',
113
+ placement: createPlacement({
114
+ chunks: meta.chunks,
115
+ getAdditionalModuleBytes: (moduleId) => getNativeComponentAssetBytes(this.getModuleInfo(moduleId)?.meta)
116
+ })
117
+ };
118
+ }
119
+ },
120
+ generateBundle: {
121
+ order: 'pre',
122
+ handler(_outputOptions, bundle) {
123
+ const placement = requirePlacement();
124
+ state = {
125
+ phase: 'finalized',
126
+ placement: placement,
127
+ subpackages: placement.finalize(bundle)
128
+ };
129
+ }
130
+ },
131
+ getPackageLocation(chunk) {
132
+ return requirePlacement().getPackageLocation(chunk);
133
+ },
134
+ getPhysicalChunkId(chunk) {
135
+ return requirePlacement().getPhysicalChunkId(chunk);
136
+ },
137
+ getLoadMode(chunk) {
138
+ return requirePlacement().getLoadMode(chunk);
139
+ },
140
+ getSubpackages() {
141
+ if (state.phase !== 'finalized') {
142
+ throw new Error('wx subpackages are unavailable before output finalization');
143
+ }
144
+ return state.subpackages;
145
+ }
146
+ };
147
+ }
@@ -2,11 +2,10 @@ import { esTarget } from '../../utils/constant.js';
2
2
  import { packageRequire } from '../../utils/packages.js';
3
3
  import { clientTaroNativeId } from '../client/constant.js';
4
4
  import { createWxDevelopmentPlugin } from './dev/plugins.js';
5
- import { getWxExecutionKind, isTransportModule } from './module.js';
5
+ import { getWxExecutionKind, isTransportModule } from './module/module.js';
6
6
  import { compileNativeComponentInterface } from './native/compile-native-component-interface.js';
7
- import { getNativeComponentAssetBytes } from './native/native-component-assets.js';
8
7
  import { createOutputFiles } from './output/files.js';
9
- import { createPlacer } from './placement/placer.js';
8
+ import { createWxPlacementPlugin } from './placer/placer.js';
10
9
  import { renderCapsule } from './render/capsule.js';
11
10
  import { renderNative } from './render/native.js';
12
11
  import { materializeTransport } from './render/transport.js';
@@ -17,15 +16,16 @@ export function createWxTargetPlugins(options) {
17
16
  const resolver = createResolver(options);
18
17
  // Reuse the resolver instance's ordered application subset. Rolldown's complete input also contains bootstrap, transport,
19
18
  // shell, and component entries; entry membership alone cannot recover which roots define the App/Page CSS cascade.
19
+ const placement = createWxPlacementPlugin();
20
20
  return [
21
+ placement,
21
22
  createWxStylePlugins(),
22
- createWxPlugin(options, resolver),
23
+ createWxPlugin(options, resolver, placement),
23
24
  createWxDevelopmentPlugin(options, resolver.applicationEntryIds)
24
25
  ];
25
26
  }
26
27
  /** Configures the complete wx target build pipeline. */
27
- function createWxPlugin(options, resolver) {
28
- const placer = createPlacer();
28
+ function createWxPlugin(options, resolver, placement) {
29
29
  return {
30
30
  name: 'vpt:wx',
31
31
  config(_config, _env) {
@@ -54,7 +54,8 @@ function createWxPlugin(options, resolver) {
54
54
  assetsInlineLimit: 0,
55
55
  target: esTarget,
56
56
  rolldownOptions: {
57
- ...placer.rolldownOptions,
57
+ // The dedicated vpt:wx-placer plugin owns output naming and entry-signature semantics. This plugin owns
58
+ // only the closed named input set of native shells, lifecycle capsules, bootstrap, and transport entries.
58
59
  input: resolver.input
59
60
  }
60
61
  }
@@ -78,16 +79,10 @@ function createWxPlugin(options, resolver) {
78
79
  return resolver.specialize(code, id, sourcemap);
79
80
  }
80
81
  },
81
- renderStart() {
82
- placer.analyze({
83
- moduleIds: this.getModuleIds(),
84
- getModuleInfo: (moduleId) => this.getModuleInfo(moduleId),
85
- getAdditionalModuleBytes: (info) => getNativeComponentAssetBytes(info.meta)
86
- });
87
- },
88
82
  renderChunk: {
89
83
  order: 'post',
90
84
  async handler(code, chunk, outputOptions, meta) {
85
+ // vpt:wx-placer runs first and has already created immutable placement from this complete chunk graph.
91
86
  const executionKind = getWxExecutionKind(chunk);
92
87
  const sourcemap = Boolean(outputOptions.sourcemap);
93
88
  if (executionKind === 'capsule') {
@@ -101,7 +96,8 @@ function createWxPlugin(options, resolver) {
101
96
  code: native.code,
102
97
  transportChunk: chunk,
103
98
  chunks: meta.chunks,
104
- getLoadMode: placer.getLoadMode,
99
+ getLoadMode: placement.getLoadMode,
100
+ getPhysicalChunkId: placement.getPhysicalChunkId,
105
101
  sourcemap
106
102
  });
107
103
  }
@@ -117,12 +113,16 @@ function createWxPlugin(options, resolver) {
117
113
  */
118
114
  order: 'post',
119
115
  async handler(_, bundle) {
120
- const subpackages = placer.getSubpackages(bundle);
116
+ // LTHP joins OutputChunks to their preliminary logical IDs and assigns Rolldown-owned physical filenames.
117
+ // createOutputFiles then observes those paths to relocate native component folders, emit placeholders, and
118
+ // declare only surviving package roots in app.json. No JavaScript chunk is manually emitted or copied.
119
+ const subpackages = placement.getSubpackages();
121
120
  const outputFiles = await createOutputFiles({
122
121
  bundle,
123
122
  options,
124
123
  subpackages,
125
- getModuleInfo: (moduleId) => this.getModuleInfo(moduleId)
124
+ getModuleInfo: (moduleId) => this.getModuleInfo(moduleId),
125
+ getPackageLocation: placement.getPackageLocation
126
126
  });
127
127
  outputFiles.forEach((file) => {
128
128
  this.emitFile(file);
@@ -1,4 +1,36 @@
1
1
  import type { Rolldown } from 'vite';
2
- import { type AstTransformResult } from '../../../utils/transform.ts';
3
- /** Renders one ESM chunk as an inert SystemJS capsule. */
4
- export declare function renderCapsule(code: string, chunk: Rolldown.RenderedChunk, sourcemap?: boolean): AstTransformResult;
2
+ import type { AstTransformResult } from '../../../utils/transform.ts';
3
+ /**
4
+ * Converts one final Rolldown ESM chunk into the inert registration consumed by the WX module runtime.
5
+ *
6
+ * Why this boundary exists:
7
+ *
8
+ * - Rolldown produces an ESM chunk graph, but a Mini Program loads emitted JavaScript through native `require` and
9
+ * `require.async`; it does not provide the browser ESM loader that normally links Vite chunks.
10
+ * - Native App, Page, and Component shells must start through WeChat's synchronous lifecycle APIs, while their application
11
+ * graph still needs ESM linking semantics such as cycles, live exports, dynamic imports, `import.meta`, and top-level await.
12
+ * - The plugin therefore keeps native lifecycle shells as CommonJS and executes application "capsules" through the bundled
13
+ * SystemJS runtime. Native shells enter that graph with `global.System.importSync`, and genuine asynchronous boundaries use
14
+ * the same runtime through `System.import`.
15
+ *
16
+ * What this renderer emits:
17
+ *
18
+ * The result is CommonJS source whose `module.exports` is a SystemJS registration tuple:
19
+ * `[logicalDependencyIds, declaration]`. Requiring a capsule only returns this inert tuple; it does not execute application
20
+ * code or call a global `System.register`. The generated transport can consequently load the physical file from either the
21
+ * main package or a subpackage, then hand its registration to the loader. The loader owns linking, setter invocation,
22
+ * execution order, cycle handling, and export publication.
23
+ *
24
+ * Why references are rewritten:
25
+ *
26
+ * Rolldown imports name physical output files whose relative paths include placement directories and content hashes. The
27
+ * SystemJS registry instead uses package-neutral logical chunk IDs. Canonicalizing both static and literal dynamic references
28
+ * here lets transport independently map a stable module identity to the physical `require` path selected by WX placement.
29
+ * Runtime-computed dynamic IDs cannot be canonicalized and are intentionally preserved.
30
+ *
31
+ * This function runs on final Rolldown output rather than arbitrary source modules. `transformSystemJs` accepts only the
32
+ * normalized final-chunk grammar required by this pipeline and fails the build on unsupported forms instead of risking a
33
+ * partial or semantically incorrect capsule. Source maps remain optional because WX development output deliberately disables
34
+ * them on this startup-critical path.
35
+ */
36
+ export declare function renderCapsule(code: string, chunk: Rolldown.RenderedChunk, sourcemap: boolean): AstTransformResult;
@@ -1,13 +1,54 @@
1
- import transformDynamicImport from '@babel/plugin-transform-dynamic-import';
2
- import transformModulesSystemjs from '@babel/plugin-transform-modules-systemjs';
3
- import { transformWithBabel } from '../../../utils/transform.js';
4
- import { wrapCapsulePlugin } from './capsule-wrapper.js';
5
- /** Renders one ESM chunk as an inert SystemJS capsule. */
6
- export function renderCapsule(code, chunk, sourcemap = true) {
7
- return transformWithBabel(code, chunk.fileName, [
8
- transformDynamicImport,
9
- // Erase Babel's internal plugin pass type.
10
- transformModulesSystemjs,
11
- wrapCapsulePlugin(chunk.fileName)
12
- ], sourcemap);
1
+ import { resolveLogicalChunkReference } from '../module/chunk-path.js';
2
+ import { transformSystemJs } from './system-js/system-js.js';
3
+ /**
4
+ * Converts one final Rolldown ESM chunk into the inert registration consumed by the WX module runtime.
5
+ *
6
+ * Why this boundary exists:
7
+ *
8
+ * - Rolldown produces an ESM chunk graph, but a Mini Program loads emitted JavaScript through native `require` and
9
+ * `require.async`; it does not provide the browser ESM loader that normally links Vite chunks.
10
+ * - Native App, Page, and Component shells must start through WeChat's synchronous lifecycle APIs, while their application
11
+ * graph still needs ESM linking semantics such as cycles, live exports, dynamic imports, `import.meta`, and top-level await.
12
+ * - The plugin therefore keeps native lifecycle shells as CommonJS and executes application "capsules" through the bundled
13
+ * SystemJS runtime. Native shells enter that graph with `global.System.importSync`, and genuine asynchronous boundaries use
14
+ * the same runtime through `System.import`.
15
+ *
16
+ * What this renderer emits:
17
+ *
18
+ * The result is CommonJS source whose `module.exports` is a SystemJS registration tuple:
19
+ * `[logicalDependencyIds, declaration]`. Requiring a capsule only returns this inert tuple; it does not execute application
20
+ * code or call a global `System.register`. The generated transport can consequently load the physical file from either the
21
+ * main package or a subpackage, then hand its registration to the loader. The loader owns linking, setter invocation,
22
+ * execution order, cycle handling, and export publication.
23
+ *
24
+ * Why references are rewritten:
25
+ *
26
+ * Rolldown imports name physical output files whose relative paths include placement directories and content hashes. The
27
+ * SystemJS registry instead uses package-neutral logical chunk IDs. Canonicalizing both static and literal dynamic references
28
+ * here lets transport independently map a stable module identity to the physical `require` path selected by WX placement.
29
+ * Runtime-computed dynamic IDs cannot be canonicalized and are intentionally preserved.
30
+ *
31
+ * This function runs on final Rolldown output rather than arbitrary source modules. `transformSystemJs` accepts only the
32
+ * normalized final-chunk grammar required by this pipeline and fails the build on unsupported forms instead of risking a
33
+ * partial or semantically incorrect capsule. Source maps remain optional because WX development output deliberately disables
34
+ * them on this startup-critical path.
35
+ */
36
+ export function renderCapsule(code, chunk, sourcemap) {
37
+ return transformSystemJs({
38
+ code,
39
+ filename: chunk.fileName,
40
+ // Native require must return registration data without executing or globally registering the capsule.
41
+ format: 'commonjs-registration',
42
+ sourcemap,
43
+ // Bind every compile-time chunk edge to the same logical identity understood by transport and SystemJS.
44
+ resolveReference(reference, kind) {
45
+ return resolveCapsuleReference(chunk.fileName, reference, kind);
46
+ }
47
+ });
48
+ }
49
+ /** Canonicalizes physical chunk paths while preserving runtime-computed and package-like dynamic IDs. */
50
+ function resolveCapsuleReference(fileName, reference, kind) {
51
+ if (kind === 'dynamic' && !reference.startsWith('./') && !reference.startsWith('../'))
52
+ return reference;
53
+ return resolveLogicalChunkReference(fileName, reference);
13
54
  }
@@ -1,6 +1,24 @@
1
1
  import type { Rolldown } from 'vite';
2
- import { type AstTransformResult } from '../../../utils/transform.ts';
3
- /** Renders a native module while activating its statically imported capsules through SystemJS. */
2
+ import type { AstTransformResult } from '../../../utils/transform.ts';
3
+ /**
4
+ * Materializes one final native/amphibious Rolldown chunk as executable WX CommonJS.
5
+ *
6
+ * The transform performs four semantic operations:
7
+ *
8
+ * 1. Static ESM imports are hoisted into source-order `require` calls. Named imports remain property reads from the required
9
+ * namespace so they observe current values. Default and namespace imports receive Babel-compatible CommonJS interop.
10
+ * 2. An import whose target owns a capsule entry is not passed to native `require`. It becomes
11
+ * `global.System.importSync(logicalChunkId)`, synchronously linking the capsule before the native lifecycle call.
12
+ * 3. Local exports are published at declaration and mutation points. Imported re-exports use getters, while assignments and
13
+ * updates notify every alias without changing expression completion values or accidentally matching shadowed bindings.
14
+ * 4. ESM top-level `this` becomes `undefined`. Direct imported calls and tags are explicitly unbound so converting an import
15
+ * into a namespace property does not introduce a false CommonJS receiver.
16
+ *
17
+ * Static dependency loading is emitted before the untouched module body because ESM evaluates dependencies before body
18
+ * statements regardless of where import declarations appear textually. Generated helper names are allocated against every
19
+ * source identifier. Source maps use the same range edits when requested; WX development disables them and keeps this path
20
+ * focused on startup latency.
21
+ */
4
22
  export declare function renderNative({ code, chunk, chunks, sourcemap }: {
5
23
  code: string;
6
24
  chunk: Rolldown.RenderedChunk;