mirror of
https://github.com/openharmony/developtools_ace-ets2bundle.git
synced 2026-07-20 00:54:09 -04:00
@@ -38,7 +38,11 @@ import {
|
||||
circularFile,
|
||||
mkDir
|
||||
} from './utils';
|
||||
import { MODULE_SHARE_PATH, BUILD_SHARE_PATH } from './pre_define';
|
||||
import {
|
||||
MODULE_ETS_PATH,
|
||||
MODULE_SHARE_PATH,
|
||||
BUILD_SHARE_PATH
|
||||
} from './pre_define';
|
||||
import {
|
||||
createLanguageService,
|
||||
appComponentCollection,
|
||||
@@ -74,7 +78,7 @@ export class ResultStates {
|
||||
private yellow: string = '\u001b[33m';
|
||||
private blue: string = '\u001b[34m';
|
||||
private reset: string = '\u001b[39m';
|
||||
private modulePaths: Set<string> = new Set([]);
|
||||
private moduleSharePaths: Set<string> = new Set([]);
|
||||
|
||||
public apply(compiler: Compiler): void {
|
||||
compiler.hooks.compilation.tap('SourcemapFixer', compilation => {
|
||||
@@ -89,18 +93,23 @@ export class ResultStates {
|
||||
);
|
||||
|
||||
compilation.hooks.buildModule.tap('findModule', (module) => {
|
||||
if (/node_modules/.test(module.context)) {
|
||||
const modulePath: string =
|
||||
path.resolve(module.resourceResolveData.descriptionFileRoot, MODULE_SHARE_PATH);
|
||||
if (fs.existsSync(modulePath)) {
|
||||
this.modulePaths.add(modulePath);
|
||||
}
|
||||
if (module.context.indexOf(projectConfig.projectPath) >= 0) {
|
||||
return;
|
||||
}
|
||||
const modulePath: string = path.join(module.context);
|
||||
const srcIndex: number = modulePath.lastIndexOf(MODULE_ETS_PATH);
|
||||
if (srcIndex < 0) {
|
||||
return;
|
||||
}
|
||||
const moduleSharePath: string = path.resolve(modulePath.substring(0, srcIndex), MODULE_SHARE_PATH);
|
||||
if (fs.existsSync(moduleSharePath)) {
|
||||
this.moduleSharePaths.add(moduleSharePath);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
compiler.hooks.afterCompile.tap('copyFindModule', () => {
|
||||
this.modulePaths.forEach(modulePath => {
|
||||
this.moduleSharePaths.forEach(modulePath => {
|
||||
circularFile(modulePath, path.resolve(projectConfig.buildPath, BUILD_SHARE_PATH));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -190,8 +190,9 @@ export const BUILDER_ATTR_BIND: string = 'bind';
|
||||
|
||||
export const GEOMETRY_VIEW: string = 'GeometryView';
|
||||
|
||||
export const MODULE_SHARE_PATH: string = 'src' + path.sep + 'ets' + path.sep + 'share';
|
||||
export const MODULE_SHARE_PATH: string = 'src' + path.sep + 'main' + path.sep + 'ets' + path.sep + 'share';
|
||||
export const BUILD_SHARE_PATH: string = '../share';
|
||||
export const MODULE_ETS_PATH: string = 'src' + path.sep + 'main' + path.sep + 'ets';
|
||||
|
||||
export const THIS: string = 'this';
|
||||
export const STYLES: string = 'Styles';
|
||||
|
||||
Reference in New Issue
Block a user