@dcloudio/uni-quickapp-webview 0.0.1-nvue3.3030820220125001

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.
@@ -0,0 +1,128 @@
1
+ 'use strict';
2
+
3
+ var uniCliShared = require('@dcloudio/uni-cli-shared');
4
+ var initMiniProgramPlugin = require('@dcloudio/uni-mp-vite');
5
+ var path = require('path');
6
+ var shared = require('@vue/shared');
7
+
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
10
+ var initMiniProgramPlugin__default = /*#__PURE__*/_interopDefaultLegacy(initMiniProgramPlugin);
11
+ var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
12
+
13
+ var compilerOptions$1 = {
14
+ target: "es6",
15
+ module: "commonjs"
16
+ };
17
+ var source = {
18
+ compilerOptions: compilerOptions$1
19
+ };
20
+
21
+ const properties = ['name', 'versionName', 'versionCode'];
22
+ function formatAppJson(_appJson, manifestJson, _pagesJson) {
23
+ const appJson = _appJson;
24
+ // 华为IDE V3.0.2+ 需要此属性,否则无法导入
25
+ appJson.appType = 'webapp';
26
+ appJson.minPlatformVersion = 1070;
27
+ properties.forEach((name) => {
28
+ if (shared.hasOwn(manifestJson, name)) {
29
+ appJson[name] = manifestJson[name];
30
+ }
31
+ });
32
+ if (!appJson.name) {
33
+ const inputDir = process.env.UNI_INPUT_DIR;
34
+ let projectname = path__default["default"].basename(inputDir);
35
+ if (projectname === 'src') {
36
+ projectname = path__default["default"].basename(path__default["default"].dirname(inputDir));
37
+ }
38
+ appJson.name = projectname;
39
+ }
40
+ if (!appJson.package) {
41
+ appJson.package = appJson.name;
42
+ }
43
+ if (manifestJson['quickapp-webview']) {
44
+ shared.extend(appJson, manifestJson['quickapp-webview']);
45
+ }
46
+ if (process.env.UNI_SUB_PLATFORM &&
47
+ manifestJson[process.env.UNI_SUB_PLATFORM]) {
48
+ shared.extend(appJson, manifestJson[process.env.UNI_SUB_PLATFORM]);
49
+ }
50
+ if (!appJson.package) {
51
+ console.warn('manifest.json->quickapp-webview 缺少 package 配置');
52
+ }
53
+ if (!appJson.icon) {
54
+ console.warn('manifest.json->quickapp-webview 缺少 icon 配置');
55
+ }
56
+ }
57
+
58
+ const compilerOptions = {
59
+ nodeTransforms: [uniCliShared.transformRef, uniCliShared.transformComponentLink],
60
+ };
61
+ const miniProgram = {
62
+ class: {
63
+ array: true,
64
+ },
65
+ slot: {
66
+ fallbackContent: true,
67
+ dynamicSlotNames: true,
68
+ },
69
+ directive: 'qa:',
70
+ };
71
+ const projectConfigFilename = 'jsconfig.json';
72
+ const options = {
73
+ cdn: process.env.UNI_SUB_PLATFORM === 'quickapp-webview-huawei' ? 200 : 201,
74
+ vite: {
75
+ inject: {
76
+ uni: [path__default["default"].resolve(__dirname, 'uni.api.esm.js'), 'default'],
77
+ },
78
+ alias: {
79
+ 'uni-mp-runtime': path__default["default"].resolve(__dirname, 'uni.mp.esm.js'),
80
+ },
81
+ copyOptions: {},
82
+ },
83
+ global: 'qa',
84
+ app: {
85
+ darkmode: false,
86
+ subpackages: true,
87
+ },
88
+ json: {
89
+ formatAppJson,
90
+ },
91
+ template: Object.assign(Object.assign({}, miniProgram), { filter: {
92
+ extname: '.qjs',
93
+ lang: 'qjs',
94
+ generate(filter, filename) {
95
+ if (filename) {
96
+ return `<qjs src="${filename}.qjs" module="${filter.name}"/>`;
97
+ }
98
+ return `<qjs module="${filter.name}">
99
+ ${filter.code}
100
+ </qjs>`;
101
+ },
102
+ }, extname: '.qxml', compilerOptions }),
103
+ style: {
104
+ extname: '.css',
105
+ },
106
+ project: {
107
+ filename: projectConfigFilename,
108
+ source,
109
+ },
110
+ };
111
+
112
+ const uniQuickappWebviewPlugin = {
113
+ name: 'uni:quickapp-webview',
114
+ config() {
115
+ return {
116
+ define: {
117
+ __VUE_CREATED_DEFERRED__: true,
118
+ },
119
+ build: {
120
+ // css 中不支持引用本地资源
121
+ assetsInlineLimit: uniCliShared.ASSETS_INLINE_LIMIT,
122
+ },
123
+ };
124
+ },
125
+ };
126
+ var index = [uniQuickappWebviewPlugin, ...initMiniProgramPlugin__default["default"](options)];
127
+
128
+ module.exports = index;