@tarojs/runner-utils 4.0.1 → 4.0.3-alpha.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.
package/LICENSE CHANGED
@@ -154,15 +154,8 @@ See `/LICENSE` for details of the license.
154
154
 
155
155
  ==================
156
156
 
157
- MIT (stencil-vue2-output-target):
158
- The following files embed [stencil-vue2-output-target](https://github.com/diondree/stencil-vue2-output-target) MIT:
159
- `/packages/taro-components-library-vue2/src/vue-component-lib/utils.ts`
160
- See `/LICENSE` for details of the license.
161
-
162
- ==================
163
-
164
157
  MIT (weui):
165
- The following files embed [stencil-vue2-output-target](https://github.com/Tencent/weui) MIT:
158
+ The following files embed [weui](https://github.com/Tencent/weui) MIT:
166
159
  `/packages/taro-components/src/components/*.scss`
167
160
  See `/LICENSE.txt` for details of the license.
168
161
 
@@ -172,3 +165,10 @@ Apache-2.0 (intersection-observer):
172
165
  The following files embed [intersection-observer](https://github.com/GoogleChromeLabs/intersection-observer) Apache-2.0:
173
166
  `/packages/taro-api/src/polyfill/intersection-observer.ts`
174
167
  See `/LICENSE.txt` for details of the license.
168
+
169
+ ==================
170
+
171
+ MIT (babel-plugin-jsx-dom-expressions):
172
+ The following files embed [babel-plugin-jsx-dom-expressions](https://github.com/ryansolid/dom-expressions/blob/main/packages/babel-plugin-jsx-dom-expressions) MIT:
173
+ `/packages/babel-plugin-transform-solid-jsx/src/*`
174
+ See `/LICENSE` for details of the license.
package/README.md CHANGED
@@ -1,3 +1,3 @@
1
1
  ### `@tarojs/runner-utils`
2
2
 
3
- 暴露给 `@tarojs/mini-runner` 和 `@tarojs/webpack-runner` 的公用工具函数。
3
+ 暴露给 runner 的公用工具函数。
package/dist/constant.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_Components = void 0;
3
+ exports.MEDIA_LIMIT = exports.FONT_LIMIT = exports.IMAGE_LIMIT = exports.VITE_COMPILER_LABEL = exports.DEFAULT_Components = void 0;
4
4
  exports.DEFAULT_Components = new Set([
5
5
  'view',
6
6
  'scroll-view',
@@ -46,3 +46,7 @@ exports.DEFAULT_Components = new Set([
46
46
  'official-account',
47
47
  'editor'
48
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;
package/dist/index.js CHANGED
@@ -1,11 +1,20 @@
1
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
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MultiPlatformPlugin = exports.getSassLoaderOption = exports.getBundleResult = exports.getBundleContent = exports.DEFAULT_Components = void 0;
4
- const constant_1 = require("./constant");
5
- Object.defineProperty(exports, "DEFAULT_Components", { enumerable: true, get: function () { return constant_1.DEFAULT_Components; } });
6
- const MultiPlatformPlugin_1 = require("./resolve/MultiPlatformPlugin");
7
- Object.defineProperty(exports, "MultiPlatformPlugin", { enumerable: true, get: function () { return MultiPlatformPlugin_1.MultiPlatformPlugin; } });
8
- const scss_1 = require("./scss");
9
- Object.defineProperty(exports, "getBundleContent", { enumerable: true, get: function () { return scss_1.getBundleContent; } });
10
- Object.defineProperty(exports, "getBundleResult", { enumerable: true, get: function () { return scss_1.getBundleResult; } });
11
- Object.defineProperty(exports, "getSassLoaderOption", { enumerable: true, get: function () { return scss_1.getSassLoaderOption; } });
17
+ __exportStar(require("./constant"), exports);
18
+ __exportStar(require("./resolve/MultiPlatformPlugin"), exports);
19
+ __exportStar(require("./scss"), exports);
20
+ __exportStar(require("./vite"), exports);
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MultiPlatformPlugin = void 0;
4
+ const path = require("node:path");
4
5
  const helper_1 = require("@tarojs/helper");
5
- const path = require("path");
6
6
  /**
7
7
  * @description 此 enhance-resolve 插件用于根据当前编译的平台,解析多端文件的后缀
8
8
  *
@@ -46,7 +46,7 @@ class MultiPlatformPlugin {
46
46
  else {
47
47
  return callback();
48
48
  }
49
- if (/node_modules/.test(srcRequest) && !this.includes(srcRequest)) {
49
+ if (helper_1.REG_NODE_MODULES.test(srcRequest) && !this.includes(srcRequest)) {
50
50
  return callback();
51
51
  }
52
52
  const extensions = (_c = (_b = (_a = this.options.chain) === null || _a === void 0 ? void 0 : _a.resolve) === null || _b === void 0 ? void 0 : _b.extensions) === null || _c === void 0 ? void 0 : _c.values();
package/dist/scss.js CHANGED
@@ -10,8 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.getSassLoaderOption = exports.getBundleContent = exports.getBundleResult = void 0;
13
+ const path = require("node:path");
13
14
  const helper_1 = require("@tarojs/helper");
14
- const path = require("path");
15
15
  const scss_bundle_1 = require("scss-bundle");
16
16
  /**
17
17
  * Return bundled sass content.
@@ -21,8 +21,8 @@ const scss_bundle_1 = require("scss-bundle");
21
21
  * Used for resolving tilde imports.
22
22
  * @returns Bundle result.
23
23
  */
24
- function getBundleResult(url, projectDirectory = undefined) {
25
- return __awaiter(this, void 0, void 0, function* () {
24
+ function getBundleResult(url_1) {
25
+ return __awaiter(this, arguments, void 0, function* (url, projectDirectory = undefined) {
26
26
  let bundler = new scss_bundle_1.Bundler();
27
27
  if (projectDirectory) {
28
28
  bundler = new scss_bundle_1.Bundler(undefined, projectDirectory);
@@ -39,8 +39,8 @@ exports.getBundleResult = getBundleResult;
39
39
  * Used for resolving tilde imports.
40
40
  * @returns Bundle result.
41
41
  */
42
- function getBundleContent(resource, projectDirectory = undefined) {
43
- return __awaiter(this, void 0, void 0, function* () {
42
+ function getBundleContent(resource_1) {
43
+ return __awaiter(this, arguments, void 0, function* (resource, projectDirectory = undefined) {
44
44
  let result = '';
45
45
  try {
46
46
  if (typeof resource === 'string') {
@@ -88,8 +88,8 @@ function checkPath(resource, rootDir) {
88
88
  * @param {BuildConfig} param0 Build config.
89
89
  * @returns Merged sass loader option.
90
90
  */
91
- function getSassLoaderOption({ sass, sassLoaderOption }) {
92
- return __awaiter(this, void 0, void 0, function* () {
91
+ function getSassLoaderOption(_a) {
92
+ return __awaiter(this, arguments, void 0, function* ({ sass, sassLoaderOption }) {
93
93
  sassLoaderOption = sassLoaderOption || {};
94
94
  let bundledContent = '';
95
95
  if (!sass) {
package/dist/vite.js ADDED
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.getViteMiniCompilerContext = exports.getViteHarmonyCompilerContext = exports.getViteH5CompilerContext = void 0;
13
+ const constant_1 = require("./constant");
14
+ function getViteH5CompilerContext(rollupPluginContext) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ const info = process.env.NODE_ENV === 'production'
17
+ ? rollupPluginContext.getModuleInfo(constant_1.VITE_COMPILER_LABEL)
18
+ : yield rollupPluginContext.load({ id: constant_1.VITE_COMPILER_LABEL });
19
+ const compiler = info === null || info === void 0 ? void 0 : info.meta.viteCompilerContext;
20
+ return compiler;
21
+ });
22
+ }
23
+ exports.getViteH5CompilerContext = getViteH5CompilerContext;
24
+ function getViteHarmonyCompilerContext(rollupPluginContext) {
25
+ const info = rollupPluginContext.getModuleInfo(constant_1.VITE_COMPILER_LABEL);
26
+ const compiler = info === null || info === void 0 ? void 0 : info.meta.viteCompilerContext;
27
+ return compiler;
28
+ }
29
+ exports.getViteHarmonyCompilerContext = getViteHarmonyCompilerContext;
30
+ function getViteMiniCompilerContext(rollupPluginContext) {
31
+ const info = rollupPluginContext.getModuleInfo(constant_1.VITE_COMPILER_LABEL);
32
+ const compiler = info === null || info === void 0 ? void 0 : info.meta.viteCompilerContext;
33
+ return compiler;
34
+ }
35
+ exports.getViteMiniCompilerContext = getViteMiniCompilerContext;
package/package.json CHANGED
@@ -1,7 +1,9 @@
1
1
  {
2
2
  "name": "@tarojs/runner-utils",
3
- "version": "4.0.1",
3
+ "version": "4.0.3-alpha.0",
4
4
  "description": "Taro runner utilities.",
5
+ "author": "O2Team",
6
+ "license": "MIT",
5
7
  "main": "dist/index.js",
6
8
  "types": "types/index.d.ts",
7
9
  "files": [
@@ -15,13 +17,19 @@
15
17
  "keywords": [
16
18
  "taro"
17
19
  ],
18
- "author": "garfield550",
19
- "license": "MIT",
20
+ "engines": {
21
+ "node": ">= 18"
22
+ },
20
23
  "dependencies": {
21
- "scss-bundle": "^3.0.2",
22
- "@tarojs/helper": "4.0.1"
24
+ "rollup": "^3.29.4",
25
+ "scss-bundle": "^3.1.2",
26
+ "@tarojs/helper": "4.0.3-alpha.0"
27
+ },
28
+ "devDependencies": {
29
+ "@tarojs/taro": "4.0.3-alpha.0"
23
30
  },
24
31
  "scripts": {
32
+ "prod": "pnpm run build",
25
33
  "build": "tsc",
26
34
  "dev": "tsc -w"
27
35
  }
@@ -1 +1,5 @@
1
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;
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { DEFAULT_Components } from './constant';
2
- import { MultiPlatformPlugin } from './resolve/MultiPlatformPlugin';
3
- import { getBundleContent, getBundleResult, getSassLoaderOption } from './scss';
4
- export { DEFAULT_Components, getBundleContent, getBundleResult, getSassLoaderOption, MultiPlatformPlugin };
1
+ export * from './constant';
2
+ export * from './resolve/MultiPlatformPlugin';
3
+ export * from './scss';
4
+ export * from './vite';
@@ -0,0 +1,5 @@
1
+ import type { ViteH5CompilerContext, ViteHarmonyCompilerContext, ViteMiniCompilerContext } from '@tarojs/taro/types/compile/viteCompilerContext';
2
+ import type { PluginContext } from 'rollup';
3
+ export declare function getViteH5CompilerContext(rollupPluginContext: PluginContext): Promise<ViteH5CompilerContext | void>;
4
+ export declare function getViteHarmonyCompilerContext(rollupPluginContext: PluginContext): ViteHarmonyCompilerContext | void;
5
+ export declare function getViteMiniCompilerContext(rollupPluginContext: PluginContext): ViteMiniCompilerContext | void;