vite-plugin-taro 0.6.18 → 0.6.19

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 (133) hide show
  1. package/client.d.ts +2 -3
  2. package/dist/index.js +213574 -0
  3. package/dist/node/plugins/wx/dev/react-refresh.d.ts +14 -13
  4. package/dist/node/utils/packages.d.ts +2 -0
  5. package/package.json +26 -26
  6. package/dist/node/plugins/client/client-taro.js +0 -59
  7. package/dist/node/plugins/client/constant.js +0 -4
  8. package/dist/node/plugins/client/inject-taro-framework-apis.js +0 -9
  9. package/dist/node/plugins/conditional/conditional-directives.js +0 -76
  10. package/dist/node/plugins/h5/constant.js +0 -3
  11. package/dist/node/plugins/h5/create-stencil-client-adapter.js +0 -94
  12. package/dist/node/plugins/h5/plugins.js +0 -179
  13. package/dist/node/plugins/h5/resolver/module-resolver.js +0 -20
  14. package/dist/node/plugins/h5/transform-app.js +0 -48
  15. package/dist/node/plugins/tailwind/tailwind-css.js +0 -3
  16. package/dist/node/plugins/wx/dev/create-hmr-results-stream.js +0 -57
  17. package/dist/node/plugins/wx/dev/dev-host.js +0 -361
  18. package/dist/node/plugins/wx/dev/hmr-files.js +0 -56
  19. package/dist/node/plugins/wx/dev/host-actions.js +0 -58
  20. package/dist/node/plugins/wx/dev/patch-publisher.js +0 -77
  21. package/dist/node/plugins/wx/dev/plugins.js +0 -164
  22. package/dist/node/plugins/wx/dev/react-refresh.js +0 -231
  23. package/dist/node/plugins/wx/dev/runtime-reports.js +0 -45
  24. package/dist/node/plugins/wx/dev/wx-dev-options.js +0 -178
  25. package/dist/node/plugins/wx/module/chunk-path.js +0 -18
  26. package/dist/node/plugins/wx/module/module.js +0 -79
  27. package/dist/node/plugins/wx/native/compile-native-component-interface.js +0 -30
  28. package/dist/node/plugins/wx/native/create-native-component-output.js +0 -39
  29. package/dist/node/plugins/wx/native/native-component-assets.js +0 -76
  30. package/dist/node/plugins/wx/native/native-component-interface.js +0 -203
  31. package/dist/node/plugins/wx/output/files.js +0 -21
  32. package/dist/node/plugins/wx/output/relative-root.js +0 -6
  33. package/dist/node/plugins/wx/output/templates.js +0 -358
  34. package/dist/node/plugins/wx/placer/placement.js +0 -245
  35. package/dist/node/plugins/wx/placer/placer.js +0 -147
  36. package/dist/node/plugins/wx/plugins.js +0 -152
  37. package/dist/node/plugins/wx/render/capsule.js +0 -54
  38. package/dist/node/plugins/wx/render/native.js +0 -543
  39. package/dist/node/plugins/wx/render/system-js/string-editor.js +0 -94
  40. package/dist/node/plugins/wx/render/system-js/system-js.js +0 -588
  41. package/dist/node/plugins/wx/render/transport.js +0 -103
  42. package/dist/node/plugins/wx/resolve/resolver.js +0 -102
  43. package/dist/node/plugins/wx/resolve/specialize-app-capsule.js +0 -9
  44. package/dist/node/plugins/wx/resolve/specialize-page-capsule.js +0 -11
  45. package/dist/node/plugins/wx/styles/plugins.js +0 -459
  46. package/dist/node/utils/constant.js +0 -1
  47. package/dist/node/utils/memoize.js +0 -86
  48. package/dist/node/utils/modules.js +0 -22
  49. package/dist/node/utils/once.js +0 -20
  50. package/dist/node/utils/oxc-transform.js +0 -57
  51. package/dist/node/utils/packages.js +0 -9
  52. package/dist/node/utils/project-config.js +0 -8
  53. package/dist/node/utils/transform.js +0 -32
  54. package/dist/node/utils/vite.js +0 -10
  55. package/dist/node/vpt.js +0 -15
  56. package/dist/options.js +0 -1
  57. package/dist/vite.js +0 -1
  58. package/src/node/plugins/client/client-taro.ts +0 -71
  59. package/src/node/plugins/client/constant.ts +0 -5
  60. package/src/node/plugins/client/inject-taro-framework-apis.ts +0 -11
  61. package/src/node/plugins/conditional/conditional-directives.ts +0 -94
  62. package/src/node/plugins/h5/constant.ts +0 -4
  63. package/src/node/plugins/h5/create-stencil-client-adapter.ts +0 -111
  64. package/src/node/plugins/h5/plugins.ts +0 -194
  65. package/src/node/plugins/h5/resolver/module-resolver.ts +0 -33
  66. package/src/node/plugins/h5/transform-app.ts +0 -90
  67. package/src/node/plugins/tailwind/tailwind-css.ts +0 -4
  68. package/src/node/plugins/wx/dev/create-hmr-results-stream.ts +0 -71
  69. package/src/node/plugins/wx/dev/dev-host.ts +0 -453
  70. package/src/node/plugins/wx/dev/hmr-files.ts +0 -80
  71. package/src/node/plugins/wx/dev/host-actions.ts +0 -88
  72. package/src/node/plugins/wx/dev/patch-publisher.ts +0 -92
  73. package/src/node/plugins/wx/dev/plugins.ts +0 -176
  74. package/src/node/plugins/wx/dev/react-refresh.ts +0 -253
  75. package/src/node/plugins/wx/dev/runtime-reports.ts +0 -70
  76. package/src/node/plugins/wx/dev/wx-dev-options.ts +0 -226
  77. package/src/node/plugins/wx/module/chunk-path.ts +0 -22
  78. package/src/node/plugins/wx/module/module.ts +0 -110
  79. package/src/node/plugins/wx/native/compile-native-component-interface.ts +0 -48
  80. package/src/node/plugins/wx/native/create-native-component-output.ts +0 -60
  81. package/src/node/plugins/wx/native/native-component-assets.ts +0 -113
  82. package/src/node/plugins/wx/native/native-component-interface.ts +0 -267
  83. package/src/node/plugins/wx/output/files.ts +0 -40
  84. package/src/node/plugins/wx/output/relative-root.ts +0 -7
  85. package/src/node/plugins/wx/output/templates.ts +0 -448
  86. package/src/node/plugins/wx/placer/placement.ts +0 -364
  87. package/src/node/plugins/wx/placer/placer.ts +0 -180
  88. package/src/node/plugins/wx/plugins.ts +0 -183
  89. package/src/node/plugins/wx/render/capsule.ts +0 -57
  90. package/src/node/plugins/wx/render/native.ts +0 -694
  91. package/src/node/plugins/wx/render/system-js/string-editor.ts +0 -116
  92. package/src/node/plugins/wx/render/system-js/system-js.ts +0 -821
  93. package/src/node/plugins/wx/render/transport.ts +0 -173
  94. package/src/node/plugins/wx/resolve/resolver.ts +0 -145
  95. package/src/node/plugins/wx/resolve/specialize-app-capsule.ts +0 -27
  96. package/src/node/plugins/wx/resolve/specialize-page-capsule.ts +0 -29
  97. package/src/node/plugins/wx/styles/plugins.ts +0 -595
  98. package/src/node/utils/constant.ts +0 -1
  99. package/src/node/utils/memoize.ts +0 -149
  100. package/src/node/utils/modules.ts +0 -37
  101. package/src/node/utils/once.ts +0 -21
  102. package/src/node/utils/oxc-transform.ts +0 -76
  103. package/src/node/utils/packages.ts +0 -11
  104. package/src/node/utils/project-config.ts +0 -10
  105. package/src/node/utils/transform.ts +0 -48
  106. package/src/node/utils/vite.ts +0 -22
  107. package/src/node/vpt.ts +0 -18
  108. package/src/options.ts +0 -82
  109. package/src/runtime/client/taro/api.ts +0 -11
  110. package/src/runtime/client/taro/component.ts +0 -1
  111. package/src/runtime/client/taro/define-native-component.ts +0 -15
  112. package/src/runtime/h5/app.ts +0 -25
  113. package/src/runtime/h5/taro-css.d.ts +0 -3
  114. package/src/runtime/h5/taro-runtime.ts +0 -7
  115. package/src/runtime/wx/amphibious/bootstrap.ts +0 -17
  116. package/src/runtime/wx/amphibious/transport.ts +0 -8
  117. package/src/runtime/wx/capsule/app.ts +0 -12
  118. package/src/runtime/wx/capsule/component.ts +0 -7
  119. package/src/runtime/wx/capsule/page.ts +0 -29
  120. package/src/runtime/wx/capsule/taro-runtime.ts +0 -8
  121. package/src/runtime/wx/dev/dev-runtime.ts +0 -464
  122. package/src/runtime/wx/native/app.ts +0 -4
  123. package/src/runtime/wx/native/component.ts +0 -4
  124. package/src/runtime/wx/native/custom-wrapper.ts +0 -4
  125. package/src/runtime/wx/native/page.ts +0 -6
  126. package/src/runtime/wx/systemjs/LICENSE +0 -10
  127. package/src/runtime/wx/systemjs/system-core.js +0 -370
  128. package/src/runtime/wx/systemjs/system.d.ts +0 -55
  129. package/src/runtime/wx/wechat.d.ts +0 -56
  130. package/src/vite.ts +0 -2
  131. /package/dist/{vite.d.ts → index.d.ts} +0 -0
  132. /package/dist/runtime/client/taro/{define-native-component.d.ts → native.d.ts} +0 -0
  133. /package/dist/runtime/client/taro/{define-native-component.js → native.js} +0 -0
