@we-debug/compiler-core 0.0.0-stage → 0.52.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,51 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ # [0.52.0](https://github.com/dlhandsome/we-debug/compare/v0.51.1...v0.52.0) (2026-12-02)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * resolve subpackage UI plugin host ([0c73838](https://github.com/dlhandsome/we-debug/commit/0c73838496548038dade71630038e7df09c5c10b))
12
+ * **cli:** transform TypeScript subpackage entries ([9db5e00](https://github.com/dlhandsome/we-debug/commit/9db5e00d2d69100128b4409d53bb4da0883720b8))
13
+ * **compiler:** relocate copied npm dependencies ([b45f345](https://github.com/dlhandsome/we-debug/commit/b45f345c2b8a1e0ca0a984616dd57ce7147f8e19))
14
+ * **compiler:** relocate gulp compiled entries ([52cc367](https://github.com/dlhandsome/we-debug/commit/52cc36716b02ffe85dfc50da31816d555bab965f))
15
+ * **compiler:** retain async subpackage modules ([85c500e](https://github.com/dlhandsome/we-debug/commit/85c500e14e06ae3ccaa5d6a0cc90b32f23574847))
16
+ * **compiler-core:** avoid duplicate index.js when generating npm main shim ([893df19](https://github.com/dlhandsome/we-debug/commit/893df19a5e15a9cacef0603d244ae81168ce93f8))
17
+ * **compiler-core:** make isInside path-normalized ([11c4613](https://github.com/dlhandsome/we-debug/commit/11c4613cf5ca338bf7493a76a193be8529bc3b19))
18
+ * **compiler-core:** validate subpackage root ([b685d0f](https://github.com/dlhandsome/we-debug/commit/b685d0f2a419fec8c31c156fa08570b60be2caab))
19
+ * **core:** detect subpackage root conflicts early ([d554694](https://github.com/dlhandsome/we-debug/commit/d554694cf618a7da9d8b40e59194013998d3d4c3))
20
+ * **core:** escape boot stub paths ([aed51b8](https://github.com/dlhandsome/we-debug/commit/aed51b8775ce4e4784db95f3993e0476fd0a6ea0))
21
+ * **core:** preflight mixed injection modes ([0d3c6ee](https://github.com/dlhandsome/we-debug/commit/0d3c6eeabbedd7dcf33e0f0118e4d5c0ca8a739c))
22
+ * **core:** reject mixed injection modes ([36f8510](https://github.com/dlhandsome/we-debug/commit/36f8510b6bffc9a4a2abe6a309b68b58e2052668))
23
+ * **core:** validate subpackage buffer size ([1873422](https://github.com/dlhandsome/we-debug/commit/187342227827065d54d911331f471310683fcaeb))
24
+
25
+
26
+ ### Features
27
+
28
+ * **compiler-core:** collect npm package outputs for subpackage ([28a1aed](https://github.com/dlhandsome/we-debug/commit/28a1aed5c603154f7f30a3b2c94c2377ac706b74))
29
+ * **compiler-core:** generate boot stub that buffers early network and error events ([60fed40](https://github.com/dlhandsome/we-debug/commit/60fed408457785be3208c89ccdcbb212a04ba994))
30
+ * **compiler-core:** relocate entry directory and rewrite module paths ([7aada14](https://github.com/dlhandsome/we-debug/commit/7aada14151061497de5201da59151d93e0c5fb51))
31
+ * **compiler-core:** support subpackage injection mode ([de1226e](https://github.com/dlhandsome/we-debug/commit/de1226ee86becb530760a4c8131244b19bc75bc6))
32
+
33
+
34
+
35
+
36
+
37
+ # [0.51.0](https://github.com/dlhandsome/we-debug/compare/v0.50.0...v0.51.0) (2026-12-01)
38
+
39
+
40
+ ### Bug Fixes
41
+
42
+ * **compiler-core:** harden UI plugin compilation ([ecad19d](https://github.com/dlhandsome/we-debug/commit/ecad19d4c749eeca69562f67841b9c511700b262))
43
+ * **compiler-core:** 增量注入时保证清单顺序并为已有标签补 generic ([08a0eb7](https://github.com/dlhandsome/we-debug/commit/08a0eb79c67a7b0516061328f34d3ffb2e51124e))
44
+ * **compiler-core:** 恢复 beforeInit 在插件注册前执行的顺序 ([0c10c90](https://github.com/dlhandsome/we-debug/commit/0c10c90c8441e04d054db953e19dc2d464256f3c))
45
+ * **gulp-tool:** 初始化钩子沿用流中的首个文件 ([8e0fe23](https://github.com/dlhandsome/we-debug/commit/8e0fe2320c392647e7833a4ef1f7634c2b4400d8))
46
+
47
+
48
+ ### Features
49
+
50
+ * **compiler:** let UI plugin panels fill the debug panel body ([a7af2b4](https://github.com/dlhandsome/we-debug/commit/a7af2b43671b0aeaac9674da5e4242a04edfed5a))
51
+ * **compiler-core:** 支持 UI 插件发现、宿主与清单生成 ([32bf67b](https://github.com/dlhandsome/we-debug/commit/32bf67be331822eef263f070a6a42a3bec9449a0))
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Sail
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,15 @@
1
- # Temporary Holding Version
1
+ # @we-debug/compiler-core
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ we-debug 编译注入核心逻辑,由 [`@we-debug/cli`](../cli) 与 [`@we-debug/gulp-tool`](../gulp-tool) 共用。一般不需要直接依赖本包。
4
+
5
+ 如需在自定义构建流程中逐文件注入,可以直接使用 `Injector`:
6
+
7
+ ```javascript
8
+ const { Injector, VirtualFile } = require('@we-debug/compiler-core');
9
+
10
+ const injector = new Injector({ baseDir: 'src' });
11
+ injector.init();
12
+
13
+ const file = new VirtualFile({ base: injector.options.baseDir, path: absPath, contents: buffer });
14
+ injector.transform(file);
15
+ ```
@@ -0,0 +1,14 @@
1
+ export declare const PLUGIN_NAME = "@we-debug/compiler-core";
2
+ export declare const TRANSFORM_EXTNAMES: string[];
3
+ export declare const HOST_COMPONENT_NAME = "we-debug-host";
4
+ export declare const HOST_DIR = "we-debug-host";
5
+ export declare const GENERIC_NAME = "plugin-host";
6
+ export declare const DEFAULT_NPM_DIRNAME = "miniprogram_npm";
7
+ export declare const DEFAULT_SUBPACKAGE_ROOT = "we-debug-pkg";
8
+ export declare const DEFAULT_BOOT_BUFFER_SIZE = 200;
9
+ export declare const STUB_FILE = "we-debug-stub.js";
10
+ export declare const SUBPACKAGE_NPM_DIRNAME = "miniprogram_npm";
11
+ export declare const SUBPACKAGE_ENTRY_DIR = "entry";
12
+ export declare const PLACEHOLDER_PAGE = "placeholder/index";
13
+ export declare const WE_DEBUG_SCOPE = "@we-debug/";
14
+ export declare const COMPILER_PACKAGES: string[];
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.COMPILER_PACKAGES = exports.WE_DEBUG_SCOPE = exports.PLACEHOLDER_PAGE = exports.SUBPACKAGE_ENTRY_DIR = exports.SUBPACKAGE_NPM_DIRNAME = exports.STUB_FILE = exports.DEFAULT_BOOT_BUFFER_SIZE = exports.DEFAULT_SUBPACKAGE_ROOT = exports.DEFAULT_NPM_DIRNAME = exports.GENERIC_NAME = exports.HOST_DIR = exports.HOST_COMPONENT_NAME = exports.TRANSFORM_EXTNAMES = exports.PLUGIN_NAME = void 0;
4
+ exports.PLUGIN_NAME = '@we-debug/compiler-core';
5
+ exports.TRANSFORM_EXTNAMES = ['.wxml', '.json', '.js', '.ts'];
6
+ exports.HOST_COMPONENT_NAME = 'we-debug-host';
7
+ exports.HOST_DIR = 'we-debug-host';
8
+ exports.GENERIC_NAME = 'plugin-host';
9
+ exports.DEFAULT_NPM_DIRNAME = 'miniprogram_npm';
10
+ exports.DEFAULT_SUBPACKAGE_ROOT = 'we-debug-pkg';
11
+ exports.DEFAULT_BOOT_BUFFER_SIZE = 200;
12
+ exports.STUB_FILE = 'we-debug-stub.js';
13
+ exports.SUBPACKAGE_NPM_DIRNAME = 'miniprogram_npm';
14
+ exports.SUBPACKAGE_ENTRY_DIR = 'entry';
15
+ exports.PLACEHOLDER_PAGE = 'placeholder/index';
16
+ exports.WE_DEBUG_SCOPE = '@we-debug/';
17
+ exports.COMPILER_PACKAGES = ['@we-debug/cli', '@we-debug/gulp-tool', '@we-debug/compiler-core'];
@@ -0,0 +1,10 @@
1
+ export interface IEntryRelocation {
2
+ baseDir: string;
3
+ entryDir: string;
4
+ targetDir: string;
5
+ mainNpmDir: string;
6
+ subNpmDir: string;
7
+ packageNames?: string[];
8
+ }
9
+ export declare function relocatePath(r: IEntryRelocation, absPath: string): string;
10
+ export declare function rewriteRequires(r: IEntryRelocation, fromFile: string, code: string): string;
package/dist/entry.js ADDED
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.rewriteRequires = exports.relocatePath = void 0;
7
+ var path_1 = __importDefault(require("path"));
8
+ var utils_1 = require("./utils");
9
+ var SPECIFIER = /(\brequire\s*\(\s*|\bimport\s*\(\s*|\bfrom\s*|\bimport\s+)(['"])([^'"]+)\2/g;
10
+ function relocatePath(r, absPath) {
11
+ return (0, utils_1.isInside)(absPath, r.entryDir) ? path_1.default.join(r.targetDir, path_1.default.relative(r.entryDir, absPath)) : absPath;
12
+ }
13
+ exports.relocatePath = relocatePath;
14
+ function toSubNpm(r, target) {
15
+ if (!(0, utils_1.isInside)(target, r.mainNpmDir))
16
+ return target;
17
+ var relative = path_1.default.relative(r.mainNpmDir, target);
18
+ var segments = relative.split(path_1.default.sep);
19
+ var packageName = segments[0].charAt(0) === '@' ? segments.slice(0, 2).join('/') : segments[0];
20
+ if (packageName.indexOf('@we-debug/') !== 0 && (r.packageNames || []).indexOf(packageName) === -1)
21
+ return target;
22
+ return path_1.default.join(r.subNpmDir, relative);
23
+ }
24
+ function rewriteSpecifier(r, fromFile, spec) {
25
+ if (spec.charAt(0) === '/') {
26
+ return "/".concat((0, utils_1.toPosix)(path_1.default.relative(r.baseDir, toSubNpm(r, path_1.default.join(r.baseDir, spec)))));
27
+ }
28
+ if (spec.charAt(0) !== '.')
29
+ return spec;
30
+ var target = path_1.default.resolve(path_1.default.dirname(fromFile), spec);
31
+ if ((0, utils_1.isInside)(target, r.entryDir))
32
+ return spec;
33
+ return (0, utils_1.toRequirePath)(path_1.default.dirname(relocatePath(r, fromFile)), toSubNpm(r, target));
34
+ }
35
+ function rewriteRequires(r, fromFile, code) {
36
+ return code.replace(SPECIFIER, function (_match, prefix, quote, spec) {
37
+ return "".concat(prefix).concat(quote).concat(rewriteSpecifier(r, fromFile, spec)).concat(quote);
38
+ });
39
+ }
40
+ exports.rewriteRequires = rewriteRequires;
package/dist/file.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { IFile } from './types';
4
+ export declare class VirtualFile implements IFile {
5
+ cwd: string;
6
+ base: string;
7
+ path: string;
8
+ contents: Buffer | null;
9
+ constructor(options: {
10
+ cwd?: string;
11
+ base: string;
12
+ path: string;
13
+ contents: Buffer | null;
14
+ });
15
+ get relative(): string;
16
+ get dirname(): string;
17
+ get basename(): string;
18
+ get stem(): string;
19
+ get extname(): string;
20
+ isNull(): boolean;
21
+ isBuffer(): boolean;
22
+ isDirectory(): boolean;
23
+ }
package/dist/file.js ADDED
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.VirtualFile = void 0;
7
+ var path_1 = __importDefault(require("path"));
8
+ var VirtualFile = (function () {
9
+ function VirtualFile(options) {
10
+ this.cwd = options.cwd || process.cwd();
11
+ this.base = options.base;
12
+ this.path = options.path;
13
+ this.contents = options.contents;
14
+ }
15
+ Object.defineProperty(VirtualFile.prototype, "relative", {
16
+ get: function () {
17
+ return path_1.default.relative(this.base, this.path);
18
+ },
19
+ enumerable: false,
20
+ configurable: true
21
+ });
22
+ Object.defineProperty(VirtualFile.prototype, "dirname", {
23
+ get: function () {
24
+ return path_1.default.dirname(this.path);
25
+ },
26
+ enumerable: false,
27
+ configurable: true
28
+ });
29
+ Object.defineProperty(VirtualFile.prototype, "basename", {
30
+ get: function () {
31
+ return path_1.default.basename(this.path);
32
+ },
33
+ enumerable: false,
34
+ configurable: true
35
+ });
36
+ Object.defineProperty(VirtualFile.prototype, "stem", {
37
+ get: function () {
38
+ return path_1.default.basename(this.path, this.extname);
39
+ },
40
+ enumerable: false,
41
+ configurable: true
42
+ });
43
+ Object.defineProperty(VirtualFile.prototype, "extname", {
44
+ get: function () {
45
+ return path_1.default.extname(this.path);
46
+ },
47
+ enumerable: false,
48
+ configurable: true
49
+ });
50
+ VirtualFile.prototype.isNull = function () {
51
+ return this.contents === null;
52
+ };
53
+ VirtualFile.prototype.isBuffer = function () {
54
+ return Buffer.isBuffer(this.contents);
55
+ };
56
+ VirtualFile.prototype.isDirectory = function () {
57
+ return false;
58
+ };
59
+ return VirtualFile;
60
+ }());
61
+ exports.VirtualFile = VirtualFile;
@@ -0,0 +1,11 @@
1
+ export * from './types';
2
+ export { Injector, IResolvedCompilerOption, IResolvedSubpackage, resolveCompilerOption, getEntryRequire, getStubRequire, getEntryDir } from './injector';
3
+ export { VirtualFile } from './file';
4
+ export { PluginHost } from './plugin';
5
+ export { getAbsolutePath, toPosix, lookupPages, belongsPage, belongsApp, hitPageFilter, hitExclude, isInside, toRequirePath, findPackageDir, walkFiles } from './utils';
6
+ export { PLUGIN_NAME, TRANSFORM_EXTNAMES } from './constants';
7
+ export { IUIFile, IUIPlugin, IUIComponent, IUIDiscoverOption, discoverUIPlugins, generateUIFiles, getPluginPagePaths } from './ui';
8
+ export { collectNpmFiles } from './npm';
9
+ export { generateStub, IStubOption } from './stub';
10
+ export { IEntryRelocation, relocatePath, rewriteRequires } from './entry';
11
+ export { HOST_COMPONENT_NAME, HOST_DIR, GENERIC_NAME, DEFAULT_NPM_DIRNAME, DEFAULT_SUBPACKAGE_ROOT, STUB_FILE, SUBPACKAGE_NPM_DIRNAME } from './constants';
package/dist/index.js ADDED
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.SUBPACKAGE_NPM_DIRNAME = exports.STUB_FILE = exports.DEFAULT_SUBPACKAGE_ROOT = exports.DEFAULT_NPM_DIRNAME = exports.GENERIC_NAME = exports.HOST_DIR = exports.HOST_COMPONENT_NAME = exports.rewriteRequires = exports.relocatePath = exports.generateStub = exports.collectNpmFiles = exports.getPluginPagePaths = exports.generateUIFiles = exports.discoverUIPlugins = exports.TRANSFORM_EXTNAMES = exports.PLUGIN_NAME = exports.walkFiles = exports.findPackageDir = exports.toRequirePath = exports.isInside = exports.hitExclude = exports.hitPageFilter = exports.belongsApp = exports.belongsPage = exports.lookupPages = exports.toPosix = exports.getAbsolutePath = exports.PluginHost = exports.VirtualFile = exports.getEntryDir = exports.getStubRequire = exports.getEntryRequire = exports.resolveCompilerOption = exports.Injector = void 0;
18
+ __exportStar(require("./types"), exports);
19
+ var injector_1 = require("./injector");
20
+ Object.defineProperty(exports, "Injector", { enumerable: true, get: function () { return injector_1.Injector; } });
21
+ Object.defineProperty(exports, "resolveCompilerOption", { enumerable: true, get: function () { return injector_1.resolveCompilerOption; } });
22
+ Object.defineProperty(exports, "getEntryRequire", { enumerable: true, get: function () { return injector_1.getEntryRequire; } });
23
+ Object.defineProperty(exports, "getStubRequire", { enumerable: true, get: function () { return injector_1.getStubRequire; } });
24
+ Object.defineProperty(exports, "getEntryDir", { enumerable: true, get: function () { return injector_1.getEntryDir; } });
25
+ var file_1 = require("./file");
26
+ Object.defineProperty(exports, "VirtualFile", { enumerable: true, get: function () { return file_1.VirtualFile; } });
27
+ var plugin_1 = require("./plugin");
28
+ Object.defineProperty(exports, "PluginHost", { enumerable: true, get: function () { return plugin_1.PluginHost; } });
29
+ var utils_1 = require("./utils");
30
+ Object.defineProperty(exports, "getAbsolutePath", { enumerable: true, get: function () { return utils_1.getAbsolutePath; } });
31
+ Object.defineProperty(exports, "toPosix", { enumerable: true, get: function () { return utils_1.toPosix; } });
32
+ Object.defineProperty(exports, "lookupPages", { enumerable: true, get: function () { return utils_1.lookupPages; } });
33
+ Object.defineProperty(exports, "belongsPage", { enumerable: true, get: function () { return utils_1.belongsPage; } });
34
+ Object.defineProperty(exports, "belongsApp", { enumerable: true, get: function () { return utils_1.belongsApp; } });
35
+ Object.defineProperty(exports, "hitPageFilter", { enumerable: true, get: function () { return utils_1.hitPageFilter; } });
36
+ Object.defineProperty(exports, "hitExclude", { enumerable: true, get: function () { return utils_1.hitExclude; } });
37
+ Object.defineProperty(exports, "isInside", { enumerable: true, get: function () { return utils_1.isInside; } });
38
+ Object.defineProperty(exports, "toRequirePath", { enumerable: true, get: function () { return utils_1.toRequirePath; } });
39
+ Object.defineProperty(exports, "findPackageDir", { enumerable: true, get: function () { return utils_1.findPackageDir; } });
40
+ Object.defineProperty(exports, "walkFiles", { enumerable: true, get: function () { return utils_1.walkFiles; } });
41
+ var constants_1 = require("./constants");
42
+ Object.defineProperty(exports, "PLUGIN_NAME", { enumerable: true, get: function () { return constants_1.PLUGIN_NAME; } });
43
+ Object.defineProperty(exports, "TRANSFORM_EXTNAMES", { enumerable: true, get: function () { return constants_1.TRANSFORM_EXTNAMES; } });
44
+ var ui_1 = require("./ui");
45
+ Object.defineProperty(exports, "discoverUIPlugins", { enumerable: true, get: function () { return ui_1.discoverUIPlugins; } });
46
+ Object.defineProperty(exports, "generateUIFiles", { enumerable: true, get: function () { return ui_1.generateUIFiles; } });
47
+ Object.defineProperty(exports, "getPluginPagePaths", { enumerable: true, get: function () { return ui_1.getPluginPagePaths; } });
48
+ var npm_1 = require("./npm");
49
+ Object.defineProperty(exports, "collectNpmFiles", { enumerable: true, get: function () { return npm_1.collectNpmFiles; } });
50
+ var stub_1 = require("./stub");
51
+ Object.defineProperty(exports, "generateStub", { enumerable: true, get: function () { return stub_1.generateStub; } });
52
+ var entry_1 = require("./entry");
53
+ Object.defineProperty(exports, "relocatePath", { enumerable: true, get: function () { return entry_1.relocatePath; } });
54
+ Object.defineProperty(exports, "rewriteRequires", { enumerable: true, get: function () { return entry_1.rewriteRequires; } });
55
+ var constants_2 = require("./constants");
56
+ Object.defineProperty(exports, "HOST_COMPONENT_NAME", { enumerable: true, get: function () { return constants_2.HOST_COMPONENT_NAME; } });
57
+ Object.defineProperty(exports, "HOST_DIR", { enumerable: true, get: function () { return constants_2.HOST_DIR; } });
58
+ Object.defineProperty(exports, "GENERIC_NAME", { enumerable: true, get: function () { return constants_2.GENERIC_NAME; } });
59
+ Object.defineProperty(exports, "DEFAULT_NPM_DIRNAME", { enumerable: true, get: function () { return constants_2.DEFAULT_NPM_DIRNAME; } });
60
+ Object.defineProperty(exports, "DEFAULT_SUBPACKAGE_ROOT", { enumerable: true, get: function () { return constants_2.DEFAULT_SUBPACKAGE_ROOT; } });
61
+ Object.defineProperty(exports, "STUB_FILE", { enumerable: true, get: function () { return constants_2.STUB_FILE; } });
62
+ Object.defineProperty(exports, "SUBPACKAGE_NPM_DIRNAME", { enumerable: true, get: function () { return constants_2.SUBPACKAGE_NPM_DIRNAME; } });
@@ -0,0 +1,62 @@
1
+ import { PluginHost } from './plugin';
2
+ import { IUIFile, IUIPlugin } from './ui';
3
+ import { IEntryRelocation } from './entry';
4
+ import { FilterOption, ICompilerOption, ICompilerPluginOption, IFile } from './types';
5
+ export interface IResolvedSubpackage {
6
+ root: string;
7
+ bufferSize: number;
8
+ }
9
+ export interface IResolvedCompilerOption {
10
+ baseDir: string;
11
+ wxml: NonNullable<ICompilerOption['wxml']>;
12
+ filter: FilterOption | FilterOption[];
13
+ compName: string;
14
+ compPath: string;
15
+ entryFile: string;
16
+ plugins: ICompilerPluginOption[];
17
+ uiPlugins?: string[];
18
+ autoDiscoverUIPlugins: boolean;
19
+ npmDirname: string;
20
+ projectDir: string;
21
+ subpackage: IResolvedSubpackage | null;
22
+ }
23
+ export declare const getEntryDir: (entryFile: string) => string;
24
+ export declare function resolveCompilerOption(options?: ICompilerOption): IResolvedCompilerOption;
25
+ export declare const getEntryRequire: (entryFile: string) => string;
26
+ export declare const getStubRequire: () => string;
27
+ export declare class Injector {
28
+ private rawOptions;
29
+ readonly options: IResolvedCompilerOption;
30
+ readonly relocation: IEntryRelocation | null;
31
+ plugin: PluginHost;
32
+ pages: string[];
33
+ uiPlugins: IUIPlugin[];
34
+ subpackageNpmFiles: IUIFile[];
35
+ warnings: string[];
36
+ injectedPages: string[];
37
+ injectedAppJson: boolean;
38
+ injectedAppScript: boolean;
39
+ constructor(rawOptions?: ICompilerOption);
40
+ get uiNpmDirname(): string;
41
+ get hostDir(): string;
42
+ init(file?: IFile): void;
43
+ adoptInitState(source: Injector): void;
44
+ getUIFiles(): IUIFile[];
45
+ getOutputFiles(): IUIFile[];
46
+ private getSubpackageNpmFiles;
47
+ resolveOutputPath(absPath: string): string;
48
+ checkMainNpm(dir: string): void;
49
+ private warn;
50
+ private getSubpackageEntry;
51
+ private getSubpackageEntryPath;
52
+ private getSubpackageNpmNames;
53
+ private withGenericHost;
54
+ transform(file: IFile): IFile;
55
+ private relocateEntryFile;
56
+ private checkMainPackageRequire;
57
+ private parseWxml;
58
+ private parseJson;
59
+ private addSubpackage;
60
+ private parseScript;
61
+ private checkInjectionMode;
62
+ }