@atscript/core 0.1.32 → 0.1.33
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/dist/index.cjs +40 -59
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +40 -59
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2735,14 +2735,14 @@ else {
|
|
|
2735
2735
|
this.blocksIndex.add(block$2);
|
|
2736
2736
|
block$2.blockType = "import";
|
|
2737
2737
|
block$2.fromPath = from.text;
|
|
2738
|
+
this.tokensIndex.add(from);
|
|
2739
|
+
from.fromPath = from.text;
|
|
2738
2740
|
imports.forEach((t) => {
|
|
2739
2741
|
t.imported = true;
|
|
2740
2742
|
t.fromPath = from.text;
|
|
2741
2743
|
this.registerDefinition(t, true);
|
|
2742
2744
|
this.tokensIndex.add(t);
|
|
2743
|
-
this.tokensIndex.add(from);
|
|
2744
2745
|
this.importedDefs.set(t.text, from);
|
|
2745
|
-
from.fromPath = from.text;
|
|
2746
2746
|
});
|
|
2747
2747
|
}
|
|
2748
2748
|
nextTypeId() {
|
|
@@ -2811,7 +2811,7 @@ else {
|
|
|
2811
2811
|
getUnusedTokens() {
|
|
2812
2812
|
const refSet = new Set(this.referred.filter((r) => !r.imported).map((r) => r.text));
|
|
2813
2813
|
const tokens$1 = [];
|
|
2814
|
-
for (const [key, token] of
|
|
2814
|
+
for (const [key, token] of this.registry.definitions) if (!refSet.has(key) && !this.exports.has(key)) tokens$1.push(token);
|
|
2815
2815
|
return tokens$1;
|
|
2816
2816
|
}
|
|
2817
2817
|
renderDiagMessage(m, addSourceLinses = false, colors = false) {
|
|
@@ -2865,7 +2865,7 @@ else {
|
|
|
2865
2865
|
l: lines[n - 1],
|
|
2866
2866
|
i: n - 1
|
|
2867
2867
|
}
|
|
2868
|
-
].filter(
|
|
2868
|
+
].filter((r) => r.l !== undefined);
|
|
2869
2869
|
const nl = String(n).length + 1;
|
|
2870
2870
|
for (const { l, i } of renderLines) {
|
|
2871
2871
|
const prefix = `${c.dim + c.cyan}${`0${i}`.slice(-nl)} | ${c.reset}`;
|
|
@@ -3062,13 +3062,7 @@ else {
|
|
|
3062
3062
|
if (!left || !right) return [_left, _right];
|
|
3063
3063
|
if (isPrimitive(left) && isPrimitive(right)) {
|
|
3064
3064
|
if (left.config.type === right.config.type) return [left];
|
|
3065
|
-
|
|
3066
|
-
never$1.saveToken(new Token({
|
|
3067
|
-
text: "never",
|
|
3068
|
-
type: "identifier",
|
|
3069
|
-
getRange: () => zeroRange
|
|
3070
|
-
}), "identifier");
|
|
3071
|
-
return [never$1];
|
|
3065
|
+
return [createSyntheticRef("never")];
|
|
3072
3066
|
}
|
|
3073
3067
|
if ((isStructure(left) || isInterface(left)) && (isStructure(right) || isInterface(right))) {
|
|
3074
3068
|
const mergedProps = [];
|
|
@@ -3086,15 +3080,7 @@ else {
|
|
|
3086
3080
|
}
|
|
3087
3081
|
const prop = new SemanticPropNode();
|
|
3088
3082
|
prop.saveToken((leftProp || rightProp).token("identifier"), "identifier");
|
|
3089
|
-
if (isPrimitive(mergedDef))
|
|
3090
|
-
const name = mergedDef.id;
|
|
3091
|
-
mergedDef = new SemanticRefNode();
|
|
3092
|
-
mergedDef.saveToken(new Token({
|
|
3093
|
-
text: name,
|
|
3094
|
-
type: "identifier",
|
|
3095
|
-
getRange: () => zeroRange
|
|
3096
|
-
}), "identifier");
|
|
3097
|
-
}
|
|
3083
|
+
if (isPrimitive(mergedDef)) mergedDef = createSyntheticRef(mergedDef.id);
|
|
3098
3084
|
prop.define(mergedDef);
|
|
3099
3085
|
prop.annotations = this.mergeNodesAnnotations(leftProp?.annotations, rightProp?.annotations);
|
|
3100
3086
|
const oldProps = [leftProp, rightProp].filter(Boolean);
|
|
@@ -3108,17 +3094,10 @@ else {
|
|
|
3108
3094
|
}
|
|
3109
3095
|
const mergedStructure = new SemanticStructureNode();
|
|
3110
3096
|
mergedStructure.setProps(mergedProps);
|
|
3111
|
-
this.resolveAnnotation;
|
|
3112
3097
|
mergedStructure.annotations = this.mergeNodesAnnotations(left.annotations, right.annotations);
|
|
3113
3098
|
return [mergedStructure];
|
|
3114
3099
|
}
|
|
3115
|
-
|
|
3116
|
-
never.saveToken(new Token({
|
|
3117
|
-
text: "never",
|
|
3118
|
-
type: "identifier",
|
|
3119
|
-
getRange: () => zeroRange
|
|
3120
|
-
}), "identifier");
|
|
3121
|
-
return [never];
|
|
3100
|
+
return [createSyntheticRef("never")];
|
|
3122
3101
|
}
|
|
3123
3102
|
/**
|
|
3124
3103
|
* Merges two arrays of annotation tokens, ensuring that annotations from the
|
|
@@ -3218,6 +3197,15 @@ const zeroRange = {
|
|
|
3218
3197
|
character: 0
|
|
3219
3198
|
}
|
|
3220
3199
|
};
|
|
3200
|
+
function createSyntheticRef(name) {
|
|
3201
|
+
const ref$1 = new SemanticRefNode();
|
|
3202
|
+
ref$1.saveToken(new Token({
|
|
3203
|
+
text: name,
|
|
3204
|
+
type: "identifier",
|
|
3205
|
+
getRange: () => zeroRange
|
|
3206
|
+
}), "identifier");
|
|
3207
|
+
return ref$1;
|
|
3208
|
+
}
|
|
3221
3209
|
|
|
3222
3210
|
//#endregion
|
|
3223
3211
|
//#region packages/core/src/defaults/db-annotations.ts
|
|
@@ -4064,31 +4052,22 @@ var PluginManager = class {
|
|
|
4064
4052
|
const raw = await this.config();
|
|
4065
4053
|
this._docConfig = {};
|
|
4066
4054
|
if (raw?.primitives) {
|
|
4067
|
-
this._docConfig.primitives =
|
|
4055
|
+
this._docConfig.primitives = new Map();
|
|
4068
4056
|
for (const [key, value] of Object.entries(raw.primitives)) this._docConfig.primitives.set(key, new SemanticPrimitiveNode(key, value, "", raw.annotations));
|
|
4069
4057
|
}
|
|
4070
|
-
if (raw?.annotations) {
|
|
4071
|
-
this._docConfig.annotations = this._docConfig.annotations || {};
|
|
4072
|
-
Object.assign(this._docConfig.annotations, raw.annotations);
|
|
4073
|
-
}
|
|
4058
|
+
if (raw?.annotations) this._docConfig.annotations = { ...raw.annotations };
|
|
4074
4059
|
this._docConfig.unknownAnnotation = raw?.unknownAnnotation;
|
|
4075
4060
|
}
|
|
4076
4061
|
return this._docConfig;
|
|
4077
4062
|
}
|
|
4078
4063
|
async config(config = this.cfg) {
|
|
4079
4064
|
if (!this._config) {
|
|
4080
|
-
const processed = new Set();
|
|
4081
4065
|
config = (0, defu.defu)(config, getDefaultAtscriptConfig());
|
|
4082
|
-
const
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
if (processed.has(plugin.name)) continue;
|
|
4088
|
-
config = (0, defu.defu)(await plugin.config?.(config), config);
|
|
4089
|
-
processed.add(plugin.name);
|
|
4090
|
-
}
|
|
4091
|
-
if (i > 100) throw new Error(`Too many iterations in config`);
|
|
4066
|
+
const seen = new Set();
|
|
4067
|
+
for (const plugin of this.plugins) {
|
|
4068
|
+
if (seen.has(plugin.name)) continue;
|
|
4069
|
+
seen.add(plugin.name);
|
|
4070
|
+
config = (0, defu.defu)(await plugin.config?.(config), config);
|
|
4092
4071
|
}
|
|
4093
4072
|
this._config = config;
|
|
4094
4073
|
}
|
|
@@ -4096,28 +4075,28 @@ var PluginManager = class {
|
|
|
4096
4075
|
}
|
|
4097
4076
|
async resolve(id) {
|
|
4098
4077
|
let newId = id;
|
|
4099
|
-
for (const plugin of this.plugins) if (plugin.resolve) newId = await plugin.resolve(
|
|
4078
|
+
for (const plugin of this.plugins) if (plugin.resolve) newId = await plugin.resolve(newId) ?? newId;
|
|
4100
4079
|
return newId;
|
|
4101
4080
|
}
|
|
4102
4081
|
async load(id) {
|
|
4103
4082
|
const filePath = id.startsWith("file://") ? id.slice(7) : id;
|
|
4104
4083
|
for (const plugin of this.plugins) if (plugin.load) {
|
|
4105
|
-
const content
|
|
4106
|
-
if (content
|
|
4084
|
+
const content = await plugin.load(id);
|
|
4085
|
+
if (content) return content;
|
|
4107
4086
|
}
|
|
4108
|
-
|
|
4109
|
-
return content.toString();
|
|
4087
|
+
return (0, node_fs_promises.readFile)(filePath, "utf8");
|
|
4110
4088
|
}
|
|
4111
4089
|
async onDocument(doc) {
|
|
4112
4090
|
for (const plugin of this.plugins) if (plugin.onDocument) await plugin.onDocument(doc);
|
|
4113
4091
|
}
|
|
4114
4092
|
async render(doc, format) {
|
|
4093
|
+
const source = doc.id.startsWith("file://") ? doc.id.slice(7) : doc.id;
|
|
4115
4094
|
const files = [];
|
|
4116
4095
|
for (const plugin of this.plugins) if (plugin.render) {
|
|
4117
4096
|
const newFiles = await plugin.render(doc, format);
|
|
4118
4097
|
if (newFiles?.length > 0) files.push(...newFiles.map((f) => ({
|
|
4119
4098
|
...f,
|
|
4120
|
-
source
|
|
4099
|
+
source
|
|
4121
4100
|
})));
|
|
4122
4101
|
}
|
|
4123
4102
|
return files;
|
|
@@ -4251,17 +4230,16 @@ else types.push({ type: "boolean" });
|
|
|
4251
4230
|
}
|
|
4252
4231
|
const configFile = await resolveConfigFile(id, this.root);
|
|
4253
4232
|
if (configFile) {
|
|
4254
|
-
|
|
4255
|
-
if (!this.configFiles.has(globalPathToConfig)) {
|
|
4233
|
+
if (!this.configFiles.has(configFile)) {
|
|
4256
4234
|
const rawConfigPromise = loadConfig(configFile, this.configFormat);
|
|
4257
|
-
this.configFiles.set(
|
|
4235
|
+
this.configFiles.set(configFile, rawConfigPromise);
|
|
4258
4236
|
}
|
|
4259
|
-
const rawConfig = await this.configFiles.get(
|
|
4237
|
+
const rawConfig = await this.configFiles.get(configFile);
|
|
4260
4238
|
if (!rawConfig.rootDir) rawConfig.rootDir = node_path.default.dirname(configFile);
|
|
4261
4239
|
const manager = new PluginManager(rawConfig);
|
|
4262
4240
|
await manager.getDocConfig();
|
|
4263
4241
|
return {
|
|
4264
|
-
file:
|
|
4242
|
+
file: configFile,
|
|
4265
4243
|
manager,
|
|
4266
4244
|
dependants: new Set()
|
|
4267
4245
|
};
|
|
@@ -4288,10 +4266,13 @@ else types.push({ type: "boolean" });
|
|
|
4288
4266
|
async openDocument(id, text$2) {
|
|
4289
4267
|
let atscript = this.atscripts.get(id);
|
|
4290
4268
|
if (atscript) {
|
|
4291
|
-
if (text$2)
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4269
|
+
if (text$2) {
|
|
4270
|
+
atscript = atscript.then((d) => {
|
|
4271
|
+
d.update(text$2);
|
|
4272
|
+
return d;
|
|
4273
|
+
});
|
|
4274
|
+
this.atscripts.set(id, atscript);
|
|
4275
|
+
}
|
|
4295
4276
|
} else {
|
|
4296
4277
|
atscript = this._openDocument(id, text$2);
|
|
4297
4278
|
atscript.catch(() => {
|
package/dist/index.d.ts
CHANGED
|
@@ -217,7 +217,7 @@ declare class PluginManager {
|
|
|
217
217
|
get plugins(): TAtscriptPlugin[];
|
|
218
218
|
getDocConfig(): Promise<TAtscriptDocConfig>;
|
|
219
219
|
config(config?: TAtscriptConfig): Promise<TAtscriptConfig>;
|
|
220
|
-
resolve(id: string): Promise<string
|
|
220
|
+
resolve(id: string): Promise<string>;
|
|
221
221
|
load(id: string): Promise<string>;
|
|
222
222
|
onDocument(doc: AtscriptDoc): Promise<void>;
|
|
223
223
|
render(doc: AtscriptDoc, format: TAtscriptRenderFormat): Promise<TOutputWithSource[]>;
|
package/dist/index.mjs
CHANGED
|
@@ -2711,14 +2711,14 @@ else {
|
|
|
2711
2711
|
this.blocksIndex.add(block$2);
|
|
2712
2712
|
block$2.blockType = "import";
|
|
2713
2713
|
block$2.fromPath = from.text;
|
|
2714
|
+
this.tokensIndex.add(from);
|
|
2715
|
+
from.fromPath = from.text;
|
|
2714
2716
|
imports.forEach((t) => {
|
|
2715
2717
|
t.imported = true;
|
|
2716
2718
|
t.fromPath = from.text;
|
|
2717
2719
|
this.registerDefinition(t, true);
|
|
2718
2720
|
this.tokensIndex.add(t);
|
|
2719
|
-
this.tokensIndex.add(from);
|
|
2720
2721
|
this.importedDefs.set(t.text, from);
|
|
2721
|
-
from.fromPath = from.text;
|
|
2722
2722
|
});
|
|
2723
2723
|
}
|
|
2724
2724
|
nextTypeId() {
|
|
@@ -2787,7 +2787,7 @@ else {
|
|
|
2787
2787
|
getUnusedTokens() {
|
|
2788
2788
|
const refSet = new Set(this.referred.filter((r) => !r.imported).map((r) => r.text));
|
|
2789
2789
|
const tokens$1 = [];
|
|
2790
|
-
for (const [key, token] of
|
|
2790
|
+
for (const [key, token] of this.registry.definitions) if (!refSet.has(key) && !this.exports.has(key)) tokens$1.push(token);
|
|
2791
2791
|
return tokens$1;
|
|
2792
2792
|
}
|
|
2793
2793
|
renderDiagMessage(m, addSourceLinses = false, colors = false) {
|
|
@@ -2841,7 +2841,7 @@ else {
|
|
|
2841
2841
|
l: lines[n - 1],
|
|
2842
2842
|
i: n - 1
|
|
2843
2843
|
}
|
|
2844
|
-
].filter(
|
|
2844
|
+
].filter((r) => r.l !== undefined);
|
|
2845
2845
|
const nl = String(n).length + 1;
|
|
2846
2846
|
for (const { l, i } of renderLines) {
|
|
2847
2847
|
const prefix = `${c.dim + c.cyan}${`0${i}`.slice(-nl)} | ${c.reset}`;
|
|
@@ -3038,13 +3038,7 @@ else {
|
|
|
3038
3038
|
if (!left || !right) return [_left, _right];
|
|
3039
3039
|
if (isPrimitive(left) && isPrimitive(right)) {
|
|
3040
3040
|
if (left.config.type === right.config.type) return [left];
|
|
3041
|
-
|
|
3042
|
-
never$1.saveToken(new Token({
|
|
3043
|
-
text: "never",
|
|
3044
|
-
type: "identifier",
|
|
3045
|
-
getRange: () => zeroRange
|
|
3046
|
-
}), "identifier");
|
|
3047
|
-
return [never$1];
|
|
3041
|
+
return [createSyntheticRef("never")];
|
|
3048
3042
|
}
|
|
3049
3043
|
if ((isStructure(left) || isInterface(left)) && (isStructure(right) || isInterface(right))) {
|
|
3050
3044
|
const mergedProps = [];
|
|
@@ -3062,15 +3056,7 @@ else {
|
|
|
3062
3056
|
}
|
|
3063
3057
|
const prop = new SemanticPropNode();
|
|
3064
3058
|
prop.saveToken((leftProp || rightProp).token("identifier"), "identifier");
|
|
3065
|
-
if (isPrimitive(mergedDef))
|
|
3066
|
-
const name = mergedDef.id;
|
|
3067
|
-
mergedDef = new SemanticRefNode();
|
|
3068
|
-
mergedDef.saveToken(new Token({
|
|
3069
|
-
text: name,
|
|
3070
|
-
type: "identifier",
|
|
3071
|
-
getRange: () => zeroRange
|
|
3072
|
-
}), "identifier");
|
|
3073
|
-
}
|
|
3059
|
+
if (isPrimitive(mergedDef)) mergedDef = createSyntheticRef(mergedDef.id);
|
|
3074
3060
|
prop.define(mergedDef);
|
|
3075
3061
|
prop.annotations = this.mergeNodesAnnotations(leftProp?.annotations, rightProp?.annotations);
|
|
3076
3062
|
const oldProps = [leftProp, rightProp].filter(Boolean);
|
|
@@ -3084,17 +3070,10 @@ else {
|
|
|
3084
3070
|
}
|
|
3085
3071
|
const mergedStructure = new SemanticStructureNode();
|
|
3086
3072
|
mergedStructure.setProps(mergedProps);
|
|
3087
|
-
this.resolveAnnotation;
|
|
3088
3073
|
mergedStructure.annotations = this.mergeNodesAnnotations(left.annotations, right.annotations);
|
|
3089
3074
|
return [mergedStructure];
|
|
3090
3075
|
}
|
|
3091
|
-
|
|
3092
|
-
never.saveToken(new Token({
|
|
3093
|
-
text: "never",
|
|
3094
|
-
type: "identifier",
|
|
3095
|
-
getRange: () => zeroRange
|
|
3096
|
-
}), "identifier");
|
|
3097
|
-
return [never];
|
|
3076
|
+
return [createSyntheticRef("never")];
|
|
3098
3077
|
}
|
|
3099
3078
|
/**
|
|
3100
3079
|
* Merges two arrays of annotation tokens, ensuring that annotations from the
|
|
@@ -3194,6 +3173,15 @@ const zeroRange = {
|
|
|
3194
3173
|
character: 0
|
|
3195
3174
|
}
|
|
3196
3175
|
};
|
|
3176
|
+
function createSyntheticRef(name) {
|
|
3177
|
+
const ref$1 = new SemanticRefNode();
|
|
3178
|
+
ref$1.saveToken(new Token({
|
|
3179
|
+
text: name,
|
|
3180
|
+
type: "identifier",
|
|
3181
|
+
getRange: () => zeroRange
|
|
3182
|
+
}), "identifier");
|
|
3183
|
+
return ref$1;
|
|
3184
|
+
}
|
|
3197
3185
|
|
|
3198
3186
|
//#endregion
|
|
3199
3187
|
//#region packages/core/src/defaults/db-annotations.ts
|
|
@@ -4040,31 +4028,22 @@ var PluginManager = class {
|
|
|
4040
4028
|
const raw = await this.config();
|
|
4041
4029
|
this._docConfig = {};
|
|
4042
4030
|
if (raw?.primitives) {
|
|
4043
|
-
this._docConfig.primitives =
|
|
4031
|
+
this._docConfig.primitives = new Map();
|
|
4044
4032
|
for (const [key, value] of Object.entries(raw.primitives)) this._docConfig.primitives.set(key, new SemanticPrimitiveNode(key, value, "", raw.annotations));
|
|
4045
4033
|
}
|
|
4046
|
-
if (raw?.annotations) {
|
|
4047
|
-
this._docConfig.annotations = this._docConfig.annotations || {};
|
|
4048
|
-
Object.assign(this._docConfig.annotations, raw.annotations);
|
|
4049
|
-
}
|
|
4034
|
+
if (raw?.annotations) this._docConfig.annotations = { ...raw.annotations };
|
|
4050
4035
|
this._docConfig.unknownAnnotation = raw?.unknownAnnotation;
|
|
4051
4036
|
}
|
|
4052
4037
|
return this._docConfig;
|
|
4053
4038
|
}
|
|
4054
4039
|
async config(config = this.cfg) {
|
|
4055
4040
|
if (!this._config) {
|
|
4056
|
-
const processed = new Set();
|
|
4057
4041
|
config = defu(config, getDefaultAtscriptConfig());
|
|
4058
|
-
const
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
if (processed.has(plugin.name)) continue;
|
|
4064
|
-
config = defu(await plugin.config?.(config), config);
|
|
4065
|
-
processed.add(plugin.name);
|
|
4066
|
-
}
|
|
4067
|
-
if (i > 100) throw new Error(`Too many iterations in config`);
|
|
4042
|
+
const seen = new Set();
|
|
4043
|
+
for (const plugin of this.plugins) {
|
|
4044
|
+
if (seen.has(plugin.name)) continue;
|
|
4045
|
+
seen.add(plugin.name);
|
|
4046
|
+
config = defu(await plugin.config?.(config), config);
|
|
4068
4047
|
}
|
|
4069
4048
|
this._config = config;
|
|
4070
4049
|
}
|
|
@@ -4072,28 +4051,28 @@ var PluginManager = class {
|
|
|
4072
4051
|
}
|
|
4073
4052
|
async resolve(id) {
|
|
4074
4053
|
let newId = id;
|
|
4075
|
-
for (const plugin of this.plugins) if (plugin.resolve) newId = await plugin.resolve(
|
|
4054
|
+
for (const plugin of this.plugins) if (plugin.resolve) newId = await plugin.resolve(newId) ?? newId;
|
|
4076
4055
|
return newId;
|
|
4077
4056
|
}
|
|
4078
4057
|
async load(id) {
|
|
4079
4058
|
const filePath = id.startsWith("file://") ? id.slice(7) : id;
|
|
4080
4059
|
for (const plugin of this.plugins) if (plugin.load) {
|
|
4081
|
-
const content
|
|
4082
|
-
if (content
|
|
4060
|
+
const content = await plugin.load(id);
|
|
4061
|
+
if (content) return content;
|
|
4083
4062
|
}
|
|
4084
|
-
|
|
4085
|
-
return content.toString();
|
|
4063
|
+
return readFile(filePath, "utf8");
|
|
4086
4064
|
}
|
|
4087
4065
|
async onDocument(doc) {
|
|
4088
4066
|
for (const plugin of this.plugins) if (plugin.onDocument) await plugin.onDocument(doc);
|
|
4089
4067
|
}
|
|
4090
4068
|
async render(doc, format) {
|
|
4069
|
+
const source = doc.id.startsWith("file://") ? doc.id.slice(7) : doc.id;
|
|
4091
4070
|
const files = [];
|
|
4092
4071
|
for (const plugin of this.plugins) if (plugin.render) {
|
|
4093
4072
|
const newFiles = await plugin.render(doc, format);
|
|
4094
4073
|
if (newFiles?.length > 0) files.push(...newFiles.map((f) => ({
|
|
4095
4074
|
...f,
|
|
4096
|
-
source
|
|
4075
|
+
source
|
|
4097
4076
|
})));
|
|
4098
4077
|
}
|
|
4099
4078
|
return files;
|
|
@@ -4227,17 +4206,16 @@ else types.push({ type: "boolean" });
|
|
|
4227
4206
|
}
|
|
4228
4207
|
const configFile = await resolveConfigFile(id, this.root);
|
|
4229
4208
|
if (configFile) {
|
|
4230
|
-
|
|
4231
|
-
if (!this.configFiles.has(globalPathToConfig)) {
|
|
4209
|
+
if (!this.configFiles.has(configFile)) {
|
|
4232
4210
|
const rawConfigPromise = loadConfig(configFile, this.configFormat);
|
|
4233
|
-
this.configFiles.set(
|
|
4211
|
+
this.configFiles.set(configFile, rawConfigPromise);
|
|
4234
4212
|
}
|
|
4235
|
-
const rawConfig = await this.configFiles.get(
|
|
4213
|
+
const rawConfig = await this.configFiles.get(configFile);
|
|
4236
4214
|
if (!rawConfig.rootDir) rawConfig.rootDir = path.dirname(configFile);
|
|
4237
4215
|
const manager = new PluginManager(rawConfig);
|
|
4238
4216
|
await manager.getDocConfig();
|
|
4239
4217
|
return {
|
|
4240
|
-
file:
|
|
4218
|
+
file: configFile,
|
|
4241
4219
|
manager,
|
|
4242
4220
|
dependants: new Set()
|
|
4243
4221
|
};
|
|
@@ -4264,10 +4242,13 @@ else types.push({ type: "boolean" });
|
|
|
4264
4242
|
async openDocument(id, text$2) {
|
|
4265
4243
|
let atscript = this.atscripts.get(id);
|
|
4266
4244
|
if (atscript) {
|
|
4267
|
-
if (text$2)
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4245
|
+
if (text$2) {
|
|
4246
|
+
atscript = atscript.then((d) => {
|
|
4247
|
+
d.update(text$2);
|
|
4248
|
+
return d;
|
|
4249
|
+
});
|
|
4250
|
+
this.atscripts.set(id, atscript);
|
|
4251
|
+
}
|
|
4271
4252
|
} else {
|
|
4272
4253
|
atscript = this._openDocument(id, text$2);
|
|
4273
4254
|
atscript.catch(() => {
|