@tarojs/helper 4.0.1-alpha.0 → 4.0.1
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 +8 -8
- package/README.md +1 -19
- package/dist/babelRegister.d.ts +5 -4
- package/dist/babelRegister.js +54 -2
- package/dist/babelRegister.js.map +1 -1
- package/dist/constants.d.ts +8 -10
- package/dist/constants.js +35 -44
- package/dist/constants.js.map +1 -1
- package/dist/dotenv.js +1 -1
- package/dist/dotenv.js.map +1 -1
- package/dist/esbuild/index.js +5 -6
- package/dist/esbuild/index.js.map +1 -1
- package/dist/esbuild/swc-plugin.js +3 -3
- package/dist/esbuild/swc-plugin.js.map +1 -1
- package/dist/esbuild/utils.js +2 -2
- package/dist/esbuild/utils.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/npm.d.ts +2 -2
- package/dist/npm.js +6 -6
- package/dist/npm.js.map +1 -1
- package/dist/swcRegister.js.map +1 -1
- package/dist/terminal.d.ts +1 -1
- package/dist/terminal.js.map +1 -1
- package/dist/utils.d.ts +1 -28
- package/dist/utils.js +84 -84
- package/dist/utils.js.map +1 -1
- package/package.json +33 -30
- package/swc/swc_plugin_compile_mode.wasm +0 -0
- package/swc/swc_plugin_define_config.wasm +0 -0
package/LICENSE
CHANGED
|
@@ -154,8 +154,15 @@ 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
|
+
|
|
157
164
|
MIT (weui):
|
|
158
|
-
The following files embed [
|
|
165
|
+
The following files embed [stencil-vue2-output-target](https://github.com/Tencent/weui) MIT:
|
|
159
166
|
`/packages/taro-components/src/components/*.scss`
|
|
160
167
|
See `/LICENSE.txt` for details of the license.
|
|
161
168
|
|
|
@@ -165,10 +172,3 @@ Apache-2.0 (intersection-observer):
|
|
|
165
172
|
The following files embed [intersection-observer](https://github.com/GoogleChromeLabs/intersection-observer) Apache-2.0:
|
|
166
173
|
`/packages/taro-api/src/polyfill/intersection-observer.ts`
|
|
167
174
|
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,25 +1,7 @@
|
|
|
1
1
|
# Taro Helper
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
编译时工具库。
|
|
4
4
|
|
|
5
5
|
tips:
|
|
6
6
|
|
|
7
7
|
执行 `build` 命令时,会把 swc-backup 文件夹里的 `.wasm` 文件移动到 swc 文件夹中,目的是为了不关注 SWC 插件的开发者无需配置 Rust 环境。但如何开发者需要修改 SWC 插件,请参考 CONTRIBUTING.md 文档中的 Rust 部分进行开发调试。
|
|
8
|
-
|
|
9
|
-
## 项目结构
|
|
10
|
-
|
|
11
|
-
``` plaintext
|
|
12
|
-
.
|
|
13
|
-
├── __tests__ # 单测
|
|
14
|
-
├── babelRegister.ts # babel register,已过时
|
|
15
|
-
├── constants.ts # 编译时常量
|
|
16
|
-
├── esbuild # esbuild 相关工具
|
|
17
|
-
│ ├── index.ts
|
|
18
|
-
│ ├── swc-plugin.ts
|
|
19
|
-
│ └── utils.ts
|
|
20
|
-
├── index.ts
|
|
21
|
-
├── npm.ts # 依赖项管理工具
|
|
22
|
-
├── swcRegister.ts # swc register,通常用于加载项目的配置文件,如 app.config.js
|
|
23
|
-
├── terminal.ts # 终端 Terminal 工具集
|
|
24
|
-
└── utils.ts # 工具集
|
|
25
|
-
```
|
package/dist/babelRegister.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PluginItem } from '@babel/core';
|
|
2
2
|
/**
|
|
3
3
|
* Inject `defineAppConfig` and `definePageConfig`
|
|
4
4
|
* require header at the top of a config file,
|
|
5
5
|
* without the need to specifically require them
|
|
6
6
|
* if they are used
|
|
7
7
|
*/
|
|
8
|
-
export declare function injectDefineConfigHeader(babel:
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
export declare function injectDefineConfigHeader(babel: any): PluginItem;
|
|
9
|
+
export default function createBabelRegister({ only }: {
|
|
10
|
+
only: any;
|
|
11
|
+
}): void;
|
package/dist/babelRegister.js
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
26
|
exports.injectDefineConfigHeader = void 0;
|
|
27
|
+
const path = __importStar(require("path"));
|
|
4
28
|
/**
|
|
5
29
|
* Inject `defineAppConfig` and `definePageConfig`
|
|
6
30
|
* require header at the top of a config file,
|
|
@@ -11,8 +35,7 @@ function injectDefineConfigHeader(babel) {
|
|
|
11
35
|
const appConfig = 'function defineAppConfig(config) { return config }';
|
|
12
36
|
const pageConfig = 'function definePageConfig(config) { return config }';
|
|
13
37
|
const prependHeader = (nodePath, header) => {
|
|
14
|
-
|
|
15
|
-
const parsedHeader = (_a = babel.parse(header, { filename: '' })) === null || _a === void 0 ? void 0 : _a.program.body[0];
|
|
38
|
+
const parsedHeader = babel.parse(header, { filename: '' }).program.body[0];
|
|
16
39
|
nodePath.node.body.unshift(parsedHeader);
|
|
17
40
|
};
|
|
18
41
|
const enterHandler = (nodePath) => {
|
|
@@ -37,4 +60,33 @@ function injectDefineConfigHeader(babel) {
|
|
|
37
60
|
};
|
|
38
61
|
}
|
|
39
62
|
exports.injectDefineConfigHeader = injectDefineConfigHeader;
|
|
63
|
+
function createBabelRegister({ only }) {
|
|
64
|
+
require('@babel/register')({
|
|
65
|
+
only: Array.from(new Set([...only])),
|
|
66
|
+
presets: [
|
|
67
|
+
require.resolve('@babel/preset-env'),
|
|
68
|
+
require.resolve('@babel/preset-typescript')
|
|
69
|
+
],
|
|
70
|
+
plugins: [
|
|
71
|
+
injectDefineConfigHeader,
|
|
72
|
+
[require.resolve('@babel/plugin-proposal-decorators'), {
|
|
73
|
+
legacy: true
|
|
74
|
+
}],
|
|
75
|
+
require.resolve('@babel/plugin-proposal-object-rest-spread'),
|
|
76
|
+
[require.resolve('@babel/plugin-transform-runtime'), {
|
|
77
|
+
corejs: false,
|
|
78
|
+
helpers: true,
|
|
79
|
+
regenerator: true,
|
|
80
|
+
useESModules: false,
|
|
81
|
+
version: '^7.7.7',
|
|
82
|
+
absoluteRuntime: path.resolve(__dirname, '..', 'node_modules/@babel/runtime')
|
|
83
|
+
}]
|
|
84
|
+
],
|
|
85
|
+
extensions: ['.jsx', '.js', '.ts', '.tsx'],
|
|
86
|
+
babelrc: false,
|
|
87
|
+
configFile: false,
|
|
88
|
+
cache: false
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
exports.default = createBabelRegister;
|
|
40
92
|
//# sourceMappingURL=babelRegister.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"babelRegister.js","sourceRoot":"","sources":["../src/babelRegister.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"babelRegister.js","sourceRoot":"","sources":["../src/babelRegister.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA4B;AAI5B;;;;;EAKE;AACF,SAAgB,wBAAwB,CAAE,KAAU;IAClD,MAAM,SAAS,GAAG,oDAAoD,CAAA;IACtE,MAAM,UAAU,GAAG,qDAAqD,CAAA;IAExE,MAAM,aAAa,GAAG,CAAC,QAAuB,EAAE,MAAc,EAAE,EAAE;QAChE,MAAM,YAAY,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAC1E,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;IAC1C,CAAC,CAAA;IAED,MAAM,YAAY,GAAG,CAAC,QAAuB,EAAE,EAAE;QAC/C,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAA;QAEhC,KAAK,CAAC,QAAQ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,UAAU,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC;QAC1C,OAAO,EAAE,KAAK;QACd,UAAU,EAAE,KAAK;QACjB,KAAK,EAAE,KAAK;KACb,CAAC,CAAA;AACJ,CAAC;AA3BD,sCA2BC"}
|
package/dist/constants.d.ts
CHANGED
|
@@ -48,13 +48,9 @@ export declare const REG_UX: RegExp;
|
|
|
48
48
|
export declare const REG_TEMPLATE: RegExp;
|
|
49
49
|
export declare const REG_WXML_IMPORT: RegExp;
|
|
50
50
|
export declare const REG_URL: RegExp;
|
|
51
|
-
export declare const
|
|
52
|
-
export declare const REG_TARO_H5: RegExp;
|
|
53
|
-
export declare const REG_TARO_H5_RUNTIME_API: RegExp;
|
|
54
|
-
export declare const REG_CSS_IMPORT: RegExp;
|
|
51
|
+
export declare const CSS_IMPORT_REG: RegExp;
|
|
55
52
|
export declare const NODE_MODULES = "node_modules";
|
|
56
|
-
export declare const
|
|
57
|
-
export declare const REG_NODE_MODULES_DIR: RegExp;
|
|
53
|
+
export declare const NODE_MODULES_REG: RegExp;
|
|
58
54
|
export declare const PROJECT_CONFIG = "config/index";
|
|
59
55
|
export declare const DEVICE_RATIO: {
|
|
60
56
|
640: number;
|
|
@@ -86,9 +82,9 @@ export declare const taroJsMobx = "@tarojs/mobx";
|
|
|
86
82
|
export declare const taroJsMobxCommon = "@tarojs/mobx-common";
|
|
87
83
|
export declare const DEVICE_RATIO_NAME = "deviceRatio";
|
|
88
84
|
export declare const isWindows: boolean;
|
|
89
|
-
export declare const DEFAULT_TEMPLATE_SRC = "github:NervJS/taro-project-templates#
|
|
90
|
-
export declare const DEFAULT_TEMPLATE_SRC_GITEE = "direct:https://gitee.com/o2team/taro-project-templates.git#
|
|
91
|
-
export declare const TARO_CONFIG_FOLDER = ".taro3.
|
|
85
|
+
export declare const DEFAULT_TEMPLATE_SRC = "github:NervJS/taro-project-templates#v3.6-rs";
|
|
86
|
+
export declare const DEFAULT_TEMPLATE_SRC_GITEE = "direct:https://gitee.com/o2team/taro-project-templates.git#v3.6-rs";
|
|
87
|
+
export declare const TARO_CONFIG_FOLDER = ".taro3.6-rs";
|
|
92
88
|
export declare const TARO_BASE_CONFIG = "index.json";
|
|
93
89
|
export declare const TARO_GLOBAL_CONFIG_DIR = ".taro-global-config";
|
|
94
90
|
export declare const TARO_GLOBAL_CONFIG_FILE = "index.json";
|
|
@@ -98,7 +94,9 @@ export declare const TEMP_DIR = ".temp";
|
|
|
98
94
|
export declare const NPM_DIR = "npm";
|
|
99
95
|
export declare const ENTRY = "app";
|
|
100
96
|
export declare enum FRAMEWORK_MAP {
|
|
97
|
+
VUE = "vue",
|
|
101
98
|
VUE3 = "vue3",
|
|
102
|
-
REACT = "react"
|
|
99
|
+
REACT = "react",
|
|
100
|
+
NERV = "nerv"
|
|
103
101
|
}
|
|
104
102
|
export declare const defaultMainFields: string[];
|
package/dist/constants.js
CHANGED
|
@@ -23,12 +23,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
27
|
-
exports.defaultMainFields = exports.FRAMEWORK_MAP = exports.ENTRY = exports.NPM_DIR = exports.TEMP_DIR = exports.SOURCE_DIR = exports.OUTPUT_DIR = exports.TARO_GLOBAL_CONFIG_FILE = exports.TARO_GLOBAL_CONFIG_DIR =
|
|
28
|
-
const os = __importStar(require("
|
|
26
|
+
exports.TARO_BASE_CONFIG = exports.TARO_CONFIG_FOLDER = exports.DEFAULT_TEMPLATE_SRC_GITEE = exports.DEFAULT_TEMPLATE_SRC = exports.isWindows = exports.DEVICE_RATIO_NAME = exports.taroJsMobxCommon = exports.taroJsMobx = exports.taroJsRedux = exports.taroJsFramework = exports.taroJsQuickAppComponents = exports.taroJsComponents = exports.META_TYPE = exports.UPDATE_PACKAGE_LIST = exports.FILE_PROCESSOR_MAP = exports.DEVICE_RATIO = exports.PROJECT_CONFIG = exports.NODE_MODULES_REG = exports.NODE_MODULES = exports.CSS_IMPORT_REG = exports.REG_URL = exports.REG_WXML_IMPORT = exports.REG_TEMPLATE = exports.REG_UX = exports.REG_JSON = exports.REG_FONT = exports.REG_IMAGE = exports.REG_MEDIA = exports.REG_CSS = exports.REG_STYLE = exports.REG_STYLUS = exports.REG_LESS = exports.REG_SASS_SCSS = exports.REG_SASS_SASS = exports.REG_SASS = exports.REG_VUE = exports.REG_SCRIPTS = exports.REG_TYPESCRIPT = exports.REG_SCRIPT = exports.REG_JS = exports.VUE_EXT = exports.SCRIPT_EXT = exports.UX_EXT = exports.TS_EXT = exports.JS_EXT = exports.SCSS_EXT = exports.CSS_EXT = exports.processTypeMap = exports.processTypeEnum = exports.PLATFORMS = void 0;
|
|
27
|
+
exports.defaultMainFields = exports.FRAMEWORK_MAP = exports.ENTRY = exports.NPM_DIR = exports.TEMP_DIR = exports.SOURCE_DIR = exports.OUTPUT_DIR = exports.TARO_GLOBAL_CONFIG_FILE = exports.TARO_GLOBAL_CONFIG_DIR = void 0;
|
|
28
|
+
const os = __importStar(require("os"));
|
|
29
29
|
const terminal_1 = require("./terminal");
|
|
30
30
|
// eslint-disable-next-line dot-notation
|
|
31
|
-
exports.PLATFORMS =
|
|
31
|
+
exports.PLATFORMS = global['PLATFORMS'] = global['PLATFORMS'] || {};
|
|
32
32
|
var processTypeEnum;
|
|
33
33
|
(function (processTypeEnum) {
|
|
34
34
|
processTypeEnum["START"] = "start";
|
|
@@ -43,56 +43,56 @@ var processTypeEnum;
|
|
|
43
43
|
processTypeEnum["UNLINK"] = "unlink";
|
|
44
44
|
processTypeEnum["REFERENCE"] = "reference";
|
|
45
45
|
processTypeEnum["REMIND"] = "remind";
|
|
46
|
-
})(processTypeEnum
|
|
46
|
+
})(processTypeEnum = exports.processTypeEnum || (exports.processTypeEnum = {}));
|
|
47
47
|
exports.processTypeMap = {
|
|
48
48
|
["create" /* processTypeEnum.CREATE */]: {
|
|
49
49
|
name: '创建',
|
|
50
|
-
color: 'cyan'
|
|
50
|
+
color: 'cyan'
|
|
51
51
|
},
|
|
52
52
|
["compile" /* processTypeEnum.COMPILE */]: {
|
|
53
53
|
name: '编译',
|
|
54
|
-
color: 'green'
|
|
54
|
+
color: 'green'
|
|
55
55
|
},
|
|
56
56
|
["convert" /* processTypeEnum.CONVERT */]: {
|
|
57
57
|
name: '转换',
|
|
58
|
-
color: terminal_1.chalk.rgb(255, 136, 0)
|
|
58
|
+
color: terminal_1.chalk.rgb(255, 136, 0)
|
|
59
59
|
},
|
|
60
60
|
["copy" /* processTypeEnum.COPY */]: {
|
|
61
61
|
name: '拷贝',
|
|
62
|
-
color: 'magenta'
|
|
62
|
+
color: 'magenta'
|
|
63
63
|
},
|
|
64
64
|
["generate" /* processTypeEnum.GENERATE */]: {
|
|
65
65
|
name: '生成',
|
|
66
|
-
color: 'blue'
|
|
66
|
+
color: 'blue'
|
|
67
67
|
},
|
|
68
68
|
["modify" /* processTypeEnum.MODIFY */]: {
|
|
69
69
|
name: '修改',
|
|
70
|
-
color: 'yellow'
|
|
70
|
+
color: 'yellow'
|
|
71
71
|
},
|
|
72
72
|
["error" /* processTypeEnum.ERROR */]: {
|
|
73
73
|
name: '错误',
|
|
74
|
-
color: 'red'
|
|
74
|
+
color: 'red'
|
|
75
75
|
},
|
|
76
76
|
["warning" /* processTypeEnum.WARNING */]: {
|
|
77
77
|
name: '警告',
|
|
78
|
-
color: 'yellowBright'
|
|
78
|
+
color: 'yellowBright'
|
|
79
79
|
},
|
|
80
80
|
["unlink" /* processTypeEnum.UNLINK */]: {
|
|
81
81
|
name: '删除',
|
|
82
|
-
color: 'magenta'
|
|
82
|
+
color: 'magenta'
|
|
83
83
|
},
|
|
84
84
|
["start" /* processTypeEnum.START */]: {
|
|
85
85
|
name: '启动',
|
|
86
|
-
color: 'green'
|
|
86
|
+
color: 'green'
|
|
87
87
|
},
|
|
88
88
|
["reference" /* processTypeEnum.REFERENCE */]: {
|
|
89
89
|
name: '引用',
|
|
90
|
-
color: 'blue'
|
|
90
|
+
color: 'blue'
|
|
91
91
|
},
|
|
92
92
|
["remind" /* processTypeEnum.REMIND */]: {
|
|
93
93
|
name: '提示',
|
|
94
|
-
color: 'green'
|
|
95
|
-
}
|
|
94
|
+
color: 'green'
|
|
95
|
+
}
|
|
96
96
|
};
|
|
97
97
|
exports.CSS_EXT = ['.css', '.scss', '.sass', '.less', '.styl', '.stylus', '.wxss', '.acss'];
|
|
98
98
|
exports.SCSS_EXT = ['.scss'];
|
|
@@ -101,10 +101,10 @@ exports.TS_EXT = ['.ts', '.tsx'];
|
|
|
101
101
|
exports.UX_EXT = ['.ux'];
|
|
102
102
|
exports.SCRIPT_EXT = exports.JS_EXT.concat(exports.TS_EXT);
|
|
103
103
|
exports.VUE_EXT = ['.vue'];
|
|
104
|
-
exports.REG_JS = /\.
|
|
105
|
-
exports.REG_SCRIPT = /\.
|
|
104
|
+
exports.REG_JS = /\.js(\?.*)?$/;
|
|
105
|
+
exports.REG_SCRIPT = /\.(js|jsx)(\?.*)?$/;
|
|
106
106
|
exports.REG_TYPESCRIPT = /\.(tsx|ts)(\?.*)?$/;
|
|
107
|
-
exports.REG_SCRIPTS = /\.
|
|
107
|
+
exports.REG_SCRIPTS = /\.[tj]sx?$/i;
|
|
108
108
|
exports.REG_VUE = /\.vue$/i;
|
|
109
109
|
exports.REG_SASS = /\.(s[ac]ss)$/;
|
|
110
110
|
exports.REG_SASS_SASS = /\.sass$/;
|
|
@@ -121,25 +121,21 @@ exports.REG_UX = /\.ux(\?.*)?$/;
|
|
|
121
121
|
exports.REG_TEMPLATE = /\.(wxml|axml|ttml|qml|swan|jxml)(\?.*)?$/;
|
|
122
122
|
exports.REG_WXML_IMPORT = /<import(.*)?src=(?:(?:'([^']*)')|(?:"([^"]*)"))/gi;
|
|
123
123
|
exports.REG_URL = /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i;
|
|
124
|
-
exports.
|
|
125
|
-
exports.REG_TARO_H5 = /taro-h5[\\/]dist[\\/](api[\\/]taro|index\.esm)/;
|
|
126
|
-
exports.REG_TARO_H5_RUNTIME_API = /@tarojs[\\/]plugin-platform-h5[\\/]dist[\\/]runtime[\\/]apis[\\/]index/;
|
|
127
|
-
exports.REG_CSS_IMPORT = /@import (["'])(.+?)\1;/g;
|
|
124
|
+
exports.CSS_IMPORT_REG = /@import (["'])(.+?)\1;/g;
|
|
128
125
|
exports.NODE_MODULES = 'node_modules';
|
|
129
|
-
exports.
|
|
130
|
-
exports.REG_NODE_MODULES_DIR = /[\\/]node_modules[\\/]/gi;
|
|
126
|
+
exports.NODE_MODULES_REG = /(.*)node_modules/;
|
|
131
127
|
exports.PROJECT_CONFIG = 'config/index';
|
|
132
128
|
exports.DEVICE_RATIO = {
|
|
133
129
|
640: 2.34 / 2,
|
|
134
130
|
750: 1,
|
|
135
|
-
828: 1.81 / 2
|
|
131
|
+
828: 1.81 / 2
|
|
136
132
|
};
|
|
137
133
|
exports.FILE_PROCESSOR_MAP = {
|
|
138
134
|
'.js': 'babel',
|
|
139
135
|
'.scss': 'sass',
|
|
140
136
|
'.sass': 'sass',
|
|
141
137
|
'.less': 'less',
|
|
142
|
-
'.styl': 'stylus'
|
|
138
|
+
'.styl': 'stylus'
|
|
143
139
|
};
|
|
144
140
|
exports.UPDATE_PACKAGE_LIST = [
|
|
145
141
|
'babel-plugin-transform-react-jsx-to-rn-stylesheet',
|
|
@@ -157,7 +153,6 @@ exports.UPDATE_PACKAGE_LIST = [
|
|
|
157
153
|
'@tarojs/cli',
|
|
158
154
|
'@tarojs/api',
|
|
159
155
|
'@tarojs/components',
|
|
160
|
-
'@tarojs/components-advanced',
|
|
161
156
|
'@tarojs/components-react',
|
|
162
157
|
'@tarojs/components-rn',
|
|
163
158
|
'@tarojs/extend',
|
|
@@ -169,10 +164,11 @@ exports.UPDATE_PACKAGE_LIST = [
|
|
|
169
164
|
'@tarojs/rn-transformer',
|
|
170
165
|
'@tarojs/helper',
|
|
171
166
|
'@tarojs/taro-loader',
|
|
167
|
+
'@tarojs/mini-runner',
|
|
172
168
|
'@tarojs/react',
|
|
173
169
|
'@tarojs/plugin-framework-react',
|
|
170
|
+
'@tarojs/plugin-framework-vue2',
|
|
174
171
|
'@tarojs/plugin-framework-vue3',
|
|
175
|
-
'@tarojs/plugin-framework-solid',
|
|
176
172
|
'@tarojs/plugin-react-devtools',
|
|
177
173
|
'@tarojs/plugin-vue-devtools',
|
|
178
174
|
'@tarojs/router',
|
|
@@ -181,9 +177,9 @@ exports.UPDATE_PACKAGE_LIST = [
|
|
|
181
177
|
'@tarojs/runtime',
|
|
182
178
|
'@tarojs/runtime-rn',
|
|
183
179
|
'@tarojs/service',
|
|
180
|
+
'@tarojs/webpack-runner',
|
|
184
181
|
'@tarojs/with-weapp',
|
|
185
182
|
'@tarojs/taroize',
|
|
186
|
-
'@tarojs/plugin-inject',
|
|
187
183
|
'@tarojs/plugin-platform-weapp',
|
|
188
184
|
'@tarojs/plugin-platform-alipay',
|
|
189
185
|
'@tarojs/plugin-platform-swan',
|
|
@@ -191,17 +187,10 @@ exports.UPDATE_PACKAGE_LIST = [
|
|
|
191
187
|
'@tarojs/plugin-platform-qq',
|
|
192
188
|
'@tarojs/plugin-platform-jd',
|
|
193
189
|
'@tarojs/plugin-platform-h5',
|
|
194
|
-
'@tarojs/plugin-platform-harmony-ets',
|
|
195
|
-
'@tarojs/plugin-platform-harmony-hybrid',
|
|
196
190
|
'@tarojs/plugin-html',
|
|
197
191
|
'@tarojs/plugin-mini-ci',
|
|
198
|
-
'@tarojs/plugin-http',
|
|
199
192
|
'@tarojs/webpack5-runner',
|
|
200
193
|
'@tarojs/webpack5-prebundle',
|
|
201
|
-
'@tarojs/vite-runner',
|
|
202
|
-
'@tarojs/create-app',
|
|
203
|
-
'@tarojs/cli-convertor',
|
|
204
|
-
'@tarojs/transformer-wx',
|
|
205
194
|
];
|
|
206
195
|
var META_TYPE;
|
|
207
196
|
(function (META_TYPE) {
|
|
@@ -212,7 +201,7 @@ var META_TYPE;
|
|
|
212
201
|
META_TYPE["STATIC"] = "STATIC";
|
|
213
202
|
META_TYPE["CONFIG"] = "CONFIG";
|
|
214
203
|
META_TYPE["EXPORTS"] = "EXPORTS";
|
|
215
|
-
})(META_TYPE
|
|
204
|
+
})(META_TYPE = exports.META_TYPE || (exports.META_TYPE = {}));
|
|
216
205
|
exports.taroJsComponents = '@tarojs/components';
|
|
217
206
|
exports.taroJsQuickAppComponents = '@tarojs/components-qa';
|
|
218
207
|
exports.taroJsFramework = '@tarojs/taro';
|
|
@@ -221,9 +210,9 @@ exports.taroJsMobx = '@tarojs/mobx';
|
|
|
221
210
|
exports.taroJsMobxCommon = '@tarojs/mobx-common';
|
|
222
211
|
exports.DEVICE_RATIO_NAME = 'deviceRatio';
|
|
223
212
|
exports.isWindows = os.platform() === 'win32';
|
|
224
|
-
exports.DEFAULT_TEMPLATE_SRC = 'github:NervJS/taro-project-templates#
|
|
225
|
-
exports.DEFAULT_TEMPLATE_SRC_GITEE = 'direct:https://gitee.com/o2team/taro-project-templates.git#
|
|
226
|
-
exports.TARO_CONFIG_FOLDER = '.taro3.
|
|
213
|
+
exports.DEFAULT_TEMPLATE_SRC = 'github:NervJS/taro-project-templates#v3.6-rs';
|
|
214
|
+
exports.DEFAULT_TEMPLATE_SRC_GITEE = 'direct:https://gitee.com/o2team/taro-project-templates.git#v3.6-rs';
|
|
215
|
+
exports.TARO_CONFIG_FOLDER = '.taro3.6-rs';
|
|
227
216
|
exports.TARO_BASE_CONFIG = 'index.json';
|
|
228
217
|
exports.TARO_GLOBAL_CONFIG_DIR = '.taro-global-config';
|
|
229
218
|
exports.TARO_GLOBAL_CONFIG_FILE = 'index.json';
|
|
@@ -234,8 +223,10 @@ exports.NPM_DIR = 'npm';
|
|
|
234
223
|
exports.ENTRY = 'app';
|
|
235
224
|
var FRAMEWORK_MAP;
|
|
236
225
|
(function (FRAMEWORK_MAP) {
|
|
226
|
+
FRAMEWORK_MAP["VUE"] = "vue";
|
|
237
227
|
FRAMEWORK_MAP["VUE3"] = "vue3";
|
|
238
228
|
FRAMEWORK_MAP["REACT"] = "react";
|
|
239
|
-
|
|
229
|
+
FRAMEWORK_MAP["NERV"] = "nerv";
|
|
230
|
+
})(FRAMEWORK_MAP = exports.FRAMEWORK_MAP || (exports.FRAMEWORK_MAP = {}));
|
|
240
231
|
exports.defaultMainFields = ['browser', 'module', 'jsnext:main', 'main'];
|
|
241
232
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AAExB,yCAAkC;AAElC,wCAAwC;AAC3B,QAAA,SAAS,GAAG,MAAM,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,CAAA;AAExE,IAAkB,eAajB;AAbD,WAAkB,eAAe;IAC/B,kCAAe,CAAA;IACf,oCAAiB,CAAA;IACjB,sCAAmB,CAAA;IACnB,sCAA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|
@@ -24,10 +24,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.patchEnv = exports.dotenvParse = exports.formatPrefix = void 0;
|
|
27
|
-
const path = __importStar(require("node:path"));
|
|
28
27
|
const dotenv_1 = require("dotenv");
|
|
29
28
|
const dotenv_expand_1 = require("dotenv-expand");
|
|
30
29
|
const fs = __importStar(require("fs-extra"));
|
|
30
|
+
const path = __importStar(require("path"));
|
|
31
31
|
// 支持 --env-prefix=TARO_APP_,aa 类型参数
|
|
32
32
|
const formatPrefix = (prefixs = ['TARO_APP_']) => {
|
|
33
33
|
const prefixsArr = (Array.isArray(prefixs) ? prefixs : prefixs.split(',')).map(prefix => prefix.trim()).filter(prefix => !!prefix);
|
package/dist/dotenv.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dotenv.js","sourceRoot":"","sources":["../src/dotenv.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"dotenv.js","sourceRoot":"","sources":["../src/dotenv.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAA8B;AAC9B,iDAAsC;AACtC,6CAA8B;AAC9B,2CAA4B;AAI5B,oCAAoC;AAC7B,MAAM,YAAY,GAAG,CAAC,UAA6B,CAAC,WAAW,CAAC,EAAY,EAAE;IACnF,MAAM,UAAU,GAAa,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAA;IAC5I,OAAO,UAA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aAAa,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACtF,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;SACpB;IACH,CAAC,CAAC,CAAA;IACF,IAAA,sBAAM,EAAC,EAAE,MAAM,EAAE,CAAC,CAAA;IAClB,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AApCY,QAAA,WAAW,eAoCvB;AAED,SAAS;AACF,MAAM,QAAQ,GAAG,CAAC,MAAsB,EAAE,SAAiC,EAAE,EAAE;IACpF,MAAM,kBAAkB,GAAG,EAAE,CAAA;IAC7B,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE;QAC3B,kBAAkB,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA;KACzD;IACD,uCACK,MAAM,CAAC,GAAG,GACV,kBAAkB,EACtB;AACH,CAAC,CAAA;AATY,QAAA,QAAQ,YASpB"}
|
package/dist/esbuild/index.js
CHANGED
|
@@ -25,10 +25,9 @@ const lodash_1 = require("lodash");
|
|
|
25
25
|
const require_from_string_1 = __importDefault(require("require-from-string"));
|
|
26
26
|
const constants_1 = require("../constants");
|
|
27
27
|
exports.defaultEsbuildLoader = {
|
|
28
|
-
'.js': '
|
|
28
|
+
'.js': 'tsx',
|
|
29
29
|
'.jsx': 'tsx',
|
|
30
|
-
'.ts': '
|
|
31
|
-
'.json': 'json'
|
|
30
|
+
'.ts': 'tsx'
|
|
32
31
|
};
|
|
33
32
|
/** 基于 esbuild 的 require 实现 */
|
|
34
33
|
function requireWithEsbuild(id, { customConfig = {}, customSwcConfig = {}, cwd = process.cwd() } = {}) {
|
|
@@ -40,14 +39,14 @@ function requireWithEsbuild(id, { customConfig = {}, customSwcConfig = {}, cwd =
|
|
|
40
39
|
// AMD 被 esbuild 转 ESM 后,是套着 ESM 外皮的 AMD 语法模块。
|
|
41
40
|
// Webpack HarmonyDetectionParserPlugin 会阻止 AMDDefineDependencyParserPlugin 对这些模块的处理。
|
|
42
41
|
// 导致这些模块报错(如 lodash)。目前的办法是把 define 置为 false,不支持 AMD 导出。
|
|
43
|
-
define: 'false'
|
|
42
|
+
define: 'false'
|
|
44
43
|
}),
|
|
45
44
|
alias: Object.fromEntries(Object.entries(customConfig.alias || {}).filter(([key]) => !key.startsWith('/'))),
|
|
46
45
|
entryPoints: [id],
|
|
47
46
|
format: 'esm',
|
|
48
47
|
loader: (0, lodash_1.defaults)(customConfig.loader, exports.defaultEsbuildLoader),
|
|
49
|
-
mainFields:
|
|
50
|
-
write: false
|
|
48
|
+
mainFields: constants_1.defaultMainFields,
|
|
49
|
+
write: false
|
|
51
50
|
}));
|
|
52
51
|
// Note: esbuild.buildSync 模式下不支持引入插件,所以这里需要手动转换
|
|
53
52
|
const { code = '' } = (0, core_1.transformSync)(outputFiles[0].text, (0, lodash_1.defaults)(customSwcConfig, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/esbuild/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,oCAAiD;AACjD,sDAA6B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/esbuild/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,oCAAiD;AACjD,sDAA6B;AAqDpB,kBArDF,iBAAO,CAqDE;AApDhB,mCAAuC;AACvC,8EAAmD;AAEnD,4CAAgD;AAInC,QAAA,oBAAoB,GAA2B;IAC1D,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE,KAAK;IACb,KAAK,EAAE,KAAK;CACb,CAAA;AAQD,8BAA8B;AAC9B,SAAgB,kBAAkB,CAAE,EAAU,EAAE,EAC9C,YAAY,GAAG,EAAE,EACjB,eAAe,GAAG,EAAE,EACpB,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,KACW,EAAE;IAChC,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,iBAA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__esModule", { value: true });
|
|
12
12
|
exports.getSwcPlugin = void 0;
|
|
13
|
-
const node_path_1 = require("node:path");
|
|
14
13
|
const core_1 = require("@swc/core");
|
|
15
14
|
const lodash_1 = require("lodash");
|
|
15
|
+
const path_1 = require("path");
|
|
16
16
|
const constants_1 = require("../constants");
|
|
17
17
|
const utils_1 = require("../utils");
|
|
18
18
|
function getSwcPlugin(config) {
|
|
@@ -21,9 +21,9 @@ function getSwcPlugin(config) {
|
|
|
21
21
|
setup(build) {
|
|
22
22
|
const namespace = 'tarojs:swc-helper';
|
|
23
23
|
build.onResolve({ filter: constants_1.REG_SCRIPTS, namespace }, ({ resolveDir, path }) => ({
|
|
24
|
-
path: (0,
|
|
24
|
+
path: (0, path_1.resolve)(resolveDir, path)
|
|
25
25
|
}));
|
|
26
|
-
build.onLoad({ filter: constants_1.REG_SCRIPTS, namespace }, (
|
|
26
|
+
build.onLoad({ filter: constants_1.REG_SCRIPTS, namespace }, ({ path }) => __awaiter(this, void 0, void 0, function* () {
|
|
27
27
|
const code = yield utils_1.fs.readFile(path, 'utf-8');
|
|
28
28
|
const result = (0, core_1.transformSync)(code, (0, lodash_1.defaults)(config, {
|
|
29
29
|
jsc: { target: 'es2015' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swc-plugin.js","sourceRoot":"","sources":["../../src/esbuild/swc-plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"swc-plugin.js","sourceRoot":"","sources":["../../src/esbuild/swc-plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAAyC;AACzC,mCAAiC;AACjC,+BAA8B;AAE9B,4CAA0C;AAC1C,oCAA6B;AAK7B,SAAgB,YAAY,CAAE,MAAe;IAC3C,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,KAAK,CAAE,KAAK;YACV,MAAM,SAAS,GAAG,mBAAmB,CAAA;YACrC,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,uBAAW,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC7E,IAAI,EAAE,IAAA,cAAO,EAAC,UAAU,EAAE,IAAI,CAAC;aAChC,CAAC,CAAC,CAAA;YAEH,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,uBAAW,EAAE,SAAS,EAAE,EAAE,CAAO,EAAE,IAAI,EAAE,EAAE,EAAE;gBAClE,MAAM,IAAI,GAAG,MAAM,UAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;gBAC7C,MAAM,MAAM,GAAW,IAAA,oBAAa,EAAC,IAAI,EAAE,IAAA,iBAAQ,EAAC,MAAM,EAAE;oBAC1D,GAAG,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE;oBACzB,QAAQ,EAAE,IAAI;oBACd,UAAU,EAAE,IAAI;oBAChB,cAAc,EAAE,IAAI;iBACrB,CAAC,CAAC,CAAA;gBAEH,OAAO;oBACL,QAAQ,EAAE,MAAM,CAAC,IAAI;oBACrB,MAAM,EAAE,IAAI;iBACb,CAAA;YACH,CAAC,CAAA,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC;AAzBD,oCAyBC"}
|
package/dist/esbuild/utils.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.externalEsbuildModule = void 0;
|
|
4
|
-
const
|
|
4
|
+
const path_1 = require("path");
|
|
5
5
|
function externalEsbuildModule({ path, namespace, importer, pluginData }) {
|
|
6
6
|
if (namespace === 'file' && importer && path) {
|
|
7
|
-
path = (0,
|
|
7
|
+
path = (0, path_1.resolve)(importer, path);
|
|
8
8
|
}
|
|
9
9
|
return {
|
|
10
10
|
path,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/esbuild/utils.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/esbuild/utils.ts"],"names":[],"mappings":";;;AAAA,+BAA8B;AAI9B,SAAgB,qBAAqB,CAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAA0B;IACtG,IAAI,SAAS,KAAK,MAAM,IAAI,QAAQ,IAAI,IAAI,EAAE;QAC5C,IAAI,GAAG,IAAA,cAAO,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;KAC/B;IACD,OAAO;QACL,IAAI;QACJ,SAAS;QACT,UAAU;QACV,QAAQ,EAAE,IAAI;KACf,CAAA;AACH,CAAC;AAVD,sDAUC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * as swc from '@swc/core';
|
|
2
2
|
export * as chokidar from 'chokidar';
|
|
3
3
|
export declare const createDebug: (id: string) => any;
|
|
4
|
-
export { injectDefineConfigHeader } from './babelRegister';
|
|
4
|
+
export { default as createBabelRegister, injectDefineConfigHeader } from './babelRegister';
|
|
5
5
|
export * from './constants';
|
|
6
6
|
export * from './dotenv';
|
|
7
7
|
export * from './esbuild';
|
package/dist/index.js
CHANGED
|
@@ -29,12 +29,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.createSwcRegister = exports.npm = exports.injectDefineConfigHeader = exports.createDebug = exports.chokidar = exports.swc = void 0;
|
|
32
|
+
exports.createSwcRegister = exports.npm = exports.injectDefineConfigHeader = exports.createBabelRegister = exports.createDebug = exports.chokidar = exports.swc = void 0;
|
|
33
33
|
exports.swc = __importStar(require("@swc/core"));
|
|
34
34
|
exports.chokidar = __importStar(require("chokidar"));
|
|
35
35
|
const createDebug = (id) => require('debug')(id);
|
|
36
36
|
exports.createDebug = createDebug;
|
|
37
37
|
var babelRegister_1 = require("./babelRegister");
|
|
38
|
+
Object.defineProperty(exports, "createBabelRegister", { enumerable: true, get: function () { return __importDefault(babelRegister_1).default; } });
|
|
38
39
|
Object.defineProperty(exports, "injectDefineConfigHeader", { enumerable: true, get: function () { return babelRegister_1.injectDefineConfigHeader; } });
|
|
39
40
|
__exportStar(require("./constants"), exports);
|
|
40
41
|
__exportStar(require("./dotenv"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAgC;AAChC,qDAAoC;AAE7B,MAAM,WAAW,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAA;AAAlD,QAAA,WAAW,eAAuC;AAE/D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAgC;AAChC,qDAAoC;AAE7B,MAAM,WAAW,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAA;AAAlD,QAAA,WAAW,eAAuC;AAE/D,iDAA0F;AAAjF,qIAAA,OAAO,OAAuB;AAAE,yHAAA,wBAAwB,OAAA;AACjE,8CAA2B;AAC3B,2CAAwB;AACxB,4CAAyB;AACzB,6CAA4B;AAC5B,6CAA4D;AAAnD,iIAAA,OAAO,OAAqB;AACrC,6CAA0B;AAC1B,0CAAuB"}
|
package/dist/npm.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export interface IInstallOptions {
|
|
|
4
4
|
peerDependencies?: boolean;
|
|
5
5
|
}
|
|
6
6
|
export declare const taroPluginPrefix = "@tarojs/plugin-";
|
|
7
|
-
export declare function resolveNpm(pluginName: string, root
|
|
8
|
-
export declare function resolveNpmSync(pluginName: string, root
|
|
7
|
+
export declare function resolveNpm(pluginName: string, root: any): Promise<string>;
|
|
8
|
+
export declare function resolveNpmSync(pluginName: string, root: any): string;
|
|
9
9
|
export declare function installNpmPkg(pkgList: string[] | string, options: IInstallOptions): any;
|
|
10
10
|
export declare const callPlugin: pluginFunction;
|
|
11
11
|
export declare const callPluginSync: pluginFunction;
|