@ohos-ports/tarojs-runner-utils 0.0.0-stage → 4.3.0-beta.2

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 ADDED
@@ -0,0 +1,174 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 O2Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ========================================================================
24
+
25
+ MIT (react-devtools):
26
+ The following files embed [react-devtools](https://github.com/facebook/react) MIT:
27
+ `/packages/taro-plugin-react-devtools/src/backend/index.js`
28
+ See `/LICENSE` for details of the license.
29
+
30
+ ==================
31
+
32
+ MIT (vue-devtools):
33
+ The following files embed [vue-devtools](https://github.com/vuejs/devtools) MIT:
34
+ `/packages/taro-plugin-vue-devtools/src/backend/*`
35
+ See `/LICENSE` for details of the license.
36
+
37
+ ==================
38
+
39
+ MIT (vite):
40
+ The following files embed [vite](https://github.com/vitejs/vite) MIT:
41
+ `/packages/taro-webpack5-prebundle/src/prebundle/scanImport.ts`,
42
+ `/packages/taro-webpack5-prebundle/src/prebundle/bundle.ts`,
43
+ `/packages/taro-webpack5-prebundle/src/h5.ts`,
44
+ `/packages/taro-webpack5-prebundle/src/min.ts`
45
+ See `/LICENSE` for details of the license.
46
+
47
+ ==================
48
+
49
+ MIT (webpack):
50
+ The following files embed [webpack](https://github.com/webpack/webpack) MIT:
51
+ `/packages/taro-webpack5-prebundle/src/webpack/TaroContainerEntryModule.ts`,
52
+ `/packages/taro-webpack5-prebundle/src/webpack/TaroContainerPlugin.ts`,
53
+ `/packages/taro-webpack5-prebundle/src/webpack/TaroContainerReferencePlugin.ts`,
54
+ `/packages/taro-webpack5-prebundle/src/webpack/TaroModuleFederationPlugin.ts`
55
+ See `/LICENSE` for details of the license.
56
+
57
+ ==================
58
+
59
+ MIT (sizzle):
60
+ The following files embed [sizzle](https://github.com/jquery/sizzle) MIT:
61
+ `/packages/taro-extends/src/jquery/sizzle.js`
62
+ See `/LICENSE.txt` for details of the license.
63
+
64
+ ==================
65
+
66
+ MIT (zepto):
67
+ The following files embed [zepto](https://github.com/madrobby/zepto) MIT:
68
+ `/packages/taro-extends/src/jquery/zepto.js`,
69
+ `/packages/taro-extends/src/jquery/event.js`
70
+ See `/MIT-LICENSE` for details of the license.
71
+
72
+ ==================
73
+
74
+ MIT (css-to-react-native):
75
+ The following files embed [css-to-react-native](https://github.com/styled-components/css-to-react-native) MIT:
76
+ `/packages/css-to-react-native/src/css-to-react-native/*`
77
+ See `/LICENSE.md` for details of the license.
78
+
79
+ ==================
80
+
81
+ MIT (reactify-wc):
82
+ The following files embed [reactify-wc](https://github.com/BBKolton/reactify-wc) MIT:
83
+ `/packages/taro-components-library-react/src/component-lib/reactify-wc.ts`
84
+ See `/LICENSE` for details of the license.
85
+
86
+ ==================
87
+
88
+ MIT (ant-design-mobile-rn):
89
+ The following files embed [ant-design-mobile-rn](https://github.com/ant-design/ant-design-mobile-rn) MIT:
90
+ `/packages/taro-components-rn/src/components/Swiper/carousel.tsx`
91
+ See `/LICENSE` for details of the license.
92
+
93
+ ==================
94
+
95
+ MIT (react-wx-images-viewer):
96
+ The following files embed [react-wx-images-viewer](https://github.com/react-ld/react-wx-images-viewer) MIT:
97
+ `/packages/taro-h5/src/api/media/image/previewImage.ts`
98
+ See `/LICENSE` for details of the license.
99
+
100
+ ==================
101
+
102
+ MIT (webpack-contrib/css-loader):
103
+ The following files embed [webpack-contrib/css-loader](https://github.com/webpack-contrib/css-loader) MIT:
104
+ `/packages/taro-rn-style-transformer/src/utils/index.ts`
105
+ See `/LICENSE` for details of the license.
106
+
107
+ ==================
108
+
109
+ MIT (react-native):
110
+ The following files embed [react-native](https://github.com/facebook/react-native) MIT:
111
+ `/packages/taro-rn-style-transformer/src/transforms/StyleSheet/*`
112
+ See `/LICENSE` for details of the license.
113
+
114
+ ==================
115
+
116
+ MIT (myrne/performance-now):
117
+ The following files embed [myrne/performance-now](https://github.com/myrne/performance-now) MIT:
118
+ `/packages/taro-runtime/src/bom/raf.ts`
119
+ See `/LICENSE` for details of the license.
120
+
121
+ ==================
122
+
123
+ Apache (chameleon-api):
124
+ The following files embed [chameleon-api](https://github.com/chameleon-team/chameleon-api) Apache:
125
+ `/packages/taro-h5/src/api/device/clipboard.ts`
126
+
127
+ ==================
128
+
129
+ MIT (uni-app):
130
+ The following files embed [uni-app](https://github.com/dcloudio/uni-app) MIT:
131
+ `/packages/taro-components-rn/src/components/Video/index.tsx`
132
+ See `/LICENSE` for details of the license.
133
+
134
+ ==================
135
+
136
+ MIT (miniprogram-render):
137
+ The following files embed [miniprogram-render](https://github.com/Tencent/kbone) MIT:
138
+ `/packages/taro-plugin-http/src/runtime/Cookie.ts`
139
+ See `/LICENSE` for details of the license.
140
+
141
+ ==================
142
+
143
+ MIT (stencil-ds-output-targets):
144
+ The following files embed [stencil-ds-output-targets](https://github.com/ionic-team/stencil-ds-output-targets/) MIT:
145
+ `/packages/taro-components-library-react/src/react-component-lib/utils/attachProps.ts`
146
+ `/packages/taro-components-library-react/src/react-component-lib/utils/case.ts`
147
+ `/packages/taro-components-library-react/src/react-component-lib/utils/dev.ts`
148
+ `/packages/taro-components-library-react/src/react-component-lib/utils/index.tsx`
149
+ `/packages/taro-components-library-react/src/react-component-lib/createComponent.tsx`
150
+ `/packages/taro-components-library-react/src/react-component-lib/createOverlayComponent.tsx`
151
+ `/packages/taro-components-library-react/src/react-component-lib/interfaces.ts`
152
+ `/packages/taro-components-library-vue3/src/vue-component-lib/utils.ts`
153
+ See `/LICENSE` for details of the license.
154
+
155
+ ==================
156
+
157
+ MIT (weui):
158
+ The following files embed [weui](https://github.com/Tencent/weui) MIT:
159
+ `/packages/taro-components/src/components/*.scss`
160
+ See `/LICENSE.txt` for details of the license.
161
+
162
+ ==================
163
+
164
+ Apache-2.0 (intersection-observer):
165
+ The following files embed [intersection-observer](https://github.com/GoogleChromeLabs/intersection-observer) Apache-2.0:
166
+ `/packages/taro-api/src/polyfill/intersection-observer.ts`
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
- # Temporary Holding Version
1
+ ### `@tarojs/runner-utils`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 暴露给 runner 的公用工具函数。
@@ -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,52 @@
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;
@@ -0,0 +1,4 @@
1
+ export * from './constant';
2
+ export * from './resolve/MultiPlatformPlugin';
3
+ export * from './scss';
4
+ export * from './vite';
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
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("./resolve/MultiPlatformPlugin"), exports);
19
+ __exportStar(require("./scss"), exports);
20
+ __exportStar(require("./vite"), exports);
@@ -0,0 +1,28 @@
1
+ interface IOptions {
2
+ include?: string[];
3
+ chain?: any;
4
+ }
5
+ /**
6
+ * @description 此 enhance-resolve 插件用于根据当前编译的平台,解析多端文件的后缀
7
+ *
8
+ * @property {string} source resolver hook 类别
9
+ * @property {string} target 解析完成后需要触发的钩子
10
+ * @property {IOptions} options 插件配置项
11
+ *
12
+ * @example
13
+ * there's filepath 'src/index'
14
+ * when platform is weapp, we get 'src/index.weapp.[js|ts|jsx|tsx]'
15
+ * when platform is h5, we get 'src/index.h5.[js|ts|jsx|tsx]'
16
+ * by default, we get 'src/index.[js|ts|jsx|tsx]'
17
+ *
18
+ * @class MultiPlatformPlugin
19
+ */
20
+ export declare class MultiPlatformPlugin {
21
+ private source;
22
+ private target;
23
+ private options;
24
+ constructor(source: string, target: string, options?: IOptions);
25
+ apply(resolver: any): void;
26
+ private includes;
27
+ }
28
+ export {};
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MultiPlatformPlugin = void 0;
4
+ const path = require("node:path");
5
+ const helper_1 = require("@tarojs/helper");
6
+ /**
7
+ * @description 此 enhance-resolve 插件用于根据当前编译的平台,解析多端文件的后缀
8
+ *
9
+ * @property {string} source resolver hook 类别
10
+ * @property {string} target 解析完成后需要触发的钩子
11
+ * @property {IOptions} options 插件配置项
12
+ *
13
+ * @example
14
+ * there's filepath 'src/index'
15
+ * when platform is weapp, we get 'src/index.weapp.[js|ts|jsx|tsx]'
16
+ * when platform is h5, we get 'src/index.h5.[js|ts|jsx|tsx]'
17
+ * by default, we get 'src/index.[js|ts|jsx|tsx]'
18
+ *
19
+ * @class MultiPlatformPlugin
20
+ */
21
+ class MultiPlatformPlugin {
22
+ constructor(source, target, options) {
23
+ this.source = source;
24
+ this.target = target;
25
+ this.options = options || {};
26
+ }
27
+ apply(resolver) {
28
+ const target = resolver.ensureHook(this.target);
29
+ resolver
30
+ .getHook(this.source)
31
+ .tapAsync('MultiPlatformPlugin', (request, resolveContext, callback) => {
32
+ var _a, _b, _c;
33
+ const innerRequest = request.request || request.path;
34
+ if (!innerRequest || (request.context.hasOwnProperty('issuer') && !request.context.issuer))
35
+ return callback();
36
+ if (!path.extname(innerRequest)) {
37
+ let srcRequest;
38
+ if (path.isAbsolute(innerRequest)) {
39
+ // absolute path
40
+ srcRequest = innerRequest;
41
+ }
42
+ else if (!path.isAbsolute(innerRequest) && /^\./.test(innerRequest)) {
43
+ // relative path
44
+ srcRequest = path.resolve(request.path, request.request);
45
+ }
46
+ else {
47
+ return callback();
48
+ }
49
+ if (helper_1.REG_NODE_MODULES.test(srcRequest) && !this.includes(srcRequest)) {
50
+ return callback();
51
+ }
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();
53
+ const newRequestStr = helper_1.default.resolveMainFilePath(srcRequest, extensions);
54
+ if (newRequestStr === innerRequest)
55
+ return callback();
56
+ const obj = Object.assign({}, request, {
57
+ request: newRequestStr
58
+ });
59
+ return resolver.doResolve(target, obj, 'resolve multi platform file path', resolveContext, (err, result) => {
60
+ if (err)
61
+ return callback(err);
62
+ if (result === undefined)
63
+ return callback(null, null);
64
+ return callback(null, result);
65
+ });
66
+ }
67
+ callback();
68
+ });
69
+ }
70
+ includes(filePath) {
71
+ if (!this.options.include || !this.options.include.length)
72
+ return false;
73
+ filePath = filePath.replace(/[\\/]/g, '/');
74
+ const res = this.options.include.find(item => filePath.includes(item));
75
+ return Boolean(res);
76
+ }
77
+ }
78
+ exports.MultiPlatformPlugin = MultiPlatformPlugin;
package/dist/scss.d.ts ADDED
@@ -0,0 +1,37 @@
1
+ import { BundleResult } from 'scss-bundle';
2
+ interface LoaderOption {
3
+ data?: string;
4
+ [key: string]: any;
5
+ }
6
+ interface BuildConfig {
7
+ sass?: {
8
+ resource?: string | string[];
9
+ projectDirectory?: string;
10
+ data?: string;
11
+ };
12
+ sassLoaderOption?: LoaderOption;
13
+ }
14
+ /**
15
+ * Return bundled sass content.
16
+ *
17
+ * @param {string} url Absolute file path.
18
+ * @param {(string | undefined)} projectDirectory Absolute project location, where node_modules are located.
19
+ * Used for resolving tilde imports.
20
+ * @returns Bundle result.
21
+ */
22
+ export declare function getBundleResult(url: string, projectDirectory?: string | undefined): Promise<BundleResult>;
23
+ /**
24
+ * Return bundled sass content, but input resource can be a single string or an array.
25
+ * @param {(string | string[])} resource Input file path or a path array.
26
+ * @param {(string | undefined)} projectDirectory Absolute project location, where node_modules are located.
27
+ * Used for resolving tilde imports.
28
+ * @returns Bundle result.
29
+ */
30
+ export declare function getBundleContent(resource: string | string[], projectDirectory?: string | undefined): Promise<string | undefined>;
31
+ /**
32
+ * Return the merged sass loader option.
33
+ * @param {BuildConfig} param0 Build config.
34
+ * @returns Merged sass loader option.
35
+ */
36
+ export declare function getSassLoaderOption({ sass, sassLoaderOption }: BuildConfig): Promise<LoaderOption>;
37
+ export default getSassLoaderOption;
package/dist/scss.js ADDED
@@ -0,0 +1,111 @@
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.getSassLoaderOption = exports.getBundleContent = exports.getBundleResult = void 0;
13
+ const path = require("node:path");
14
+ const helper_1 = require("@tarojs/helper");
15
+ const scss_bundle_1 = require("scss-bundle");
16
+ /**
17
+ * Return bundled sass content.
18
+ *
19
+ * @param {string} url Absolute file path.
20
+ * @param {(string | undefined)} projectDirectory Absolute project location, where node_modules are located.
21
+ * Used for resolving tilde imports.
22
+ * @returns Bundle result.
23
+ */
24
+ function getBundleResult(url_1) {
25
+ return __awaiter(this, arguments, void 0, function* (url, projectDirectory = undefined) {
26
+ let bundler = new scss_bundle_1.Bundler();
27
+ if (projectDirectory) {
28
+ bundler = new scss_bundle_1.Bundler(undefined, projectDirectory);
29
+ }
30
+ const res = yield bundler.bundle(url);
31
+ return res;
32
+ });
33
+ }
34
+ exports.getBundleResult = getBundleResult;
35
+ /**
36
+ * Return bundled sass content, but input resource can be a single string or an array.
37
+ * @param {(string | string[])} resource Input file path or a path array.
38
+ * @param {(string | undefined)} projectDirectory Absolute project location, where node_modules are located.
39
+ * Used for resolving tilde imports.
40
+ * @returns Bundle result.
41
+ */
42
+ function getBundleContent(resource_1) {
43
+ return __awaiter(this, arguments, void 0, function* (resource, projectDirectory = undefined) {
44
+ let result = '';
45
+ try {
46
+ if (typeof resource === 'string') {
47
+ const res = yield getBundleResult(resource, projectDirectory);
48
+ result = res.bundledContent;
49
+ }
50
+ if (Array.isArray(resource)) {
51
+ for (const url of resource) {
52
+ const res = yield getBundleResult(url, projectDirectory);
53
+ result += res.bundledContent || '';
54
+ }
55
+ }
56
+ }
57
+ catch (error) {
58
+ throw new Error(error);
59
+ }
60
+ return result;
61
+ });
62
+ }
63
+ exports.getBundleContent = getBundleContent;
64
+ /**
65
+ * Check if global imported sass file exists.
66
+ *
67
+ * @param {(string | string[])} resource
68
+ * @param {(string | undefined)} rootDir
69
+ */
70
+ function checkPath(resource, rootDir) {
71
+ if (Array.isArray(resource)) {
72
+ resource.forEach(item => {
73
+ const url = rootDir ? path.resolve(rootDir, item) : item;
74
+ if (!helper_1.fs.existsSync(url)) {
75
+ throw new Error(`全局注入 scss 文件路径错误: ${url}`);
76
+ }
77
+ });
78
+ }
79
+ else if (typeof resource === 'string') {
80
+ const url = rootDir ? path.resolve(rootDir, resource) : resource;
81
+ if (!helper_1.fs.existsSync(url)) {
82
+ throw new Error(`全局注入 scss 文件路径错误: ${url}`);
83
+ }
84
+ }
85
+ }
86
+ /**
87
+ * Return the merged sass loader option.
88
+ * @param {BuildConfig} param0 Build config.
89
+ * @returns Merged sass loader option.
90
+ */
91
+ function getSassLoaderOption(_a) {
92
+ return __awaiter(this, arguments, void 0, function* ({ sass, sassLoaderOption }) {
93
+ sassLoaderOption = sassLoaderOption || {};
94
+ let bundledContent = '';
95
+ if (!sass) {
96
+ return sassLoaderOption;
97
+ }
98
+ const { resource, projectDirectory } = sass;
99
+ if (resource) {
100
+ checkPath(resource, projectDirectory);
101
+ const content = yield getBundleContent(resource, projectDirectory);
102
+ bundledContent += content;
103
+ }
104
+ if (sass.data) {
105
+ bundledContent += sass.data;
106
+ }
107
+ return Object.assign(Object.assign({}, sassLoaderOption), { additionalData: sassLoaderOption.data ? `${sassLoaderOption.data}${bundledContent}` : bundledContent });
108
+ });
109
+ }
110
+ exports.getSassLoaderOption = getSassLoaderOption;
111
+ exports.default = getSassLoaderOption;
package/dist/vite.d.ts ADDED
@@ -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): Promise<ViteHarmonyCompilerContext | void>;
5
+ export declare function getViteMiniCompilerContext(rollupPluginContext: PluginContext): ViteMiniCompilerContext | void;
package/dist/vite.js ADDED
@@ -0,0 +1,39 @@
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
+ return __awaiter(this, void 0, void 0, function* () {
26
+ const info = process.env.NODE_ENV === 'production'
27
+ ? rollupPluginContext.getModuleInfo(constant_1.VITE_COMPILER_LABEL)
28
+ : yield rollupPluginContext.load({ id: constant_1.VITE_COMPILER_LABEL });
29
+ const compiler = info === null || info === void 0 ? void 0 : info.meta.viteCompilerContext;
30
+ return compiler;
31
+ });
32
+ }
33
+ exports.getViteHarmonyCompilerContext = getViteHarmonyCompilerContext;
34
+ function getViteMiniCompilerContext(rollupPluginContext) {
35
+ const info = rollupPluginContext.getModuleInfo(constant_1.VITE_COMPILER_LABEL);
36
+ const compiler = info === null || info === void 0 ? void 0 : info.meta.viteCompilerContext;
37
+ return compiler;
38
+ }
39
+ exports.getViteMiniCompilerContext = getViteMiniCompilerContext;
package/package.json CHANGED
@@ -1,6 +1,39 @@
1
1
  {
2
2
  "name": "@ohos-ports/tarojs-runner-utils",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "4.3.0-beta.2",
4
+ "description": "Taro runner utilities.",
5
+ "author": "O2Team",
6
+ "license": "MIT",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/ohos-ports/ohos-ports.git",
15
+ "directory": "ports/tarojs-runner-utils/4.3.0"
16
+ },
17
+ "keywords": [
18
+ "taro"
19
+ ],
20
+ "engines": {
21
+ "node": ">= 18"
22
+ },
23
+ "dependencies": {
24
+ "rollup": "^3.29.4",
25
+ "scss-bundle": "^3.1.2",
26
+ "@tarojs/helper": "npm:@ohos-ports/tarojs-helper@4.3.0-beta.2"
27
+ },
28
+ "devDependencies": {
29
+ "@tarojs/taro": "4.3.0"
30
+ },
31
+ "scripts": {
32
+ "prod": "pnpm run build",
33
+ "build": "tsc",
34
+ "dev": "tsc -w"
35
+ },
36
+ "bugs": {
37
+ "url": "https://github.com/ohos-ports/ohos-ports/issues"
38
+ }
39
+ }