@tarojs/plugin-inject 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/dist/index.js +18 -17
- package/dist/index.js.map +1 -1
- package/dist/runtime.js.map +1 -1
- package/package.json +10 -10
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/dist/index.js
CHANGED
|
@@ -2,28 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var path = require('node:path');
|
|
6
5
|
var helper = require('@tarojs/helper');
|
|
7
6
|
var shared = require('@tarojs/shared');
|
|
7
|
+
var path = require('path');
|
|
8
8
|
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
9
|
+
function _interopNamespace(e) {
|
|
10
|
+
if (e && e.__esModule) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
20
19
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n["default"] = e;
|
|
24
|
+
return Object.freeze(n);
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
var path__namespace = /*#__PURE__*/
|
|
27
|
+
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
27
28
|
|
|
28
29
|
var index = (ctx, options) => {
|
|
29
30
|
const fs = ctx.helper.fs;
|
|
@@ -102,5 +103,5 @@ export const needPromiseApis = new Set(${asyncApis ? JSON.stringify(asyncApis) :
|
|
|
102
103
|
`);
|
|
103
104
|
}
|
|
104
105
|
|
|
105
|
-
exports
|
|
106
|
+
exports["default"] = index;
|
|
106
107
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["\nimport { esbuild } from '@tarojs/helper'\nimport { isArray, isFunction, isObject, isString } from '@tarojs/shared'\nimport * as path from 'path'\n\nimport type { IPluginContext, TaroPlatformBase } from '@tarojs/service'\n\ntype VoidComponents = Set<string>\ntype NestElements = Map<string, number>\n\nexport interface IOptions {\n voidComponents: string[] | ((list: VoidComponents) => VoidComponents)\n nestElements: Record<string, number> | ((elem: NestElements) => NestElements)\n components: Record<string, Record<string, any>>\n componentsMap: Record<string, string>\n syncApis: string[]\n asyncApis: string[]\n thirdPartyComponents: Record<string, Record<string, any>>\n}\n\nexport default (ctx: IPluginContext, options: IOptions) => {\n const fs = ctx.helper.fs\n\n ctx.registerMethod({\n name: 'onSetupClose',\n fn (platform: TaroPlatformBase) {\n const {\n voidComponents,\n nestElements,\n components,\n syncApis,\n asyncApis,\n componentsMap,\n thirdPartyComponents\n } = options\n\n const template = platform.template\n if (!template) return\n\n if (isArray(voidComponents)) {\n voidComponents.forEach(el => template.voidElements.add(el))\n } else if (isFunction(voidComponents)) {\n template.voidElements = voidComponents(template.voidElements)\n }\n\n if (isObject<NestElements>(nestElements)) {\n for (const key in nestElements) {\n template.nestElements.set(key, nestElements[key])\n }\n } else if (isFunction(nestElements)) {\n template.nestElements = nestElements(template.nestElements)\n }\n\n if (components || syncApis || asyncApis || componentsMap) {\n injectRuntimePath(platform)\n\n if (components) {\n template.mergeComponents(ctx, components)\n }\n\n if (componentsMap) {\n injectComponentsReact(fs, platform.taroComponentsPath, componentsMap)\n platform.taroComponentsPath = `@tarojs/plugin-inject/dist/components-react`\n }\n\n injectComponents(fs, components)\n injectApis(fs, syncApis, asyncApis)\n }\n\n if (thirdPartyComponents) {\n template.mergeThirdPartyComponents(thirdPartyComponents)\n }\n }\n })\n}\n\nfunction injectRuntimePath (platform: TaroPlatformBase) {\n const injectedPath = `@tarojs/plugin-inject/dist/runtime`\n if (isArray(platform.runtimePath)) {\n platform.runtimePath.push(injectedPath)\n } else if (isString(platform.runtimePath)) {\n platform.runtimePath = [platform.runtimePath, injectedPath]\n }\n}\n\nfunction injectComponentsReact (fs, taroComponentsPath, componentsMap) {\n const filePath = path.resolve(__dirname, '../dist/components-react.js')\n fs.writeFileSync(filePath, `\nexport * from '${taroComponentsPath}'\n${Object.keys(componentsMap).map((key) => `export const ${key} = '${componentsMap[key]}'`).join('\\n')}\n`)\n // 提前使用 esbuild 进行 bundle,避免 Webpack 分析过程中的错误,#13299 #14520\n const result = esbuild.buildSync({\n entryPoints: [filePath],\n bundle: true,\n write: false,\n format: 'esm',\n })\n fs.writeFileSync(filePath, result.outputFiles[0].text)\n}\n\nfunction injectComponents (fs, components) {\n fs.writeFileSync(path.resolve(__dirname, '../dist/components.js'), `\nexport const components = ${components ? JSON.stringify(components) : JSON.stringify({})};\n`)\n}\n\nfunction injectApis (fs, syncApis, asyncApis) {\n fs.writeFileSync(path.resolve(__dirname, '../dist/apis-list.js'), `\nexport const noPromiseApis = new Set(${syncApis ? JSON.stringify(syncApis) : JSON.stringify([])});\nexport const needPromiseApis = new Set(${asyncApis ? JSON.stringify(asyncApis) : JSON.stringify([])});\n`)\n}\n"],"names":["isArray","isFunction","isObject","isString","path","esbuild"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,YAAe,CAAC,GAAmB,EAAE,OAAiB,KAAI;AACxD,IAAA,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;IAExB,GAAG,CAAC,cAAc,CAAC;AACjB,QAAA,IAAI,EAAE,cAAc;AACpB,QAAA,EAAE,CAAE,QAA0B,EAAA;AAC5B,YAAA,MAAM,EACJ,cAAc,EACd,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,SAAS,EACT,aAAa,EACb,oBAAoB,EACrB,GAAG,OAAO,CAAA;AAEX,YAAA,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAA;AAClC,YAAA,IAAI,CAAC,QAAQ;gBAAE,OAAM;AAErB,YAAA,IA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M,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AACxD,CAAC;AAED,SAAS,gBAAgB,CAAE,EAAE,EAAE,UAAU,EAAA;IACvC,EAAE,CAAC,aAAa,CAACD,eAAI,CAAC,OAAO,CAAC,SAAS,EAAE,uBAAuB,CAAC,EAAE,CAAA;AACzC,0BAAA,EAAA,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;AACvF,CAAA,CAAC,CAAA;AACF,CAAC;AAED,SAAS,UAAU,CAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAA;IAC1C,EAAE,CAAC,aAAa,CAACA,eAAI,CAAC,OAAO,CAAC,SAAS,EAAE,sBAAsB,CAAC,EAAE,CAAA;AAC7B,qCAAA,EAAA,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;AACtD,uCAAA,EAAA,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;AAClG,CAAA,CAAC,CAAA;AACF;;;;"}
|
package/dist/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sources":["../src/runtime.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"runtime.js","sources":["../src/runtime.ts"],"sourcesContent":["import { mergeInternalComponents, mergeReconciler, processApis } from '@tarojs/shared'\n\nimport { needPromiseApis, noPromiseApis } from './apis-list'\nimport { components } from './components'\n\nconst hostConfig = {\n initNativeApi (taro) {\n const global = taro.miniGlobal\n processApis(taro, global, {\n noPromiseApis,\n needPromiseApis,\n isOnlyPromisify: true\n })\n }\n}\n\n\nmergeReconciler(hostConfig)\nmergeInternalComponents(components)\n"],"names":[],"mappings":";;;;AAKA,MAAM,UAAU,GAAG;AACjB,IAAA,aAAa,CAAE,IAAI,EAAA;AACjB,QAAA,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAA;AAC9B,QAAA,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE;YACxB,aAAa;YACb,eAAe;AACf,YAAA,eAAe,EAAE,IAAI;AACtB,SAAA,CAAC,CAAA;KACH;CACF,CAAA;AAGD,eAAe,CAAC,UAAU,CAAC,CAAA;AAC3B,uBAAuB,CAAC,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/plugin-inject",
|
|
3
|
-
"version": "4.0.1
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "Taro 小程序端平台中间层插件",
|
|
5
|
-
"author": "
|
|
5
|
+
"author": "luckyadam",
|
|
6
6
|
"homepage": "https://github.com/nervjs/taro",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "index.js",
|
|
@@ -20,20 +20,20 @@
|
|
|
20
20
|
"bugs": {
|
|
21
21
|
"url": "https://github.com/NervJS/taro/issues"
|
|
22
22
|
},
|
|
23
|
-
"
|
|
24
|
-
"
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@tarojs/service": "4.0.1",
|
|
25
|
+
"@tarojs/shared": "4.0.1",
|
|
26
|
+
"@tarojs/helper": "4.0.1"
|
|
25
27
|
},
|
|
26
28
|
"devDependencies": {
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
29
|
+
"rollup": "^2.79.0",
|
|
30
|
+
"rollup-plugin-ts": "^3.0.2",
|
|
31
|
+
"typescript": "^4.7.4"
|
|
30
32
|
},
|
|
31
33
|
"peerDependencies": {
|
|
32
|
-
"
|
|
33
|
-
"@tarojs/helper": "4.0.1-alpha.0"
|
|
34
|
+
"react": ">=17"
|
|
34
35
|
},
|
|
35
36
|
"scripts": {
|
|
36
|
-
"prod": "pnpm run build",
|
|
37
37
|
"build": "rollup -c",
|
|
38
38
|
"dev": "rollup -c -w"
|
|
39
39
|
}
|