Skip to content

Commit

Permalink
fix(cli): 普通文件经过编译器编译必须传入 isNormal
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyadam committed Dec 16, 2019
1 parent 06178c4 commit 096cef5
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/taro-cli/src/convertor/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ export default class Convertor {
const transformResult = wxTransformer({
code,
sourcePath: file,
isNormal: true,
isTyped: REG_TYPESCRIPT.test(file)
})
const { ast, scriptFiles } = this.parseAst({
Expand Down
1 change: 1 addition & 0 deletions packages/taro-cli/src/h5/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ class Compiler {
let ast = wxTransformer({
code,
sourcePath: filePath,
isNormal: true,
isTyped: REG_TYPESCRIPT.test(filePath),
adapter: 'h5'
}).ast
Expand Down
4 changes: 1 addition & 3 deletions packages/taro-cli/src/mini/compileScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export function compileDepScripts (scriptFiles: string[], needUseBabel?: boolean
sourcePath: item,
isTyped: REG_TYPESCRIPT.test(item),
adapter: buildAdapter,
isNormal: true,
env: constantsReplaceList,
jsxAttributeNameReplace
})
Expand Down Expand Up @@ -142,7 +143,6 @@ export async function compileScriptFile (
): Promise<string> {
const {
appPath,
sourceDir,
constantsReplaceList,
jsxAttributeNameReplace,
projectConfig
Expand All @@ -159,8 +159,6 @@ export async function compileScriptFile (
const transformResult: IWxTransformResult = wxTransformer({
code,
sourcePath: sourceFilePath,
sourceDir,
outputPath: outputFilePath,
isNormal: true,
isTyped: false,
adapter,
Expand Down
3 changes: 2 additions & 1 deletion packages/taro-cli/src/mini/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export function isFileToBeTaroComponent (
sourcePath: sourcePath,
isTyped: REG_TYPESCRIPT.test(sourcePath),
adapter: buildAdapter,
isNormal: true,
env: constantsReplaceList,
jsxAttributeNameReplace,
alias
Expand Down Expand Up @@ -165,7 +166,7 @@ export async function buildSingleComponent (
const outputComponentJSONPath = outputComponentJSPath.replace(extnameExpRegOf(outputComponentJSPath), outputFilesTypes.CONFIG)

try {
const isTaroComponentRes = isFileToBeTaroComponent(componentContent, component, outputComponentJSPath)
const isTaroComponentRes = isFileToBeTaroComponent(componentContent, component)
const componentExportsMap = getComponentExportsMap()
if (!isTaroComponentRes.isTaroComponent) {
const transformResult = isTaroComponentRes.transformResult
Expand Down
1 change: 1 addition & 0 deletions packages/taro-cli/src/mini/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ export function getImportTaroSelfComponents (filePath, taroSelfComponents) {
const transformResult: IWxTransformResult = wxTransformer({
code: scriptContent,
sourcePath: sourceFilePath,
isNormal: true,
isTyped: false,
adapter: BUILD_TYPES.QUICKAPP
})
Expand Down
1 change: 1 addition & 0 deletions packages/taro-cli/src/rn/transformJS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ function getJSAst (code, filePath) {
return wxTransformer({
code,
sourcePath: filePath,
isNormal: true,
isTyped: REG_TYPESCRIPT.test(filePath),
adapter: 'rn'
}).ast
Expand Down
1 change: 0 additions & 1 deletion packages/taro-cli/src/ui/h5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ async function buildH5Lib (uiIndex, buildData: IBuildData) {
const transformResult = wxTransformer({
code,
sourcePath: tempEntryFilePath,
outputPath: outputEntryFilePath,
isNormal: true,
isTyped: REG_TYPESCRIPT.test(tempEntryFilePath)
})
Expand Down
1 change: 1 addition & 0 deletions packages/taro-cli/src/util/resolve_npm_files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ async function recursiveRequire ({
code: fileContent,
sourcePath: filePath,
adapter: buildAdapter,
isNormal: true,
isTyped: REG_TYPESCRIPT.test(filePath),
env: constantsReplaceList
})
Expand Down

0 comments on commit 096cef5

Please sign in to comment.