@dcloudio/uni-cli-shared 2.0.2-alpha-3090920231215002 → 2.0.2-alpha-4000020240123001

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.
@@ -1,16 +1,35 @@
1
1
  const path = require('path')
2
+ const webpack = require('webpack')
2
3
  const {
3
- normalizeNodeModules
4
+ normalizePath
5
+ // normalizeNodeModules
4
6
  } = require('./util')
5
7
 
8
+ let inputDir
9
+
6
10
  module.exports = {
7
11
  loader: 'file-loader',
8
12
  options: {
9
- publicPath (url, resourcePath, context) {
10
- return '/' + normalizeNodeModules(path.relative(process.env.UNI_INPUT_DIR, resourcePath))
11
- },
12
- outputPath (url, resourcePath, context) {
13
- return normalizeNodeModules(path.relative(process.env.UNI_INPUT_DIR, resourcePath))
13
+ name (resourcePath, resourceQuery) {
14
+ if (!inputDir) {
15
+ inputDir = normalizePath(process.env.UNI_INPUT_DIR)
16
+ }
17
+ resourcePath = normalizePath(resourcePath)
18
+ if (resourcePath.startsWith(inputDir)) {
19
+ const relativePath = normalizePath(path.relative(inputDir,
20
+ resourcePath))
21
+ if (relativePath.startsWith('static/') || relativePath.includes(
22
+ '/static/')) {
23
+ return relativePath
24
+ }
25
+ }
26
+ return `assets/[name].[hash:8]${webpack.version[0] > 4 ? '' : '.'}[ext]`
14
27
  }
28
+ // publicPath (url, resourcePath, context) {
29
+ // return '/' + normalizeNodeModules(path.relative(process.env.UNI_INPUT_DIR, resourcePath))
30
+ // },
31
+ // outputPath (url, resourcePath, context) {
32
+ // return normalizeNodeModules(path.relative(process.env.UNI_INPUT_DIR, resourcePath))
33
+ // }
15
34
  }
16
- }
35
+ }
package/lib/pages.js CHANGED
@@ -122,7 +122,15 @@ function isValidPage (page, root = '') {
122
122
  let pagePath = page.path
123
123
 
124
124
  if (pagePath.indexOf('platforms') === 0) { // 平台相关
125
- if (pagePath.indexOf('platforms/' + process.env.UNI_PLATFORM) === -1) { // 非本平台
125
+ if (process.env.UNI_PLATFORM === 'h5' || process.env.UNI_PLATFORM === 'web') {
126
+ if (!(pagePath.indexOf('platforms/h5/') === 0 || pagePath.indexOf('platforms/web/') === 0)) {
127
+ return false
128
+ }
129
+ } else if (process.env.UNI_PLATFORM === 'app-plus' || process.env.UNI_PLATFORM === 'app') {
130
+ if (!(pagePath.indexOf('platforms/app-plus/') === 0 || pagePath.indexOf('platforms/app/') === 0)) {
131
+ return false
132
+ }
133
+ } else if (pagePath.indexOf('platforms/' + process.env.UNI_PLATFORM) === -1) { // 非本平台
126
134
  return false
127
135
  }
128
136
  }
@@ -578,4 +586,4 @@ module.exports = {
578
586
  getGlobalUsingComponentsCode,
579
587
  parseUsingAutoImportComponents,
580
588
  generateGlobalUsingComponentsCode
581
- }
589
+ }
package/lib/url-loader.js CHANGED
@@ -35,8 +35,11 @@ module.exports = {
35
35
  loader: 'url-loader',
36
36
  options () {
37
37
  if (process.env.UNI_PLATFORM === 'h5') {
38
- // h5平台,不对 url-loader 作调整,默认limit:4096,也不修改file-loader输出路径
39
- return {}
38
+ // h5平台,不对 url-loader 作调整,默认limit:4096,也不修改file-loader输出路径(已做处理)
39
+ return {
40
+ ...defaultOptions,
41
+ limit: 4096
42
+ }
40
43
  }
41
44
  if (inlineLimit) {
42
45
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "2.0.2-alpha-3090920231215002",
3
+ "version": "2.0.2-alpha-4000020240123001",
4
4
  "description": "uni-cli-shared",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -26,5 +26,5 @@
26
26
  "postcss-urlrewrite": "^0.2.2",
27
27
  "strip-json-comments": "^2.0.1"
28
28
  },
29
- "gitHead": "48538d042d5d603a803f2742470514d0b76cf549"
29
+ "gitHead": "d3e5090a12b549e5bbb505d652ebd7af1a7b6ac8"
30
30
  }