@spcsn/taro-mini-runner 1.0.0

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/README.md +103 -0
  2. package/dist/entrypoints/mini-runner.d.ts +2 -0
  3. package/dist/entrypoints/mini-runner.js +96 -0
  4. package/dist/entrypoints/mini-runner.js.map +1 -0
  5. package/dist/index.d.ts +5 -0
  6. package/dist/index.js +9 -0
  7. package/dist/index.js.map +1 -0
  8. package/dist/mini-program/config.d.ts +3 -0
  9. package/dist/mini-program/config.js +237 -0
  10. package/dist/mini-program/config.js.map +1 -0
  11. package/dist/mini-program/default-config.d.ts +3 -0
  12. package/dist/mini-program/default-config.js +49 -0
  13. package/dist/mini-program/default-config.js.map +1 -0
  14. package/dist/mini-program/emit.d.ts +3 -0
  15. package/dist/mini-program/emit.js +247 -0
  16. package/dist/mini-program/emit.js.map +1 -0
  17. package/dist/mini-program/entry.d.ts +3 -0
  18. package/dist/mini-program/entry.js +142 -0
  19. package/dist/mini-program/entry.js.map +1 -0
  20. package/dist/mini-program/index.d.ts +3 -0
  21. package/dist/mini-program/index.js +29 -0
  22. package/dist/mini-program/index.js.map +1 -0
  23. package/dist/mini-program/native-support.d.ts +6 -0
  24. package/dist/mini-program/native-support.js +160 -0
  25. package/dist/mini-program/native-support.js.map +1 -0
  26. package/dist/mini-program/page.d.ts +4 -0
  27. package/dist/mini-program/page.js +223 -0
  28. package/dist/mini-program/page.js.map +1 -0
  29. package/dist/mini-program/pipeline.d.ts +3 -0
  30. package/dist/mini-program/pipeline.js +46 -0
  31. package/dist/mini-program/pipeline.js.map +1 -0
  32. package/dist/mini-program/postcss.d.ts +6 -0
  33. package/dist/mini-program/postcss.js +26 -0
  34. package/dist/mini-program/postcss.js.map +1 -0
  35. package/dist/mini-program/style.d.ts +3 -0
  36. package/dist/mini-program/style.js +67 -0
  37. package/dist/mini-program/style.js.map +1 -0
  38. package/dist/plugins/rollup-plugin-increment.d.ts +8 -0
  39. package/dist/plugins/rollup-plugin-increment.js +52 -0
  40. package/dist/plugins/rollup-plugin-increment.js.map +1 -0
  41. package/dist/plugins/vite-plugin-assets.d.ts +3 -0
  42. package/dist/plugins/vite-plugin-assets.js +135 -0
  43. package/dist/plugins/vite-plugin-assets.js.map +1 -0
  44. package/dist/plugins/vite-plugin-multi-platform.d.ts +3 -0
  45. package/dist/plugins/vite-plugin-multi-platform.js +71 -0
  46. package/dist/plugins/vite-plugin-multi-platform.js.map +1 -0
  47. package/dist/react-framework/index.d.ts +27 -0
  48. package/dist/react-framework/index.js +36 -0
  49. package/dist/react-framework/index.js.map +1 -0
  50. package/dist/react-framework/loader-meta.d.ts +3 -0
  51. package/dist/react-framework/loader-meta.js +151 -0
  52. package/dist/react-framework/loader-meta.js.map +1 -0
  53. package/dist/react-framework/runtime/connect-native.d.ts +10 -0
  54. package/dist/react-framework/runtime/connect-native.js +392 -0
  55. package/dist/react-framework/runtime/connect-native.js.map +1 -0
  56. package/dist/react-framework/runtime/connect.d.ts +14 -0
  57. package/dist/react-framework/runtime/connect.js +313 -0
  58. package/dist/react-framework/runtime/connect.js.map +1 -0
  59. package/dist/react-framework/runtime/hooks.d.ts +30 -0
  60. package/dist/react-framework/runtime/hooks.js +87 -0
  61. package/dist/react-framework/runtime/hooks.js.map +1 -0
  62. package/dist/react-framework/runtime/index.d.ts +3 -0
  63. package/dist/react-framework/runtime/index.js +49 -0
  64. package/dist/react-framework/runtime/index.js.map +1 -0
  65. package/dist/react-framework/runtime/react-meta.d.ts +7 -0
  66. package/dist/react-framework/runtime/react-meta.js +9 -0
  67. package/dist/react-framework/runtime/react-meta.js.map +1 -0
  68. package/dist/react-framework/runtime/utils.d.ts +13 -0
  69. package/dist/react-framework/runtime/utils.js +45 -0
  70. package/dist/react-framework/runtime/utils.js.map +1 -0
  71. package/dist/react-framework/vite.mini.d.ts +3 -0
  72. package/dist/react-framework/vite.mini.js +135 -0
  73. package/dist/react-framework/vite.mini.js.map +1 -0
  74. package/dist/react-runtime/component-tree.d.ts +19 -0
  75. package/dist/react-runtime/component-tree.js +65 -0
  76. package/dist/react-runtime/component-tree.js.map +1 -0
  77. package/dist/react-runtime/constant.d.ts +7 -0
  78. package/dist/react-runtime/constant.js +78 -0
  79. package/dist/react-runtime/constant.js.map +1 -0
  80. package/dist/react-runtime/dom-input.d.ts +12 -0
  81. package/dist/react-runtime/dom-input.js +86 -0
  82. package/dist/react-runtime/dom-input.js.map +1 -0
  83. package/dist/react-runtime/event.d.ts +13 -0
  84. package/dist/react-runtime/event.js +83 -0
  85. package/dist/react-runtime/event.js.map +1 -0
  86. package/dist/react-runtime/index.d.ts +33 -0
  87. package/dist/react-runtime/index.js +75 -0
  88. package/dist/react-runtime/index.js.map +1 -0
  89. package/dist/react-runtime/input-value-tracking.d.ts +3 -0
  90. package/dist/react-runtime/input-value-tracking.js +84 -0
  91. package/dist/react-runtime/input-value-tracking.js.map +1 -0
  92. package/dist/react-runtime/props.d.ts +7 -0
  93. package/dist/react-runtime/props.js +153 -0
  94. package/dist/react-runtime/props.js.map +1 -0
  95. package/dist/react-runtime/reconciler.d.ts +5 -0
  96. package/dist/react-runtime/reconciler.js +217 -0
  97. package/dist/react-runtime/reconciler.js.map +1 -0
  98. package/dist/react-runtime/render.d.ts +25 -0
  99. package/dist/react-runtime/render.js +97 -0
  100. package/dist/react-runtime/render.js.map +1 -0
  101. package/dist/react-runtime/work-tags.d.ts +26 -0
  102. package/dist/react-runtime/work-tags.js +29 -0
  103. package/dist/react-runtime/work-tags.js.map +1 -0
  104. package/dist/shared/compiler/base.d.ts +41 -0
  105. package/dist/shared/compiler/base.js +170 -0
  106. package/dist/shared/compiler/base.js.map +1 -0
  107. package/dist/shared/compiler/mini.d.ts +20 -0
  108. package/dist/shared/compiler/mini.js +147 -0
  109. package/dist/shared/compiler/mini.js.map +1 -0
  110. package/dist/shared/component.d.ts +2 -0
  111. package/dist/shared/component.js +21 -0
  112. package/dist/shared/component.js.map +1 -0
  113. package/dist/shared/constants.d.ts +47 -0
  114. package/dist/shared/constants.js +51 -0
  115. package/dist/shared/constants.js.map +1 -0
  116. package/dist/shared/create-filter.d.ts +7 -0
  117. package/dist/shared/create-filter.js +97 -0
  118. package/dist/shared/create-filter.js.map +1 -0
  119. package/dist/shared/html.d.ts +1 -0
  120. package/dist/shared/html.js +19 -0
  121. package/dist/shared/html.js.map +1 -0
  122. package/dist/shared/index.d.ts +39 -0
  123. package/dist/shared/index.js +258 -0
  124. package/dist/shared/index.js.map +1 -0
  125. package/dist/shared/logger.d.ts +7 -0
  126. package/dist/shared/logger.js +146 -0
  127. package/dist/shared/logger.js.map +1 -0
  128. package/dist/shared/map.d.ts +11 -0
  129. package/dist/shared/map.js +41 -0
  130. package/dist/shared/map.js.map +1 -0
  131. package/dist/shared/profile.d.ts +9 -0
  132. package/dist/shared/profile.js +52 -0
  133. package/dist/shared/profile.js.map +1 -0
  134. package/dist/shared/rollup.d.ts +8 -0
  135. package/dist/shared/rollup.js +40 -0
  136. package/dist/shared/rollup.js.map +1 -0
  137. package/dist/shared/runner/constant.d.ts +5 -0
  138. package/dist/shared/runner/constant.js +53 -0
  139. package/dist/shared/runner/constant.js.map +1 -0
  140. package/dist/shared/runner/index.d.ts +2 -0
  141. package/dist/shared/runner/index.js +19 -0
  142. package/dist/shared/runner/index.js.map +1 -0
  143. package/dist/shared/runner/vite.d.ts +3 -0
  144. package/dist/shared/runner/vite.js +10 -0
  145. package/dist/shared/runner/vite.js.map +1 -0
  146. package/dist/style-transforms/html-transform.d.ts +14 -0
  147. package/dist/style-transforms/html-transform.js +124 -0
  148. package/dist/style-transforms/html-transform.js.map +1 -0
  149. package/dist/style-transforms/px-transform.d.ts +40 -0
  150. package/dist/style-transforms/px-transform.js +252 -0
  151. package/dist/style-transforms/px-transform.js.map +1 -0
  152. package/dist/templates/comp.js +5 -0
  153. package/dist/templates/custom-wrapper.js +5 -0
  154. package/package.json +67 -0
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UniqueKeyMap = void 0;
4
+ const lodash_1 = require("lodash");
5
+ class UniqueKeyMap {
6
+ store;
7
+ counters;
8
+ constructor() {
9
+ this.store = new Map();
10
+ this.counters = new Map();
11
+ }
12
+ add(key, value) {
13
+ if (!this.store.has(key)) {
14
+ this.store.set(key, value);
15
+ return key;
16
+ }
17
+ else if ((0, lodash_1.isEqual)(this.store.get(key), value)) {
18
+ return key;
19
+ }
20
+ let counter = this.counters.get(key) || 1;
21
+ let newKey = `${key}_${counter++}`;
22
+ while (this.store.has(newKey)) {
23
+ newKey = `${key}_${counter++}`;
24
+ }
25
+ this.counters.set(key, counter);
26
+ this.store.set(newKey, value);
27
+ return newKey;
28
+ }
29
+ get(key) {
30
+ return this.store.get(key);
31
+ }
32
+ has(key) {
33
+ return this.store.has(key);
34
+ }
35
+ // 获取所有存储的内容
36
+ getAll() {
37
+ return Object.fromEntries(this.store);
38
+ }
39
+ }
40
+ exports.UniqueKeyMap = UniqueKeyMap;
41
+ //# sourceMappingURL=map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map.js","sourceRoot":"","sources":["../../src/shared/map.ts"],"names":[],"mappings":";;;AAAA,mCAAiC;AAEjC,MAAa,YAAY;IACvB,KAAK,CAAiB;IACtB,QAAQ,CAAsB;IAE9B;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,EAAE,CAAC;IAC5B,CAAC;IAED,GAAG,CAAC,GAAW,EAAE,KAAQ;QACvB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACzB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAC3B,OAAO,GAAG,CAAC;QACb,CAAC;aAAM,IAAI,IAAA,gBAAO,EAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;YAC/C,OAAO,GAAG,CAAC;QACb,CAAC;QAED,IAAI,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,MAAM,GAAG,GAAG,GAAG,IAAI,OAAO,EAAE,EAAE,CAAC;QAEnC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9B,MAAM,GAAG,GAAG,GAAG,IAAI,OAAO,EAAE,EAAE,CAAC;QACjC,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAChC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC9B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;IAED,YAAY;IACZ,MAAM;QACJ,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;CACF;AAzCD,oCAyCC"}
@@ -0,0 +1,9 @@
1
+ export declare class BuildProfiler {
2
+ private readonly enabled;
3
+ private entries;
4
+ start(): number;
5
+ end(name: string, startMs: number): void;
6
+ measure<T>(name: string, task: () => Promise<T>): Promise<T>;
7
+ print(): void;
8
+ }
9
+ export declare const buildProfiler: BuildProfiler;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildProfiler = exports.BuildProfiler = void 0;
4
+ function isProfileEnabled() {
5
+ const rawValue = process.env.TARO_PROFILE;
6
+ if (!rawValue)
7
+ return false;
8
+ return !['0', 'false', 'off', 'no'].includes(rawValue.toLowerCase());
9
+ }
10
+ function nowMs() {
11
+ return Number(process.hrtime.bigint()) / 1_000_000;
12
+ }
13
+ function formatDuration(durationMs) {
14
+ return `${durationMs.toFixed(1)}ms`;
15
+ }
16
+ class BuildProfiler {
17
+ enabled = isProfileEnabled();
18
+ entries = [];
19
+ start() {
20
+ return this.enabled ? nowMs() : 0;
21
+ }
22
+ end(name, startMs) {
23
+ if (!this.enabled)
24
+ return;
25
+ this.entries.push({
26
+ name,
27
+ durationMs: nowMs() - startMs,
28
+ });
29
+ }
30
+ async measure(name, task) {
31
+ const startMs = this.start();
32
+ try {
33
+ return await task();
34
+ }
35
+ finally {
36
+ this.end(name, startMs);
37
+ }
38
+ }
39
+ print() {
40
+ if (!this.enabled || this.entries.length === 0)
41
+ return;
42
+ const nameWidth = Math.max(...this.entries.map((entry) => entry.name.length));
43
+ const lines = this.entries.map((entry) => {
44
+ return ` ${entry.name.padEnd(nameWidth)} ${formatDuration(entry.durationMs)}`;
45
+ });
46
+ console.info(['[taro:profile] build timings', ...lines].join('\n'));
47
+ this.entries = [];
48
+ }
49
+ }
50
+ exports.BuildProfiler = BuildProfiler;
51
+ exports.buildProfiler = new BuildProfiler();
52
+ //# sourceMappingURL=profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/shared/profile.ts"],"names":[],"mappings":";;;AAKA,SAAS,gBAAgB;IACvB,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IAC1C,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE5B,OAAO,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;AACvE,CAAC;AAED,SAAS,KAAK;IACZ,OAAO,MAA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AAO,KAAK,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC;QAClF,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,IAAI,CAAC,CAAC,8BAA8B,EAAE,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QACpE,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACpB,CAAC;CACF;AArCD,sCAqCC;AAEY,QAAA,aAAa,GAAG,IAAI,aAAa,EAAE,CAAC"}
@@ -0,0 +1,8 @@
1
+ type InternalModuleFormat = 'amd' | 'cjs' | 'es' | 'iife' | 'system' | 'umd';
2
+ export declare const getResolveUrl: (path: string, URL?: string) => string;
3
+ export declare const getGenericImportMetaMechanism: (getUrl: (chunkId: string) => string) => (property: string | null, { chunkId }: {
4
+ chunkId: string;
5
+ }) => string;
6
+ export declare const getUrlFromDocument: (chunkId: string, umd?: boolean) => string;
7
+ export declare const relativeUrlMechanisms: Record<InternalModuleFormat, (relativePath: string) => string>;
8
+ export {};
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.relativeUrlMechanisms = exports.getUrlFromDocument = exports.getGenericImportMetaMechanism = exports.getResolveUrl = void 0;
4
+ const _1 = require(".");
5
+ /*
6
+ The following functions are copied from rollup
7
+ https://github.com/rollup/rollup/blob/0bcf0a672ac087ff2eb88fbba45ec62389a4f45f/src/ast/nodes/MetaProperty.ts#L145-L193
8
+
9
+ https://github.com/rollup/rollup
10
+ The MIT License (MIT)
11
+ Copyright (c) 2017 [these people](https://github.com/rollup/rollup/graphs/contributors)
12
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
13
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15
+ */
16
+ const getResolveUrl = (path, URL = 'URL') => `new ${URL}(${path}).href`;
17
+ exports.getResolveUrl = getResolveUrl;
18
+ const getRelativeUrlFromDocument = (relativePath, umd = false) => (0, exports.getResolveUrl)(`'${(0, _1.escapeId)(relativePath)}', ${umd ? `typeof document === 'undefined' ? location.href : ` : ''}document.currentScript && document.currentScript.src || document.baseURI`);
19
+ const getGenericImportMetaMechanism = (getUrl) => (property, { chunkId }) => {
20
+ const urlMechanism = getUrl(chunkId);
21
+ return property === null ? `({ url: ${urlMechanism} })` : property === 'url' ? urlMechanism : 'undefined';
22
+ };
23
+ exports.getGenericImportMetaMechanism = getGenericImportMetaMechanism;
24
+ const getFileUrlFromFullPath = (path) => `require('u' + 'rl').pathToFileURL(${path}).href`;
25
+ const getFileUrlFromRelativePath = (path) => getFileUrlFromFullPath(`__dirname + '/${path}'`);
26
+ const getUrlFromDocument = (chunkId, umd = false) => `${umd ? `typeof document === 'undefined' ? location.href : ` : ''}(document.currentScript && document.currentScript.src || new URL('${(0, _1.escapeId)(chunkId)}', document.baseURI).href)`;
27
+ exports.getUrlFromDocument = getUrlFromDocument;
28
+ exports.relativeUrlMechanisms = {
29
+ amd: (relativePath) => {
30
+ if (relativePath[0] !== '.')
31
+ relativePath = './' + relativePath;
32
+ return (0, exports.getResolveUrl)(`require.toUrl('${relativePath}'), document.baseURI`);
33
+ },
34
+ cjs: (relativePath) => `(typeof document === 'undefined' ? ${getFileUrlFromRelativePath(relativePath)} : ${getRelativeUrlFromDocument(relativePath)})`,
35
+ es: (relativePath) => (0, exports.getResolveUrl)(`'${relativePath}', import.meta.url`),
36
+ iife: (relativePath) => getRelativeUrlFromDocument(relativePath),
37
+ system: (relativePath) => (0, exports.getResolveUrl)(`'${relativePath}', module.meta.url`),
38
+ umd: (relativePath) => `(typeof document === 'undefined' && typeof location === 'undefined' ? ${getFileUrlFromRelativePath(relativePath)} : ${getRelativeUrlFromDocument(relativePath, true)})`,
39
+ };
40
+ //# sourceMappingURL=rollup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollup.js","sourceRoot":"","sources":["../../src/shared/rollup.ts"],"names":[],"mappings":";;;AAAA,wBAA6B;AAI7B;;;;;;;;;;EAUE;AACK,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,GAAG,GAAG,KAAK,EAAE,EAAE,CAAC,OAAO,GAAG,IAAI,IAAI,QAAQ,CAAC;AAA1E,QAAA,aAAa,iBAA6D;AAEvF,MAAM,0BAA0B,GAAG,CAAC,YAAoB,EAAE,GAAG,GAAG,KAAK,EAAE,EAAE,CACvE,IAAA,qBAAa,EACX,IAAI,IAAA,WAAQ,EAAC,YAAY,CAAC,MACxB,GAAG,CAAC,CAAC,CAAC,oDAAoD,CAAC,CAAC,CAAC,EAC/D,0EAA0E,CAC3E,CAAC;AAEG,MAAM,6BAA6B,GACxC,CAAC,MAAmC,EAAE,EAAE,CACxC,CAAC,QAAuB,EAAE,EAAE,OAAO,EAAuB,EAAE,EAAE;IAC5D,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IACrC,OAAO,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,WAAW,YAAY,KAAK,CAAC,CAAC,CAAC,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAA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AG;CAC3D,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const DEFAULT_Components: Set<string>;
2
+ export declare const VITE_COMPILER_LABEL = "taro:compiler";
3
+ export declare const IMAGE_LIMIT: number;
4
+ export declare const FONT_LIMIT: number;
5
+ export declare const MEDIA_LIMIT: number;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MEDIA_LIMIT = exports.FONT_LIMIT = exports.IMAGE_LIMIT = exports.VITE_COMPILER_LABEL = exports.DEFAULT_Components = void 0;
4
+ exports.DEFAULT_Components = new Set([
5
+ 'view',
6
+ 'scroll-view',
7
+ 'swiper',
8
+ 'cover-view',
9
+ 'cover-image',
10
+ 'icon',
11
+ 'text',
12
+ 'rich-text',
13
+ 'progress',
14
+ 'button',
15
+ 'checkbox',
16
+ 'form',
17
+ 'input',
18
+ 'label',
19
+ 'picker',
20
+ 'picker-view',
21
+ 'picker-view-column',
22
+ 'radio',
23
+ 'radio-group',
24
+ 'checkbox-group',
25
+ 'slider',
26
+ 'switch',
27
+ 'textarea',
28
+ 'navigator',
29
+ 'audio',
30
+ 'image',
31
+ 'video',
32
+ 'camera',
33
+ 'live-player',
34
+ 'live-pusher',
35
+ 'map',
36
+ 'canvas',
37
+ 'open-data',
38
+ 'web-view',
39
+ 'swiper-item',
40
+ 'movable-area',
41
+ 'movable-view',
42
+ 'functional-page-navigator',
43
+ 'ad',
44
+ 'block',
45
+ 'import',
46
+ 'official-account',
47
+ 'editor',
48
+ ]);
49
+ exports.VITE_COMPILER_LABEL = 'taro:compiler';
50
+ exports.IMAGE_LIMIT = 2 * 1024;
51
+ exports.FONT_LIMIT = 10 * 1024;
52
+ exports.MEDIA_LIMIT = 10 * 1024;
53
+ //# sourceMappingURL=constant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constant.js","sourceRoot":"","sources":["../../../src/shared/runner/constant.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG,IAAI,GAAG,CAAS;IAChD,MAAM;IACN,aAAa;IACb,QAAQ;IACR,YAAY;IACZ,aAAa;IACb,MAAM;IACN,MAAM;IACN,WAAW;IACX,UAAU;IACV,QAAQ;IACR,UAAU;IACV,MAAM;IACN,OAAO;IACP,OAAO;IACP,QAAQ;IACR,aAAa;IACb,oBAAoB;IACpB,OAAO;IACP,aAAa;IACb,gBAAgB;IAChB,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,WAAW;IACX,OAAO;IACP,OAAO;IACP,OAAO;IACP,QAAQ;IACR,aAAa;IACb,aAAa;IACb,KAAK;IACL,QAAQ;IACR,WAAW;IACX,UAAU;IACV,aAAa;IACb,cAAc;IACd,cAAc;IACd,2BAA2B;IAC3B,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,kBAAkB;IAClB,QAAQ;CACT,CAAC,CAAC;AAEU,QAAA,mBAAmB,GAAG,eAAe,CAAC;AAEtC,QAAA,WAAW,GAAG,CAAC,GAAG,IAAI,CAAC;AACvB,QAAA,UAAU,GAAG,EAAE,GAAG,IAAI,CAAC;AACvB,QAAA,WAAW,GAAG,EAAE,GAAG,IAAI,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './constant';
2
+ export * from './vite';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./constant"), exports);
18
+ __exportStar(require("./vite"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/runner/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,yCAAuB"}
@@ -0,0 +1,3 @@
1
+ import type { ViteMiniCompilerContext } from '@spcsn/taro/types/compile/viteCompilerContext';
2
+ import type { Rolldown } from 'vite';
3
+ export declare function getViteMiniCompilerContext(rollupPluginContext: Rolldown.PluginContext): ViteMiniCompilerContext | void;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getViteMiniCompilerContext = getViteMiniCompilerContext;
4
+ const constant_1 = require("./constant");
5
+ function getViteMiniCompilerContext(rollupPluginContext) {
6
+ const info = rollupPluginContext.getModuleInfo(constant_1.VITE_COMPILER_LABEL);
7
+ const compiler = info?.meta.viteCompilerContext;
8
+ return compiler;
9
+ }
10
+ //# sourceMappingURL=vite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.js","sourceRoot":"","sources":["../../../src/shared/runner/vite.ts"],"names":[],"mappings":";;AAKA,gEAMC;AAXD,yCAAiD;AAKjD,SAAgB,0BAA0B,CACxC,mBAA2C;IAE3C,MAAM,IAAI,GAAG,mBAAmB,CAAC,aAAa,CAAC,8BAAmB,CAAC,CAAC;IACpE,MAAM,QAAQ,GAAG,IAAI,EAAE,IAAI,CAAC,mBAAmB,CAAC;IAChD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { Rule } from 'postcss';
2
+ interface Options {
3
+ platform?: string;
4
+ removeCursorStyle?: boolean;
5
+ }
6
+ declare const postcssHtmlTransform: {
7
+ (options?: Options): {
8
+ postcssPlugin: string;
9
+ Rule(rule: Rule): void;
10
+ Declaration(decl: any): void;
11
+ };
12
+ postcss: boolean;
13
+ };
14
+ export default postcssHtmlTransform;
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const htmlTags = [
4
+ 'html',
5
+ 'body',
6
+ 'a',
7
+ 'audio',
8
+ 'button',
9
+ 'canvas',
10
+ 'form',
11
+ 'iframe',
12
+ 'img',
13
+ 'input',
14
+ 'label',
15
+ 'progress',
16
+ 'select',
17
+ 'slot',
18
+ 'textarea',
19
+ 'video',
20
+ 'abbr',
21
+ 'area',
22
+ 'b',
23
+ 'bdi',
24
+ 'big',
25
+ 'br',
26
+ 'cite',
27
+ 'code',
28
+ 'data',
29
+ 'datalist',
30
+ 'del',
31
+ 'dfn',
32
+ 'em',
33
+ 'i',
34
+ 'ins',
35
+ 'kbd',
36
+ 'map',
37
+ 'mark',
38
+ 'meter',
39
+ 'output',
40
+ 'picture',
41
+ 'q',
42
+ 's',
43
+ 'samp',
44
+ 'small',
45
+ 'span',
46
+ 'strong',
47
+ 'sub',
48
+ 'sup',
49
+ 'td',
50
+ 'template',
51
+ 'th',
52
+ 'time',
53
+ 'tt',
54
+ 'u',
55
+ 'var',
56
+ 'wbr',
57
+ 'address',
58
+ 'article',
59
+ 'aside',
60
+ 'blockquote',
61
+ 'caption',
62
+ 'dd',
63
+ 'details',
64
+ 'dialog',
65
+ 'div',
66
+ 'dl',
67
+ 'dt',
68
+ 'fieldset',
69
+ 'figcaption',
70
+ 'figure',
71
+ 'footer',
72
+ 'h1',
73
+ 'h2',
74
+ 'h3',
75
+ 'h4',
76
+ 'h5',
77
+ 'h6',
78
+ 'header',
79
+ 'hgroup',
80
+ 'hr',
81
+ 'legend',
82
+ 'li',
83
+ 'main',
84
+ 'nav',
85
+ 'ol',
86
+ 'p',
87
+ 'pre',
88
+ 'section',
89
+ 'summary',
90
+ 'table',
91
+ 'tbody',
92
+ 'tfoot',
93
+ 'thead',
94
+ 'tr',
95
+ 'ul',
96
+ 'svg',
97
+ ];
98
+ const tagsToRegExp = (tags = []) => new RegExp(`(^| |\\+|,|~|>|\\n)(${tags.join('|')})\\b(?=$| |\\.|\\+|,|~|:|\\[)`, 'g');
99
+ const postcssHtmlTransform = (options = {}) => {
100
+ const selector = tagsToRegExp(htmlTags);
101
+ const walkRules = (rule) => {
102
+ if (/(^| )\*(?![=/*])/.test(rule.selector)) {
103
+ rule.remove();
104
+ return;
105
+ }
106
+ rule.selector = rule.selector.replace(selector, '$1.h5-$2');
107
+ };
108
+ return {
109
+ postcssPlugin: 'postcss-html-transform',
110
+ Rule(rule) {
111
+ if (typeof walkRules === 'function') {
112
+ walkRules(rule);
113
+ }
114
+ },
115
+ Declaration(decl) {
116
+ if (options?.removeCursorStyle && decl.prop === 'cursor') {
117
+ decl.remove();
118
+ }
119
+ },
120
+ };
121
+ };
122
+ postcssHtmlTransform.postcss = true;
123
+ exports.default = postcssHtmlTransform;
124
+ //# sourceMappingURL=html-transform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html-transform.js","sourceRoot":"","sources":["../../src/style-transforms/html-transform.ts"],"names":[],"mappings":";;AAEA,MAAM,QAAQ,GAAG;IACf,MAAM;IACN,MAAM;IACN,GAAG;IACH,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,KAAK;IACL,OAAO;IACP,OAAO;IACP,UAAU;IACV,QAAQ;IACR,MAAM;IACN,UAAU;IACV,OAAO;IACP,MAAM;IACN,MAAM;IACN,GAAG;IACH,KAAK;IACL,KAAK;IACL,IAAI;IACJ,MAAM;IACN,MAAM;IACN,MAAM;IACN,UAAU;IACV,KAAK;IACL,KAAK;IACL,IAAI;IACJ,GAAG;IACH,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,OAAO;IACP,QAAQ;IACR,SAAS;IACT,GAAG;IACH,GAAG;IACH,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;IACR,KAAK;IACL,KAAK;IACL,IAAI;IACJ,UAAU;IACV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AAC,IAAI,CAAC,CAAC;YAClB,CAAC;QACH,CAAC;QACD,WAAW,CAAC,IAAI;YACd,IAAI,OAAO,EAAE,iBAAiB,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACzD,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,oBAAoB,CAAC,OAAO,GAAG,IAAI,CAAC;AAEpC,kBAAe,oBAAoB,CAAC"}
@@ -0,0 +1,40 @@
1
+ type DesignWidthOption = number | ((input: string) => number);
2
+ type RootValueOption = number | ((input: string, match?: string, pixelValue?: string) => number);
3
+ interface PxTransformOptions {
4
+ baseFontSize?: number;
5
+ designWidth?: DesignWidthOption;
6
+ deviceRatio?: Record<number, number>;
7
+ exclude?: (filePath?: string) => boolean;
8
+ mediaQuery?: boolean;
9
+ methods?: string[];
10
+ minPixelValue?: number;
11
+ minRootSize?: number;
12
+ onePxTransform?: boolean;
13
+ platform?: string;
14
+ propList?: string[];
15
+ propWhiteList?: string[];
16
+ prop_white_list?: string[];
17
+ replace?: boolean;
18
+ rootValue?: RootValueOption;
19
+ root_value?: RootValueOption;
20
+ selectorBlackList?: Array<string | RegExp>;
21
+ targetUnit?: string;
22
+ unitPrecision?: number;
23
+ unit_precision?: number;
24
+ selector_black_list?: Array<string | RegExp>;
25
+ media_query?: boolean;
26
+ }
27
+ declare const postcssPxTransform: {
28
+ (options?: PxTransformOptions): {
29
+ postcssPlugin: string;
30
+ prepare(result: any): {
31
+ Comment(comment: any): void;
32
+ Declaration(decl: any): void;
33
+ AtRule: {
34
+ media: (rule: any) => void;
35
+ };
36
+ } | null;
37
+ };
38
+ postcss: boolean;
39
+ };
40
+ export default postcssPxTransform;