@@ -1,116 +0,0 @@
1
- /** One half-open source range replaced atomically during rendering. */
2
- type Replacement = Readonly<{
3
- content: string
4
- end: number
5
- start: number
6
- }>
7
-
8
- /** Ordered zero-width edits attached to one source boundary. */
9
- type Insertions = Readonly<{
10
- append: string[]
11
- prepend: string[]
12
- }>
13
-
14
- /**
15
- * Records non-overlapping range edits and renders them in one source-order pass.
16
- *
17
- * Final WX development chunks do not request source maps. RolldownMagicString's repeated relocation of hundreds of hoisted
18
- * functions is considerably more expensive than the semantic analysis itself, so this editor keeps the same range operations
19
- * while avoiding a mutable chunk graph when no mappings can be observed.
20
- */
21
- export class StringEditor {
22
- readonly original: string
23
- // These journals are the editor's intentionally mutable transaction; rendering reads but never changes them.
24
- readonly #insertions = new Map<number, Insertions>()
25
- readonly #replacements: Replacement[] = []
26
-
27
- constructor(original: string) {
28
- this.original = original
29
- }
30
-
31
- /** Records a half-open replacement; semantic passes guarantee ranges are nested or disjoint. */
32
- overwrite(start: number, end: number, content: string): void {
33
- this.#replacements.push({ content, end, start })
34
- }
35
-
36
- /** Removes a range and discards insertions that were owned only by that removed source. */
37
- remove(start: number, end: number): void {
38
- this.overwrite(start, end, '')
39
- // Removed ranges own their boundary insertions; hoisted function text has already rendered those edits separately.
40
- for (const position of this.#insertions.keys()) {
41
- if (position >= start && position <= end) this.#insertions.delete(position)
42
- }
43
- }
44
-
45
- /** Inserts before prior insertions at a boundary, matching MagicString's prependLeft ordering. */
46
- prependLeft(position: number, content: string): void {
47
- const insertions = this.#insertionAt(position)
48
- insertions.prepend.unshift(content)
49
- }
50
-
51
- /** Inserts after prior insertions at the left side of a boundary. */
52
- appendLeft(position: number, content: string): void {
53
- const insertions = this.#insertionAt(position)
54
- insertions.append.push(content)
55
- }
56
-
57
- /** Matches the subset of appendRight ordering used by the capsule compiler. */
58
- appendRight(position: number, content: string): void {
59
- const insertions = this.#insertionAt(position)
60
- insertions.append.push(content)
61
- }
62
-
63
- /** Materializes one source slice without mutating its edit journal, allowing functions to be rendered before relocation. */
64
- render(start: number, end: number): string {
65
- const replacements = this.#replacements
66
- .filter((replacement) => replacement.start >= start && replacement.end <= end)
67
- .sort((left, right) => left.start - right.start || right.end - left.end)
68
- // The cursor advances monotonically; outer removals dominate nested edits when hoisted function ranges are removed.
69
- let sourcePosition = start
70
- let output = ''
71
-
72
- for (const replacement of replacements) {
73
- if (replacement.end <= sourcePosition) continue
74
- if (replacement.start < sourcePosition) {
75
- throw new Error(`Partially overlapping source edits at ${replacement.start}:${replacement.end}`)
76
- }
77
- output += this.#renderOriginal(sourcePosition, replacement.start, false)
78
- output += replacement.content
79
- sourcePosition = replacement.end
80
- }
81
-
82
- output += this.#renderOriginal(sourcePosition, end, true)
83
- return output
84
- }
85
-
86
- #insertionAt(position: number): { append: string[]; prepend: string[] } {
87
- const existing = this.#insertions.get(position)
88
- if (existing) return existing
89
- // Each position owns mutable ordered lists because prependLeft reverses calls while appendRight preserves them.
90
- const created = { append: [], prepend: [] }
91
- this.#insertions.set(position, created)
92
- return created
93
- }
94
-
95
- #renderOriginal(start: number, end: number, includeEnd: boolean): string {
96
- const positions = [...this.#insertions.keys()]
97
- .filter((position) => position >= start && (position < end || (includeEnd && position === end)))
98
- .sort((left, right) => left - right)
99
- // Segment rendering appends immutable source slices around the small ordered insertion set.
100
- let sourcePosition = start
101
- let output = ''
102
- for (const position of positions) {
103
- output += this.original.slice(sourcePosition, position)
104
- output += this.#renderInsertions(position)
105
- sourcePosition = position
106
- }
107
- output += this.original.slice(sourcePosition, end)
108
- return output
109
- }
110
-
111
- #renderInsertions(position: number): string {
112
- // Callers enumerate this map's keys, so the matching insertion journal is guaranteed to exist.
113
- const insertions = this.#insertions.get(position) as Insertions
114
- return `${insertions.prepend.join('')}${insertions.append.join('')}`
115
- }
116
- }