@dcloudio/uni-cli-shared 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.
Files changed (236) hide show
  1. package/dist/checkUpdate.d.ts +30 -0
  2. package/dist/checkUpdate.js +243 -0
  3. package/dist/constants.d.ts +19 -0
  4. package/dist/constants.js +43 -0
  5. package/dist/deps.d.ts +19 -0
  6. package/dist/deps.js +39 -0
  7. package/dist/easycom.d.ts +29 -0
  8. package/dist/easycom.js +202 -0
  9. package/dist/env/define.d.ts +15 -0
  10. package/dist/env/define.js +45 -0
  11. package/dist/env/index.d.ts +2 -0
  12. package/dist/env/index.js +8 -0
  13. package/dist/env/provide.d.ts +9 -0
  14. package/dist/env/provide.js +24 -0
  15. package/dist/esbuild.d.ts +3 -0
  16. package/dist/esbuild.js +42 -0
  17. package/dist/exports.d.ts +1 -0
  18. package/dist/exports.js +8 -0
  19. package/dist/filter.d.ts +16 -0
  20. package/dist/filter.js +60 -0
  21. package/dist/fs.d.ts +1 -0
  22. package/dist/fs.js +25 -0
  23. package/dist/hbx/alias.d.ts +5 -0
  24. package/dist/hbx/alias.js +75 -0
  25. package/dist/hbx/env.d.ts +6 -0
  26. package/dist/hbx/env.js +44 -0
  27. package/dist/hbx/index.d.ts +3 -0
  28. package/dist/hbx/index.js +36 -0
  29. package/dist/hbx/log.d.ts +6 -0
  30. package/dist/hbx/log.js +99 -0
  31. package/dist/i18n.d.ts +10 -0
  32. package/dist/i18n.js +94 -0
  33. package/dist/index.d.ts +25 -0
  34. package/dist/index.js +40 -0
  35. package/dist/json/app/index.d.ts +3 -0
  36. package/dist/json/app/index.js +17 -0
  37. package/dist/json/app/manifest/arguments.d.ts +2 -0
  38. package/dist/json/app/manifest/arguments.js +36 -0
  39. package/dist/json/app/manifest/confusion.d.ts +4 -0
  40. package/dist/json/app/manifest/confusion.js +77 -0
  41. package/dist/json/app/manifest/defaultManifestJson.d.ts +1 -0
  42. package/dist/json/app/manifest/defaultManifestJson.js +41 -0
  43. package/dist/json/app/manifest/env.d.ts +3 -0
  44. package/dist/json/app/manifest/env.js +24 -0
  45. package/dist/json/app/manifest/i18n.d.ts +1 -0
  46. package/dist/json/app/manifest/i18n.js +14 -0
  47. package/dist/json/app/manifest/index.d.ts +4 -0
  48. package/dist/json/app/manifest/index.js +49 -0
  49. package/dist/json/app/manifest/launchwebview.d.ts +1 -0
  50. package/dist/json/app/manifest/launchwebview.js +32 -0
  51. package/dist/json/app/manifest/merge.d.ts +1 -0
  52. package/dist/json/app/manifest/merge.js +17 -0
  53. package/dist/json/app/manifest/nvue.d.ts +4 -0
  54. package/dist/json/app/manifest/nvue.js +43 -0
  55. package/dist/json/app/manifest/plus.d.ts +1 -0
  56. package/dist/json/app/manifest/plus.js +83 -0
  57. package/dist/json/app/manifest/safearea.d.ts +1 -0
  58. package/dist/json/app/manifest/safearea.js +28 -0
  59. package/dist/json/app/manifest/splashscreen.d.ts +5 -0
  60. package/dist/json/app/manifest/splashscreen.js +44 -0
  61. package/dist/json/app/manifest/statusbar.d.ts +1 -0
  62. package/dist/json/app/manifest/statusbar.js +14 -0
  63. package/dist/json/app/manifest/tabBar.d.ts +1 -0
  64. package/dist/json/app/manifest/tabBar.js +27 -0
  65. package/dist/json/app/manifest/uniApp.d.ts +1 -0
  66. package/dist/json/app/manifest/uniApp.js +19 -0
  67. package/dist/json/app/pages/code.d.ts +3 -0
  68. package/dist/json/app/pages/code.js +44 -0
  69. package/dist/json/app/pages/definePage.d.ts +2 -0
  70. package/dist/json/app/pages/definePage.js +42 -0
  71. package/dist/json/app/pages/index.d.ts +3 -0
  72. package/dist/json/app/pages/index.js +28 -0
  73. package/dist/json/app/pages/uniConfig.d.ts +1 -0
  74. package/dist/json/app/pages/uniConfig.js +69 -0
  75. package/dist/json/app/pages/uniRoutes.d.ts +1 -0
  76. package/dist/json/app/pages/uniRoutes.js +8 -0
  77. package/dist/json/index.d.ts +5 -0
  78. package/dist/json/index.js +17 -0
  79. package/dist/json/json.d.ts +1 -0
  80. package/dist/json/json.js +9 -0
  81. package/dist/json/manifest.d.ts +28 -0
  82. package/dist/json/manifest.js +64 -0
  83. package/dist/json/mp/index.d.ts +4 -0
  84. package/dist/json/mp/index.js +19 -0
  85. package/dist/json/mp/jsonFile.d.ts +23 -0
  86. package/dist/json/mp/jsonFile.js +127 -0
  87. package/dist/json/mp/pages.d.ts +17 -0
  88. package/dist/json/mp/pages.js +126 -0
  89. package/dist/json/mp/project.d.ts +14 -0
  90. package/dist/json/mp/project.js +81 -0
  91. package/dist/json/mp/types.d.ts +118 -0
  92. package/dist/json/mp/types.js +2 -0
  93. package/dist/json/mp/utils.d.ts +3 -0
  94. package/dist/json/mp/utils.js +66 -0
  95. package/dist/json/pages.d.ts +30 -0
  96. package/dist/json/pages.js +383 -0
  97. package/dist/logs/console.d.ts +4 -0
  98. package/dist/logs/console.js +49 -0
  99. package/dist/logs/format.d.ts +11 -0
  100. package/dist/logs/format.js +82 -0
  101. package/dist/logs/index.d.ts +1 -0
  102. package/dist/logs/index.js +7 -0
  103. package/dist/messages/index.d.ts +20 -0
  104. package/dist/messages/index.js +23 -0
  105. package/dist/mp/ast.d.ts +4 -0
  106. package/dist/mp/ast.js +12 -0
  107. package/dist/mp/constants.d.ts +5 -0
  108. package/dist/mp/constants.js +8 -0
  109. package/dist/mp/event.d.ts +5 -0
  110. package/dist/mp/event.js +35 -0
  111. package/dist/mp/externalClasses.d.ts +5 -0
  112. package/dist/mp/externalClasses.js +42 -0
  113. package/dist/mp/imports.d.ts +12 -0
  114. package/dist/mp/imports.js +72 -0
  115. package/dist/mp/index.d.ts +11 -0
  116. package/dist/mp/index.js +38 -0
  117. package/dist/mp/nvue.d.ts +1 -0
  118. package/dist/mp/nvue.js +18 -0
  119. package/dist/mp/plugin.d.ts +2 -0
  120. package/dist/mp/plugin.js +13 -0
  121. package/dist/mp/style.d.ts +1 -0
  122. package/dist/mp/style.js +9 -0
  123. package/dist/mp/tags.d.ts +1 -0
  124. package/dist/mp/tags.js +117 -0
  125. package/dist/mp/template.d.ts +73 -0
  126. package/dist/mp/template.js +73 -0
  127. package/dist/mp/usingComponents.d.ts +65 -0
  128. package/dist/mp/usingComponents.js +402 -0
  129. package/dist/mp/wxs.d.ts +2 -0
  130. package/dist/mp/wxs.js +55 -0
  131. package/dist/platform.d.ts +2 -0
  132. package/dist/platform.js +31 -0
  133. package/dist/postcss/index.d.ts +10 -0
  134. package/dist/postcss/index.js +19 -0
  135. package/dist/postcss/plugins/stylePluginScoped.d.ts +3 -0
  136. package/dist/postcss/plugins/stylePluginScoped.js +176 -0
  137. package/dist/postcss/plugins/uniapp.d.ts +11 -0
  138. package/dist/postcss/plugins/uniapp.js +110 -0
  139. package/dist/preprocess/context.d.ts +3 -0
  140. package/dist/preprocess/context.js +81 -0
  141. package/dist/preprocess/index.d.ts +9 -0
  142. package/dist/preprocess/index.js +28 -0
  143. package/dist/resolve.d.ts +6 -0
  144. package/dist/resolve.js +102 -0
  145. package/dist/scripts.d.ts +10 -0
  146. package/dist/scripts.js +44 -0
  147. package/dist/ssr.d.ts +4 -0
  148. package/dist/ssr.js +20 -0
  149. package/dist/url.d.ts +2 -0
  150. package/dist/url.js +15 -0
  151. package/dist/utils.d.ts +13 -0
  152. package/dist/utils.js +80 -0
  153. package/dist/vite/features.d.ts +41 -0
  154. package/dist/vite/features.js +191 -0
  155. package/dist/vite/index.d.ts +36 -0
  156. package/dist/vite/index.js +17 -0
  157. package/dist/vite/plugins/console.d.ts +8 -0
  158. package/dist/vite/plugins/console.js +42 -0
  159. package/dist/vite/plugins/copy.d.ts +11 -0
  160. package/dist/vite/plugins/copy.js +51 -0
  161. package/dist/vite/plugins/cssScoped.d.ts +6 -0
  162. package/dist/vite/plugins/cssScoped.js +54 -0
  163. package/dist/vite/plugins/dynamicImportPolyfill.d.ts +2 -0
  164. package/dist/vite/plugins/dynamicImportPolyfill.js +15 -0
  165. package/dist/vite/plugins/index.d.ts +10 -0
  166. package/dist/vite/plugins/index.js +32 -0
  167. package/dist/vite/plugins/inject.d.ts +12 -0
  168. package/dist/vite/plugins/inject.js +207 -0
  169. package/dist/vite/plugins/jsonJs.d.ts +3 -0
  170. package/dist/vite/plugins/jsonJs.js +52 -0
  171. package/dist/vite/plugins/mainJs.d.ts +2 -0
  172. package/dist/vite/plugins/mainJs.js +29 -0
  173. package/dist/vite/plugins/vitejs/config.d.ts +1 -0
  174. package/dist/vite/plugins/vitejs/config.js +2 -0
  175. package/dist/vite/plugins/vitejs/constants.d.ts +8 -0
  176. package/dist/vite/plugins/vitejs/constants.js +11 -0
  177. package/dist/vite/plugins/vitejs/index.d.ts +1 -0
  178. package/dist/vite/plugins/vitejs/index.js +2 -0
  179. package/dist/vite/plugins/vitejs/plugin.d.ts +1 -0
  180. package/dist/vite/plugins/vitejs/plugin.js +2 -0
  181. package/dist/vite/plugins/vitejs/plugins/asset.d.ts +40 -0
  182. package/dist/vite/plugins/vitejs/plugins/asset.js +270 -0
  183. package/dist/vite/plugins/vitejs/plugins/css.d.ts +48 -0
  184. package/dist/vite/plugins/vitejs/plugins/css.js +760 -0
  185. package/dist/vite/plugins/vitejs/server/moduleGraph.d.ts +1 -0
  186. package/dist/vite/plugins/vitejs/server/moduleGraph.js +2 -0
  187. package/dist/vite/plugins/vitejs/utils.d.ts +29 -0
  188. package/dist/vite/plugins/vitejs/utils.js +129 -0
  189. package/dist/vite/utils/ast.d.ts +17 -0
  190. package/dist/vite/utils/ast.js +85 -0
  191. package/dist/vite/utils/index.d.ts +7 -0
  192. package/dist/vite/utils/index.js +23 -0
  193. package/dist/vite/utils/plugin.d.ts +11 -0
  194. package/dist/vite/utils/plugin.js +45 -0
  195. package/dist/vite/utils/url.d.ts +28 -0
  196. package/dist/vite/utils/url.js +69 -0
  197. package/dist/vite/utils/utils.d.ts +3 -0
  198. package/dist/vite/utils/utils.js +14 -0
  199. package/dist/vue/babel.d.ts +3 -0
  200. package/dist/vue/babel.js +17 -0
  201. package/dist/vue/index.d.ts +4 -0
  202. package/dist/vue/index.js +19 -0
  203. package/dist/vue/transforms/index.d.ts +13 -0
  204. package/dist/vue/transforms/index.js +48 -0
  205. package/dist/vue/transforms/templateTransformAssetUrl.d.ts +33 -0
  206. package/dist/vue/transforms/templateTransformAssetUrl.js +150 -0
  207. package/dist/vue/transforms/templateTransformSrcset.d.ts +4 -0
  208. package/dist/vue/transforms/templateTransformSrcset.js +122 -0
  209. package/dist/vue/transforms/templateUtils.d.ts +9 -0
  210. package/dist/vue/transforms/templateUtils.js +41 -0
  211. package/dist/vue/transforms/transformComponent.d.ts +3 -0
  212. package/dist/vue/transforms/transformComponent.js +26 -0
  213. package/dist/vue/transforms/transformEvent.d.ts +2 -0
  214. package/dist/vue/transforms/transformEvent.js +28 -0
  215. package/dist/vue/transforms/transformPageHead.d.ts +2 -0
  216. package/dist/vue/transforms/transformPageHead.js +11 -0
  217. package/dist/vue/transforms/transformRef.d.ts +2 -0
  218. package/dist/vue/transforms/transformRef.js +32 -0
  219. package/dist/vue/transforms/transformTag.d.ts +2 -0
  220. package/dist/vue/transforms/transformTag.js +18 -0
  221. package/dist/vue/transforms/vModel.d.ts +12 -0
  222. package/dist/vue/transforms/vModel.js +33 -0
  223. package/dist/vue/transforms/vOn.d.ts +15 -0
  224. package/dist/vue/transforms/vOn.js +88 -0
  225. package/dist/vue/utils.d.ts +31 -0
  226. package/dist/vue/utils.js +120 -0
  227. package/dist/watcher.d.ts +30 -0
  228. package/dist/watcher.js +92 -0
  229. package/lib/crypto.js +65 -0
  230. package/lib/nvue.css +34 -0
  231. package/lib/preprocess/LICENSE +13 -0
  232. package/lib/preprocess/README.md +410 -0
  233. package/lib/preprocess/lib/preprocess.js +437 -0
  234. package/lib/preprocess/lib/regexrules.js +121 -0
  235. package/lib/preprocess/package.json +68 -0
  236. package/package.json +68 -0
