@dcloudio/uni-cli-shared
Advanced tools
Comparing version 0.2.965 to 0.2.966
@@ -32,4 +32,3 @@ const tags = require('./tags') | ||
getComponentName, | ||
convertStaticStyle, | ||
devtoolModuleFilenameTemplate | ||
convertStaticStyle | ||
} = require('./util') | ||
@@ -58,3 +57,4 @@ | ||
nvueJsPreprocessOptions, | ||
nvueHtmlPreprocessOptions | ||
nvueHtmlPreprocessOptions, | ||
devtoolModuleFilenameTemplate | ||
} = require('./platform') | ||
@@ -61,0 +61,0 @@ |
const fs = require('fs') | ||
const path = require('path') | ||
const { | ||
normalizePath | ||
} = require('./util') | ||
const uniRuntime = '@dcloudio/vue-cli-plugin-uni/packages/mp-vue' | ||
@@ -174,2 +178,56 @@ const mpvueRuntime = '@dcloudio/vue-cli-plugin-uni/packages/mpvue' | ||
} | ||
let sourceRoot = false | ||
function devtoolModuleFilenameTemplate (info) { | ||
if (!sourceRoot) { | ||
if (isInHBuilderX) { | ||
sourceRoot = normalizePath(process.env.UNI_INPUT_DIR) | ||
} else { | ||
sourceRoot = normalizePath(process.env.UNI_CLI_CONTEXT) | ||
} | ||
} | ||
let filePath = false | ||
const absoluteResourcePath = normalizePath(info.absoluteResourcePath) | ||
if ( | ||
absoluteResourcePath.indexOf(sourceRoot) !== -1 && | ||
( | ||
absoluteResourcePath.endsWith('.js') || | ||
absoluteResourcePath.endsWith('.ts') | ||
) | ||
) { | ||
filePath = normalizePath(path.relative(sourceRoot, absoluteResourcePath)) | ||
if ( | ||
filePath.indexOf('node_modules/@dcloudio') === 0 || | ||
filePath.indexOf('node_modules/vue-loader') === 0 || | ||
filePath.indexOf('node_modules/webpack') === 0 | ||
) { | ||
filePath = false | ||
} | ||
} else if ( | ||
!info.moduleId && | ||
( | ||
absoluteResourcePath.endsWith('.vue') || | ||
absoluteResourcePath.endsWith('.nvue') | ||
) | ||
) { | ||
if ( | ||
absoluteResourcePath.indexOf('src') !== 0 && | ||
absoluteResourcePath.indexOf('node-modules') !== 0 | ||
) { | ||
filePath = normalizePath(path.relative(sourceRoot, absoluteResourcePath)) | ||
} else { | ||
filePath = absoluteResourcePath | ||
} | ||
} | ||
if ( | ||
filePath && | ||
filePath !== 'main.js' && | ||
filePath !== 'main.ts' && | ||
filePath !== 'src/main.js' && | ||
filePath !== 'src/main.ts' | ||
) { | ||
return `uni-app:///${filePath}` | ||
} | ||
} | ||
module.exports = { | ||
@@ -179,2 +237,3 @@ isInHBuilderX, | ||
runByHBuilderX: isInHBuilderX || !!process.env.UNI_HBUILDERX_PLUGINS, | ||
devtoolModuleFilenameTemplate, | ||
jsPreprocessOptions: { | ||
@@ -181,0 +240,0 @@ type: 'js', |
@@ -90,4 +90,2 @@ const path = require('path') | ||
let sourceRoot = false | ||
module.exports = { | ||
@@ -121,29 +119,3 @@ md5, | ||
return str | ||
}), | ||
devtoolModuleFilenameTemplate (info) { | ||
if (!sourceRoot) { | ||
sourceRoot = normalizePath(process.env.UNI_INPUT_DIR) | ||
} | ||
let needSourceMap = false | ||
const absoluteResourcePath = normalizePath(info.absoluteResourcePath) | ||
if (absoluteResourcePath.indexOf(sourceRoot) !== -1) { | ||
if (absoluteResourcePath.endsWith('.js')) { | ||
needSourceMap = true | ||
} else if ( | ||
!info.moduleId && | ||
( | ||
absoluteResourcePath.endsWith('.vue') || | ||
absoluteResourcePath.endsWith('.nvue') | ||
) | ||
) { | ||
needSourceMap = true | ||
} | ||
} | ||
if (needSourceMap) { | ||
const filePath = normalizePath(path.relative(sourceRoot, absoluteResourcePath)) | ||
if (filePath !== 'main.js') { | ||
return `uni-app:///${filePath}` | ||
} | ||
} | ||
} | ||
}) | ||
} |
{ | ||
"name": "@dcloudio/uni-cli-shared", | ||
"version": "0.2.965", | ||
"version": "0.2.966", | ||
"description": "uni-cli-shared", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42758
1059
37