@dcloudio/uni-cli-shared 3.0.0-alpha-3040420220402005 → 3.0.0-alpha-3040520220408002

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.
@@ -19,7 +19,12 @@ exports.parseMiniProgramPagesJson = parseMiniProgramPagesJson;
19
19
  function mergeMiniProgramAppJson(appJson, platformJson = {}) {
20
20
  Object.keys(platformJson).forEach((name) => {
21
21
  if (!(0, project_1.isMiniProgramProjectJsonKey)(name) &&
22
- !['usingComponents', 'optimization', 'scopedSlotsCompiler'].includes(name)) {
22
+ ![
23
+ 'unipush',
24
+ 'usingComponents',
25
+ 'optimization',
26
+ 'scopedSlotsCompiler',
27
+ ].includes(name)) {
23
28
  appJson[name] = platformJson[name];
24
29
  }
25
30
  });
@@ -0,0 +1 @@
1
+ export declare function isMiniProgramAssetFile(filename: string): boolean;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isMiniProgramAssetFile = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const EXTNAMES = [
9
+ '.png',
10
+ '.jpg',
11
+ '.jpeg',
12
+ '.gif',
13
+ '.svg',
14
+ '.json',
15
+ '.cer',
16
+ '.mp3',
17
+ '.aac',
18
+ '.m4a',
19
+ '.mp4',
20
+ '.wav',
21
+ '.ogg',
22
+ '.silk',
23
+ '.wasm',
24
+ '.br',
25
+ '.cert',
26
+ ];
27
+ function isMiniProgramAssetFile(filename) {
28
+ if (!path_1.default.isAbsolute(filename)) {
29
+ return false;
30
+ }
31
+ return EXTNAMES.includes(path_1.default.extname(filename));
32
+ }
33
+ exports.isMiniProgramAssetFile = isMiniProgramAssetFile;
@@ -3,6 +3,7 @@ export * from './wxs';
3
3
  export * from './nvue';
4
4
  export * from './event';
5
5
  export * from './style';
6
+ export * from './assets';
6
7
  export * from './template';
7
8
  export * from './constants';
8
9
  export { HTML_TO_MINI_PROGRAM_TAGS } from './tags';
package/dist/mp/index.js CHANGED
@@ -20,6 +20,7 @@ __exportStar(require("./wxs"), exports);
20
20
  __exportStar(require("./nvue"), exports);
21
21
  __exportStar(require("./event"), exports);
22
22
  __exportStar(require("./style"), exports);
23
+ __exportStar(require("./assets"), exports);
23
24
  __exportStar(require("./template"), exports);
24
25
  __exportStar(require("./constants"), exports);
25
26
  var tags_1 = require("./tags");
@@ -1,4 +1,5 @@
1
1
  import type { Plugin } from 'vite';
2
+ export declare function addScoped(code: string): string;
2
3
  interface UniCssScopedPluginOptions {
3
4
  filter: (id: string) => boolean;
4
5
  }
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.uniCssScopedPlugin = exports.uniRemoveCssScopedPlugin = void 0;
6
+ exports.uniCssScopedPlugin = exports.uniRemoveCssScopedPlugin = exports.addScoped = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const debug_1 = __importDefault(require("debug"));
9
9
  const constants_1 = require("../../constants");
@@ -12,11 +12,14 @@ const parse_1 = require("../../vue/parse");
12
12
  const debugScoped = (0, debug_1.default)('uni:scoped');
13
13
  const SCOPED_RE = /<style\s[^>]*scoped[^>]*>/i;
14
14
  function addScoped(code) {
15
- if (SCOPED_RE.test(code)) {
16
- return code;
17
- }
18
- return code.replace(/(<style\b[^><]*)>/gi, '$1 scoped>');
15
+ return code.replace(/(<style\b[^><]*)>/gi, (str, $1) => {
16
+ if ($1.includes('scoped')) {
17
+ return str;
18
+ }
19
+ return `${$1} scoped>`;
20
+ });
19
21
  }
22
+ exports.addScoped = addScoped;
20
23
  function removeScoped(code) {
21
24
  if (!SCOPED_RE.test(code)) {
22
25
  return code;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "3.0.0-alpha-3040420220402005",
3
+ "version": "3.0.0-alpha-3040520220408002",
4
4
  "description": "@dcloudio/uni-cli-shared",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,8 +21,8 @@
21
21
  "@babel/core": "^7.17.8",
22
22
  "@babel/parser": "^7.16.4",
23
23
  "@babel/types": "^7.16.8",
24
- "@dcloudio/uni-i18n": "3.0.0-alpha-3040420220402005",
25
- "@dcloudio/uni-shared": "3.0.0-alpha-3040420220402005",
24
+ "@dcloudio/uni-i18n": "3.0.0-alpha-3040520220408002",
25
+ "@dcloudio/uni-shared": "3.0.0-alpha-3040520220408002",
26
26
  "@rollup/pluginutils": "^4.2.0",
27
27
  "@vue/compiler-core": "3.2.31",
28
28
  "@vue/compiler-dom": "3.2.31",