@dcloudio/uni-cli-shared 2.0.0-32920211029001 → 2.0.0-32920211122001

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/lib/manifest.js CHANGED
@@ -85,8 +85,7 @@ function getH5Options (manifestJson) {
85
85
  }
86
86
 
87
87
  /* eslint-disable no-mixed-operators */
88
- h5.template = h5.template && path.resolve(process.env.UNI_INPUT_DIR, h5.template) || path.resolve(__dirname,
89
- '../../../../public/index.html')
88
+ h5.template = h5.template && path.resolve(process.env.UNI_INPUT_DIR, h5.template) || path.resolve(require('./util').getCLIContext(), 'public/index.html')
90
89
 
91
90
  h5.devServer = h5.devServer || {}
92
91
 
@@ -103,4 +102,4 @@ module.exports = {
103
102
  parseManifestJson,
104
103
  getNetworkTimeout,
105
104
  getH5Options
106
- }
105
+ }
package/lib/platform.js CHANGED
@@ -122,7 +122,7 @@ module.exports = {
122
122
  getShadowCss,
123
123
  getShadowTemplate (colorType = 'grey') {
124
124
  let tagName = 'cover-image'
125
- if (process.env.UNI_PLATFORM === 'mp-toutiao') {
125
+ if (process.env.UNI_PLATFORM === 'mp-toutiao' || process.env.UNI_PLATFORM === 'mp-lark') {
126
126
  tagName = 'image'
127
127
  }
128
128
  return `<${tagName} src="https://cdn.dcloud.net.cn/img/shadow-${colorType}.png" style="z-index:998;position:fixed;left:0;top:0;width:100%;height:3px;"/>`
@@ -137,6 +137,8 @@ module.exports = {
137
137
  return {
138
138
  sourceType: 'module',
139
139
  plugins: [
140
+ ['pipelineOperator', { proposal: 'minimal' }],
141
+ 'doExpressions',
140
142
  'optionalChaining',
141
143
  'typescript',
142
144
  ['decorators', {
package/lib/url-loader.js CHANGED
@@ -10,6 +10,7 @@ const inlineLimit =
10
10
  process.env.UNI_PLATFORM === 'mp-qq' ||
11
11
  process.env.UNI_PLATFORM === 'mp-toutiao' ||
12
12
  process.env.UNI_PLATFORM === 'mp-kuaishou' ||
13
+ process.env.UNI_PLATFORM === 'mp-lark' ||
13
14
  process.env.UNI_PLATFORM === 'app-plus' // v2需要base64,v3需要rewriteUrl
14
15
 
15
16
  // mp-weixin,mp-qq,app-plus 非v3(即:需要base64的平台)
@@ -46,4 +47,4 @@ module.exports = {
46
47
  }
47
48
  },
48
49
  rewriteUrl
49
- }
50
+ }
package/lib/util.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const path = require('path')
2
+ const fs = require('fs')
2
3
  const hash = require('hash-sum')
3
4
  const crypto = require('crypto')
4
5
 
@@ -14,6 +15,24 @@ try {
14
15
  const isInHBuilderX = !!aboutPkg
15
16
  const isInHBuilderXAlpha = !!(isInHBuilderX && aboutPkg.alpha)
16
17
 
18
+ function getCLIContext () {
19
+ var context = path.resolve(__dirname, '../../../../')
20
+ // const isInHBuilderX = fs.existsSync(path.resolve(context, 'bin/uniapp-cli.js'))
21
+ if (isInHBuilderX) {
22
+ return context
23
+ }
24
+ const pnpmFind = __dirname.match(/.+?[/\\].pnpm[/\\]/)
25
+ if (pnpmFind) {
26
+ const pnpm = pnpmFind[0]
27
+ context = path.resolve(pnpm, '../../')
28
+ }
29
+ const isInCLI = fs.existsSync(path.resolve(context, './src'))
30
+ if (isInCLI) {
31
+ return context
32
+ }
33
+ return process.cwd()
34
+ }
35
+
17
36
  function removeExt (str, ext) {
18
37
  if (ext) {
19
38
  const reg = new RegExp(ext.replace(/\./, '\\.') + '$')
@@ -105,6 +124,7 @@ const _hasOwnProperty = Object.prototype.hasOwnProperty
105
124
  module.exports = {
106
125
  isInHBuilderX,
107
126
  isInHBuilderXAlpha,
127
+ getCLIContext,
108
128
  normalizeNodeModules,
109
129
  md5,
110
130
  hasOwn (obj, key) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-cli-shared",
3
- "version": "2.0.0-32920211029001",
3
+ "version": "2.0.0-32920211122001",
4
4
  "description": "uni-cli-shared",
5
5
  "main": "lib/index.js",
6
6
  "repository": {
@@ -23,5 +23,5 @@
23
23
  "postcss-urlrewrite": "^0.2.2",
24
24
  "strip-json-comments": "^2.0.1"
25
25
  },
26
- "gitHead": "9577a22e00e4b90c8830d34f5966f1d379b455ea"
26
+ "gitHead": "5ea8cb773dcd23d3ec471facbb03d5dbd06b321b"
27
27
  }