@@ -0,0 +1,437 @@
1
+ /*
2
+ * preprocess
3
+ * https://github.com/onehealth/preprocess
4
+ *
5
+ * Copyright (c) 2012 OneHealth Solutions, Inc.
6
+ * Written by Jarrod Overson - http://jarrodoverson.com/
7
+ * Licensed under the Apache 2.0 license.
8
+ */
9
+
10
+ 'use strict';
11
+
12
+ exports.preprocess = preprocess;
13
+ exports.preprocessFile = preprocessFile;
14
+ exports.preprocessFileSync = preprocessFileSync;
15
+
16
+ var path = require('path'),
17
+ fs = require('fs'),
18
+ os = require('os'),
19
+ delim = require('./regexrules'),
20
+ XRegExp = require('xregexp');
21
+
22
+ function preprocessFile(srcFile, destFile, context, callback, options) {
23
+ options = getOptionsForFile(srcFile, options);
24
+ context.src = srcFile;
25
+
26
+ fs.readFile(srcFile, function (err, data) {
27
+ if (err) return callback(err, data);
28
+ var parsed = preprocess(data, context, options);
29
+ fs.writeFile(destFile, parsed, callback);
30
+ });
31
+ }
32
+
33
+ function preprocessFileSync(srcFile, destFile, context, options) {
34
+ options = getOptionsForFile(srcFile, options);
35
+ context.src = srcFile;
36
+
37
+ var data = fs.readFileSync(srcFile);
38
+ var parsed = preprocess(data, context, options);
39
+ return fs.writeFileSync(destFile, parsed);
40
+ }
41
+
42
+ function getOptionsForFile(srcFile, options) {
43
+ options = options || {};
44
+ options.srcDir = options.srcDir || path.dirname(srcFile);
45
+ options.type = options.type || getExtension(srcFile);
46
+
47
+ return options;
48
+ }
49
+
50
+ function getExtension(filename) {
51
+ var ext = path.extname(filename||'').split('.');
52
+ return ext[ext.length - 1];
53
+ }
54
+
55
+ function preprocess(src, context, typeOrOptions) {
56
+ src = src.toString();
57
+ context = context || process.env;
58
+
59
+ // default values
60
+ var options = {
61
+ fileNotFoundSilentFail: false,
62
+ srcDir: process.cwd(),
63
+ srcEol: getEolType(src),
64
+ type: delim['html']
65
+ };
66
+
67
+ // needed for backward compatibility with 2.x.x series
68
+ if (typeof typeOrOptions === 'string') {
69
+ typeOrOptions = {
70
+ type: typeOrOptions
71
+ };
72
+ }
73
+
74
+ // needed for backward compatibility with 2.x.x series
75
+ if (typeof context.srcDir === "string") {
76
+ typeOrOptions = typeOrOptions || {};
77
+ typeOrOptions.srcDir = context.srcDir;
78
+ }
79
+
80
+ if (typeOrOptions && typeof typeOrOptions === 'object') {
81
+ options.srcDir = typeOrOptions.srcDir || options.srcDir;
82
+ options.fileNotFoundSilentFail = typeOrOptions.fileNotFoundSilentFail || options.fileNotFoundSilentFail;
83
+ options.srcEol = typeOrOptions.srcEol || options.srcEol;
84
+ options.type = delim[typeOrOptions.type] || options.type;
85
+ }
86
+
87
+ context = copy(context);
88
+
89
+ return preprocessor(src, context, options);
90
+ }
91
+
92
+ function preprocessor(src, context, opts, noRestoreEol) {
93
+ src = normalizeEol(src);
94
+
95
+ var rv = src;
96
+
97
+ rv = replace(rv, opts.type.include, processIncludeDirective.bind(null, false, context, opts));
98
+
99
+ if (opts.type.extend) {
100
+ rv = replaceRecursive(rv, opts.type.extend, function(startMatches, endMatches, include, recurse) {
101
+ var file = (startMatches[1] || '').trim();
102
+ var extendedContext = copy(context);
103
+ var extendedOpts = copy(opts);
104
+ extendedContext.src = path.join(opts.srcDir, file);
105
+ extendedOpts.srcDir = path.dirname(extendedContext.src);
106
+
107
+ var fileContents = getFileContents(extendedContext.src, opts.fileNotFoundSilentFail, context.src);
108
+ if (fileContents.error) {
109
+ return fileContents.contents;
110
+ }
111
+
112
+ var extendedSource = preprocessor(fileContents.contents, extendedContext, extendedOpts, true).trim();
113
+
114
+ if (extendedSource) {
115
+ include = include.replace(/^\n?|\n?$/g, '');
116
+ return replace(extendedSource, opts.type.extendable, recurse(include));
117
+ } else {
118
+ return '';
119
+ }
120
+ });
121
+ }
122
+
123
+ if (opts.type.foreach) {
124
+ rv = replaceRecursive(rv, opts.type.foreach, function(startMatches, endMatches, include, recurse) {
125
+ var variable = (startMatches[1] || '').trim();
126
+ var forParams = variable.split(' ');
127
+ if (forParams.length === 3) {
128
+ var contextVar = forParams[2];
129
+ var arrString = getDeepPropFromObj(context, contextVar);
130
+ var eachArr;
131
+ if (arrString.match(/\{(.*)\}/)) {
132
+ eachArr = JSON.parse(arrString);
133
+ } else if (arrString.match(/\[(.*)\]/)) {
134
+ eachArr = arrString.slice(1, -1);
135
+ eachArr = eachArr.split(',');
136
+ eachArr = eachArr.map(function(arrEntry){
137
+ return arrEntry.replace(/\s*(['"])(.*)\1\s*/, '$2');
138
+ });
139
+ } else {
140
+ eachArr = arrString.split(',');
141
+ }
142
+
143
+ var replaceToken = new RegExp(XRegExp.escape(forParams[0]), 'g');
144
+ var recursedInclude = recurse(include);
145
+
146
+ return Object.keys(eachArr).reduce(function(stringBuilder, arrKey){
147
+ var arrEntry = eachArr[arrKey];
148
+ return stringBuilder + recursedInclude.replace(replaceToken, arrEntry);
149
+ }, '');
150
+ } else {
151
+ return '';
152
+ }
153
+ });
154
+ }
155
+
156
+ if (opts.type.exclude) {
157
+ rv = replaceRecursive(rv, opts.type.exclude, function(startMatches, endMatches, include, recurse){
158
+ var test = (startMatches[1] || '').trim();
159
+ return testPasses(test,context) ? '' : recurse(include);
160
+ });
161
+ }
162
+
163
+ if (opts.type.if) {
164
+ rv = replaceRecursive(rv, opts.type.if, function (startMatches, endMatches, include, recurse) {
165
+ // I need to recurse first, so I don't catch "inner" else-directives
166
+ var recursed = recurse(include);
167
+
168
+ // look for the first else-directive
169
+ var matches = opts.type.else && recursed.match(new RegExp(opts.type.else));
170
+ var match = (matches || [""])[0];
171
+ var index = match ? recursed.indexOf(match) : recursed.length;
172
+
173
+ var ifBlock = recursed.substring(0, index);
174
+ var elseBlock = recursed.substring(index + match.length); // empty string if no else-directive
175
+
176
+ var variant = startMatches[1];
177
+ var test = (startMatches[2] || '').trim();
178
+ // fixed by xxxxxx
179
+ var startLine = padContent(startMatches.input)
180
+ var endLine = padContent(endMatches.input)
181
+ switch(variant) {
182
+ case 'if':
183
+ case 'ifdef': // fixed by xxxxxx
184
+ return testPasses(test, context) ? (startLine + ifBlock + endLine) : (startLine + padContent(ifBlock) + padContent(match || '') + elseBlock + endLine);
185
+ case 'ifndef':
186
+ return !testPasses(test, context) ? (startLine + ifBlock + endLine) : (startLine + padContent(ifBlock) + padContent(match || '') + elseBlock + endLine);
187
+ // case 'ifdef':
188
+ // return typeof getDeepPropFromObj(context, test) !== 'undefined' ? ifBlock : elseBlock;
189
+ // case 'ifndef':
190
+ // return typeof getDeepPropFromObj(context, test) === 'undefined' ? ifBlock : elseBlock;
191
+ default:
192
+ throw new Error('Unknown if variant ' + variant + '.');
193
+ }
194
+ });
195
+ }
196
+
197
+ rv = replace(rv, opts.type.echo, function (match, variable) {
198
+ variable = (variable || '').trim();
199
+ // if we are surrounded by quotes, echo as a string
200
+ var stringMatch = variable.match(/^(['"])(.*)\1$/);
201
+ if (stringMatch) return stringMatch[2];
202
+
203
+ var arrString = getDeepPropFromObj(context, variable);
204
+ return typeof arrString !== 'undefined' ? arrString : '';
205
+ });
206
+
207
+ rv = replace(rv, opts.type.exec, function (match, name, value) {
208
+ name = (name || '').trim();
209
+ value = value || '';
210
+
211
+ var params = value.split(',');
212
+ var stringRegex = /^['"](.*)['"]$/;
213
+
214
+ params = params.map(function(param){
215
+ param = param.trim();
216
+ if (stringRegex.test(param)) { // handle string parameter
217
+ return param.replace(stringRegex, '$1');
218
+ } else { // handle variable parameter
219
+ return getDeepPropFromObj(context, param);
220
+ }
221
+ });
222
+
223
+ var fn = getDeepPropFromObj(context, name);
224
+ if (!fn || typeof fn !== 'function') return '';
225
+
226
+ return fn.apply(context, params);
227
+ });
228
+
229
+ rv = replace(rv, opts.type['include-static'], processIncludeDirective.bind(null, true, context, opts));
230
+
231
+ if (!noRestoreEol) {
232
+ rv = restoreEol(rv, opts.srcEol);
233
+ }
234
+
235
+ return rv;
236
+ }
237
+
238
+ function getEolType(source) {
239
+ var eol;
240
+ var foundEolTypeCnt = 0;
241
+
242
+ if (source.indexOf('\r\n') >= 0) {
243
+ eol = '\r\n';
244
+ foundEolTypeCnt++;
245
+ }
246
+ if (/\r[^\n]/.test(source)) {
247
+ eol = '\r';
248
+ foundEolTypeCnt++;
249
+ }
250
+ if (/[^\r]\n/.test(source)) {
251
+ eol = '\n';
252
+ foundEolTypeCnt++;
253
+ }
254
+
255
+ if (eol == null || foundEolTypeCnt > 1) {
256
+ eol = os.EOL;
257
+ }
258
+
259
+ return eol;
260
+ }
261
+
262
+ function normalizeEol(source, indent) {
263
+ // only process any kind of EOL if indentation has to be added, otherwise replace only non \n EOLs
264
+ if (indent) {
265
+ source = source.replace(/(?:\r?\n)|\r/g, '\n' + indent);
266
+ } else {
267
+ source = source.replace(/(?:\r\n)|\r/g, '\n');
268
+ }
269
+
270
+ return source;
271
+ }
272
+
273
+ function restoreEol(normalizedSource, originalEol) {
274
+ if (originalEol !== '\n') {
275
+ normalizedSource = normalizedSource.replace(/\n/g, originalEol);
276
+ }
277
+
278
+ return normalizedSource;
279
+ }
280
+
281
+ function replace(rv, rule, processor) {
282
+ var isRegex = typeof rule === 'string' || rule instanceof RegExp;
283
+ var isArray = Array.isArray(rule);
284
+
285
+ if (isRegex) {
286
+ rule = [new RegExp(rule,'gmi')];
287
+ } else if (isArray) {
288
+ rule = rule.map(function(subRule){
289
+ return new RegExp(subRule,'gmi');
290
+ });
291
+ } else {
292
+ throw new Error('Rule must be a String, a RegExp, or an Array.');
293
+ }
294
+
295
+ return rule.reduce(function(rv, rule){
296
+ return rv.replace(rule, processor);
297
+ }, rv);
298
+ }
299
+
300
+ function replaceRecursive(rv, rule, processor) {
301
+ if(!rule.start || !rule.end) {
302
+ throw new Error('Recursive rule must have start and end.');
303
+ }
304
+
305
+ var startRegex = new RegExp(rule.start, 'mi');
306
+ var endRegex = new RegExp(rule.end, 'mi');
307
+
308
+ function matchReplacePass(content) {
309
+ var matches = XRegExp.matchRecursive(content, rule.start, rule.end, 'gmi', {
310
+ valueNames: ['between', 'left', 'match', 'right']
311
+ });
312
+
313
+ var matchGroup = {
314
+ left: null,
315
+ match: null,
316
+ right: null
317
+ };
318
+
319
+ return matches.reduce(function (builder, match) {
320
+ switch(match.name) {
321
+ case 'between':
322
+ builder += match.value;
323
+ break;
324
+ case 'left':
325
+ matchGroup.left = startRegex.exec(match.value);
326
+ break;
327
+ case 'match':
328
+ matchGroup.match = match.value;
329
+ break;
330
+ case 'right':
331
+ matchGroup.right = endRegex.exec(match.value);
332
+ builder += processor(matchGroup.left, matchGroup.right, matchGroup.match, matchReplacePass);
333
+ break;
334
+ }
335
+ return builder;
336
+ }, '');
337
+ }
338
+
339
+ return matchReplacePass(rv);
340
+ }
341
+
342
+
343
+ function processIncludeDirective(isStatic, context, opts, match, linePrefix, file) {
344
+ file = (file || '').trim();
345
+ var indent = linePrefix.replace(/\S/g, ' ');
346
+ var includedContext = copy(context);
347
+ var includedOpts = copy(opts);
348
+ includedContext.src = path.join(opts.srcDir,file);
349
+ includedOpts.srcDir = path.dirname(includedContext.src);
350
+
351
+ var fileContents = getFileContents(includedContext.src, opts.fileNotFoundSilentFail, context.src);
352
+ if (fileContents.error) {
353
+ return linePrefix + fileContents.contents;
354
+ }
355
+
356
+ var includedSource = fileContents.contents;
357
+ if (isStatic) {
358
+ includedSource = fileContents.contents;
359
+ } else {
360
+ includedSource = preprocessor(fileContents.contents, includedContext, includedOpts, true);
361
+ }
362
+
363
+ includedSource = normalizeEol(includedSource, indent);
364
+
365
+ if (includedSource) {
366
+ return linePrefix + includedSource;
367
+ } else {
368
+ return linePrefix;
369
+ }
370
+ }
371
+
372
+ function getTestTemplate(test) {
373
+ /*jshint evil:true*/
374
+ test = test || 'true';
375
+ test = test.trim();
376
+
377
+ // force single equals replacement
378
+ test = test.replace(/([^=!])=([^=])/g, '$1==$2');
379
+ // fixed by xxxxxx
380
+ test = test.replace(/-/g, '_')
381
+ return new Function("context", "with (context||{}){ return ( " + test + " ); }");
382
+ }
383
+
384
+ // fixed by xxxxxx
385
+ function testPasses(test, context) {
386
+ var testFn = getTestTemplate(test)
387
+ try {
388
+ return testFn(context, getDeepPropFromObj)
389
+ } catch (e) {}
390
+ return false
391
+ }
392
+
393
+ function getFileContents(path, failSilent, requesterPath) {
394
+ try {
395
+ fs.statSync(path);
396
+ } catch (e) {
397
+ if (failSilent) {
398
+ return {error: true, contents: path + ' not found!'};
399
+ } else {
400
+ var errMsg = path;
401
+ errMsg = requesterPath ? errMsg + ' requested from ' + requesterPath : errMsg;
402
+ errMsg += ' not found!';
403
+ throw new Error(errMsg);
404
+ }
405
+ }
406
+ return {error: false, contents: fs.readFileSync(path).toString()};
407
+ }
408
+
409
+ function copy(obj) {
410
+ return Object.keys(obj).reduce(function (copyObj, objKey) {
411
+ copyObj[objKey] = obj[objKey];
412
+ return copyObj;
413
+ }, {});
414
+ }
415
+
416
+ function getDeepPropFromObj(obj, propPath) {
417
+ propPath.replace(/\[([^\]+?])\]/g, '.$1');
418
+ propPath = propPath.split('.');
419
+
420
+ // fast path, no need to loop if structurePath contains only a single segment
421
+ if (propPath.length === 1) {
422
+ return obj[propPath[0]];
423
+ }
424
+
425
+ // loop only as long as possible (no exceptions for null/undefined property access)
426
+ propPath.some(function (pathSegment) {
427
+ obj = obj[pathSegment];
428
+ return (obj == null);
429
+ });
430
+
431
+ return obj;
432
+ }
433
+ // fixed by xxxxxx
434
+ const splitRE = /\r?\n/g
435
+ function padContent(content) {
436
+ return Array(content.split(splitRE).length).join('\n')
437
+ }
@@ -0,0 +1,121 @@
1
+
2
+ module.exports = {
3
+ simple : {
4
+ echo : "^#echo[ \t]+(.*?)[ \t]*$",
5
+ exec : "^#exec[ \t]+(\\S+)[ \t]*\\((.*)\\)[ \t]*$",
6
+ include : "^(.*)#include(?!-)[ \t]+(.*?)[ \t]*$", // allow prefix characters to specify the indent level of included file
7
+ 'include-static' : "^(.*)#include-static[ \t]+(.*?)[ \t]*$"
8
+ },
9
+ html : {
10
+ echo : "<!--[ \t]*#echo[ \t]+(.*?)[ \t]*(?:-->|!>)",
11
+ exec : "<!--[ \t]*#exec[ \t]+(\\S+)[ \t]*\\((.*)\\)[ \t]*(?:-->|!>)",
12
+ include : "(.*)<!--[ \t]*#include(?!-)[ \t]+(.*?)[ \t]*(?:-->|!>)",
13
+ 'include-static' : "(.*)<!--[ \t]*#include-static[ \t]+(.*?)[ \t]*(?:-->|!>)",
14
+ exclude : {
15
+ start : "[ \t]*<!--[ \t]*#exclude(?:[ \t]+(.*?))?[ \t]*(?:-->|!>)(?:[ \t]*\n+)?",
16
+ end : "[ \t]*<!--[ \t]*#endexclude[ \t]*(?:-->|!>)(?:[ \t]*\n)?"
17
+ },
18
+ extend : {
19
+ start : "[ \t]*<!--[ \t]*#extend(?!able)[ \t]+(.*?)[ \t]*(?:-->|!>)(?:[ \t]*\n+)?",
20
+ end : "[ \t]*<!--[ \t]*#endextend[ \t]*(?:-->|!>)(?:[ \t]*\n)?"
21
+ },
22
+ extendable : "<!--[ \t]*#extendable[ \t]*(?:-->|!>)",
23
+ if : {
24
+ start : "[ \t]*<!--[ \t]*#(ifndef|ifdef|if)[ \t]+(.*?)[ \t]*(?:-->|!>)(?:[ \t]*\n+)?",
25
+ end : "[ \t]*<!(?:--)?[ \t]*#endif[ \t]*(?:-->|!>)(?:[ \t]*\n)?"
26
+ },
27
+ else : "[ \t]*<!(?:--)?[ \t]*#else[ \t]*(?:-->|!>)(?:[ \t]*\n)?",
28
+ foreach : {
29
+ start : "[ \t]*<!--[ \t]*#foreach[ \t]+(.*?)[ \t]*(?:-->|!>)(?:[ \t]*\n+)?",
30
+ end : "[ \t]*<!(?:--)?[ \t]*#endfor[ \t]*(?:-->|!>)(?:[ \t]*\n)?"
31
+ }
32
+ },
33
+ js : {
34
+ echo : [
35
+ "/\\*[ \t]*#echo[ \t]+(.*?)[ \t]*\\*(?:\\*|/)",
36
+ "//[ \t]*#echo[ \t]+(.*?)[ \t]*$"
37
+ ],
38
+ exec : "(?://|/\\*)[ \t]*#exec[ \t]+(\\S+?)[ \t]*\\((.*)\\)[ \t]*(?:\\*(?:\\*|/))?",
39
+ include : [
40
+ "^(.*)/\\*[ \t]*#include(?!-)[ \t]+(.*?)[ \t]*\\*(?:\\*|/)",
41
+ "^(.*)//[ \t]*#include(?!-)[ \t]+(.*?)[ \t]*$"
42
+ ],
43
+ 'include-static': [
44
+ "^(.*)/\\*[ \t]*#include-static[ \t]+(.*?)[ \t]*\\*(?:\\*|/)",
45
+ "^(.*)//[ \t]*#include-static[ \t]+(.*?)[ \t]*$"
46
+ ],
47
+ exclude : {
48
+ start : "[ \t]*(?://|/\\*)[ \t]*#exclude(?:[ \t]+([^\n*]*))?[ \t]*(?:\\*(?:\\*|/))?(?:[ \t]*\n+)?",
49
+ end : "[ \t]*(?://|/\\*)[ \t]*#endexclude[ \t]*(?:\\*(?:\\*|/))?(?:[ \t]*\n)?"
50
+ },
51
+ extend : {
52
+ start : "[ \t]*(?://|/\\*)[ \t]*#extend(?!able)[ \t]+([^\n*]*)(?:\\*(?:\\*|/))?(?:[ \t]*\n+)?",
53
+ end : "[ \t]*(?://|/\\*)[ \t]*#endextend[ \t]*(?:\\*(?:\\*|/))?(?:[ \t]*\n)?"
54
+ },
55
+ extendable : "[ \t]*(?://|/\\*)[ \t]*#extendable[ \t]*(?:\\*/)?",
56
+ if : {
57
+ start : "[ \t]*(?://|/\\*)[ \t]*#(ifndef|ifdef|if)[ \t]+([^\n*]*)(?:\\*(?:\\*|/))?(?:[ \t]*\n+)?",
58
+ end : "[ \t]*(?://|/\\*)[ \t]*#endif[ \t]*(?:\\*(?:\\*|/))?(?:[ \t]*\n)?"
59
+ },
60
+ else : "[ \t]*(?://|/\\*)[ \t]*#else[ \t]*(?:\\*(?:\\*|/))?(?:[ \t]*\n)?",
61
+ foreach : {
62
+ start : "[ \t]*(?://|/\\*)[ \t]*#foreach[ \t]+([^\n*]*)(?:\\*(?:\\*|/))?(?:[ \t]*\n+)?",
63
+ end : "[ \t]*(?://|/\\*)[ \t]*#endfor[ \t]*(?:\\*(?:\\*|/))?(?:[ \t]*\n)?"
64
+ }
65
+ },
66
+ coffee : {
67
+ echo : [
68
+ "###+[ \t]*#echo[ \t]+(.*?)[ \t]###",
69
+ "#+[ \t]*#echo[ \t]+(.*?)[ \t]*$"
70
+ ],
71
+ exec : "#+[ \t]*#exec[ \t]+(\\S+)[ \t]*\\((.*)\\)[ \t]*$",
72
+ include : "^(.*?)#+[ \t]*#include(?!-)[ \t]+(.*?)[ \t]*$",
73
+ 'include-static' : "^(.*?)#+[ \t]*#include-static[ \t]+(.*?)[ \t]*$",
74
+ exclude : {
75
+ start : "^[ \t]*#+[ \t]*#exclude(?:[ \t]+(.*?))?[ \t]*\n+",
76
+ end : "^[ \t]*#+[ \t]*#endexclude[ \t]*\n?"
77
+ },
78
+ extend : {
79
+ start : "^[ \t]*#+[ \t]*#extend(?!able)[ \t]+(.*?)\n+",
80
+ end : "^[ \t]*#+[ \t]*#endextend[ \t]*\n?"
81
+ },
82
+ extendable : "^[ \t]*#+[ \t]*#extendable[ \t]*$",
83
+ if : {
84
+ start : "^[ \t]*#+[ \t]*#(ifndef|ifdef|if)[ \t]+(.*?)[ \t]*\n+",
85
+ end : "^[ \t]*#+[ \t]*#endif[ \t]*\n?"
86
+ },
87
+ else : "^[ \t]*#+[ \t]*#else[ \t]*\n?",
88
+ foreach : {
89
+ start : "^[ \t]*#+[ \t]*#foreach[ \t]+(.*?)[ \t]*\n+",
90
+ end : "^[ \t]*#+[ \t]*#endfor[ \t]*\n?"
91
+ }
92
+ }
93
+ };
94
+
95
+ module.exports.xml = module.exports.html;
96
+
97
+ module.exports.javascript = module.exports.js;
98
+ module.exports.jsx = module.exports.js;
99
+ module.exports.json = module.exports.js;
100
+ module.exports.c = module.exports.js;
101
+ module.exports.cc = module.exports.js;
102
+ module.exports.cpp = module.exports.js;
103
+ module.exports.cs = module.exports.js;
104
+ module.exports.csharp = module.exports.js;
105
+ module.exports.java = module.exports.js;
106
+ module.exports.less = module.exports.js;
107
+ module.exports.sass = module.exports.js;
108
+ module.exports.scss = module.exports.js;
109
+ module.exports.css = module.exports.js;
110
+ module.exports.php = module.exports.js;
111
+ module.exports.ts = module.exports.js;
112
+ module.exports.tsx = module.exports.js;
113
+ module.exports.peg = module.exports.js;
114
+ module.exports.pegjs = module.exports.js;
115
+ module.exports.jade = module.exports.js;
116
+ module.exports.styl = module.exports.js;
117
+ module.exports.go = module.exports.js;
118
+
119
+ module.exports.bash = module.exports.coffee;
120
+ module.exports.shell = module.exports.coffee;
121
+ module.exports.sh = module.exports.coffee;
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "preprocess",
3
+ "description": "Preprocess directives in HTML, JavaScript, etc directives based off variable context",
4
+ "version": "3.2.0",
5
+ "homepage": "https://github.com/jsoverson/preprocess",
6
+ "author": {
7
+ "name": "Jarrod Overson",
8
+ "email": "jsoverson@gmail.com",
9
+ "url": "http://jarrodoverson.com/"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git://github.com/jsoverson/preprocess.git"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/jsoverson/preprocess/issues"
17
+ },
18
+ "licenses": [
19
+ {
20
+ "type": "Apache 2.0",
21
+ "url": "https://github.com/jsoverson/preprocess/blob/master/LICENSE"
22
+ }
23
+ ],
24
+ "main": "lib/preprocess.js",
25
+ "engines": {
26
+ "node": ">= 0.10.0"
27
+ },
28
+ "scripts": {
29
+ "test": "grunt test",
30
+ "ci": "grunt ci"
31
+ },
32
+ "dependencies": {
33
+ "xregexp": "3.1.0"
34
+ },
35
+ "devDependencies": {
36
+ "chai": "^3.5.0",
37
+ "chai-spies": "^0.7.0",
38
+ "grunt": "^0.4.5",
39
+ "grunt-benchmark": "^0.3.0",
40
+ "grunt-cli": "^0.1.13",
41
+ "grunt-contrib-clean": "^1.0.0",
42
+ "grunt-contrib-copy": "^0.8.0",
43
+ "grunt-contrib-jshint": "^1.0.0",
44
+ "grunt-contrib-watch": "^0.6.1",
45
+ "grunt-coveralls": "^1.0.0",
46
+ "grunt-deps-ok": "^0.9.0",
47
+ "grunt-mocha-istanbul": "^3.0.1",
48
+ "grunt-mocha-test": "^0.12.7",
49
+ "istanbul": "^0.4.2",
50
+ "load-grunt-tasks": "^3.4.0",
51
+ "mocha": "^2.4.5",
52
+ "time-grunt": "^1.3.0",
53
+ "travis-cov": "^0.2.5"
54
+ },
55
+ "keywords": [
56
+ "directive",
57
+ "ENV",
58
+ "environment",
59
+ "ifdef",
60
+ "ifndef",
61
+ "echo",
62
+ "include",
63
+ "exclude",
64
+ "process",
65
+ "preprocess",
66
+ "pragma"
67
+ ]
68
+ }
package/package.json ADDED
@@ -0,0 +1,68 @@
1
+ {
2
+ "name": "@dcloudio/uni-cli-shared",
3
+ "version": "0.0.1-nvue3.3030820220125001",
4
+ "description": "@dcloudio/uni-cli-shared",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist",
9
+ "lib"
10
+ ],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/dcloudio/uni-app.git",
14
+ "directory": "packages/uni-cli-shared"
15
+ },
16
+ "license": "Apache-2.0",
17
+ "bugs": {
18
+ "url": "https://github.com/dcloudio/uni-app/issues"
19
+ },
20
+ "dependencies": {
21
+ "@babel/core": "^7.16.5",
22
+ "@babel/parser": "^7.16.4",
23
+ "@babel/types": "^7.16.0",
24
+ "@dcloudio/uni-i18n": "0.0.1-nvue3.3030820220125001",
25
+ "@dcloudio/uni-shared": "0.0.1-nvue3.3030820220125001",
26
+ "@rollup/pluginutils": "^4.1.2",
27
+ "@vue/compiler-core": "3.2.29",
28
+ "@vue/compiler-dom": "3.2.29",
29
+ "@vue/compiler-sfc": "3.2.29",
30
+ "@vue/server-renderer": "3.2.29",
31
+ "@vue/shared": "3.2.29",
32
+ "autoprefixer": "^10.4.2",
33
+ "base64url": "^3.0.1",
34
+ "chokidar": "^3.5.2",
35
+ "compare-versions": "^3.6.0",
36
+ "debug": "^4.3.2",
37
+ "es-module-lexer": "^0.9.3",
38
+ "esbuild": "^0.13.12",
39
+ "estree-walker": "^2.0.2",
40
+ "fast-glob": "^3.2.7",
41
+ "fs-extra": "^10.0.0",
42
+ "hash-sum": "^2.0.0",
43
+ "jsonc-parser": "^3.0.0",
44
+ "magic-string": "^0.25.7",
45
+ "merge": "^2.1.1",
46
+ "mime": "^3.0.0",
47
+ "module-alias": "^2.2.2",
48
+ "picocolors": "^1.0.0",
49
+ "postcss-import": "^14.0.2",
50
+ "postcss-load-config": "^3.1.0",
51
+ "postcss-modules": "^4.2.2",
52
+ "postcss-selector-parser": "^6.0.6",
53
+ "resolve": "^1.20.0",
54
+ "tapable": "^2.2.0",
55
+ "xregexp": "3.1.0"
56
+ },
57
+ "gitHead": "33e807d66e1fe47e2ee08ad9c59247e37b8884da",
58
+ "devDependencies": {
59
+ "@types/debug": "^4.1.7",
60
+ "@types/fs-extra": "^9.0.13",
61
+ "@types/hash-sum": "^1.0.0",
62
+ "@types/less": "^3.0.3",
63
+ "@types/mime": "^2.0.3",
64
+ "@types/module-alias": "^2.0.1",
65
+ "@types/stylus": "^0.48.36",
66
+ "postcss": "^8.4.5"
67
+ }
68
+ }