@atscript/core 0.1.17 → 0.1.18

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 CHANGED
@@ -31,8 +31,8 @@ const __prostojs_parser = __toESM(require("@prostojs/parser"));
31
31
  const path = __toESM(require("path"));
32
32
  const url = __toESM(require("url"));
33
33
  const defu = __toESM(require("defu"));
34
- const glob = __toESM(require("glob"));
35
34
  const fs_promises = __toESM(require("fs/promises"));
35
+ const glob = __toESM(require("glob"));
36
36
 
37
37
  //#region packages/core/src/parser/nodes/semantic-node.ts
38
38
  function _define_property$14(obj, key, value) {
@@ -370,7 +370,7 @@ var Token = class Token {
370
370
  return this._data.children || [];
371
371
  }
372
372
  get hasChildren() {
373
- return Boolean(this._data.children?.length);
373
+ return (this._data.children?.length ?? 0) > 0;
374
374
  }
375
375
  /**
376
376
  * This is truth if the text token was ended with a newline character
@@ -448,7 +448,7 @@ var SemanticPrimitiveNode = class SemanticPrimitiveNode extends SemanticNode {
448
448
  token: dummyToken,
449
449
  args: []
450
450
  });
451
- if (typeof this.config.expect?.pattern !== "undefined") {
451
+ if (this.config.expect?.pattern !== undefined) {
452
452
  const patterns = Array.isArray(this.config.expect.pattern) ? this.config.expect.pattern : [this.config.expect.pattern];
453
453
  for (const p of patterns) {
454
454
  const args = typeof p === "string" ? [text$1(p)] : [text$1(p.source), text$1(p.flags)];
@@ -1375,19 +1375,6 @@ const PunctuationToken = new __prostojs_parser.BasicNode({
1375
1375
  context.customData.type = "punctuation";
1376
1376
  });
1377
1377
 
1378
- //#endregion
1379
- //#region packages/core/src/tokenizer/tokens/text.node.ts
1380
- const TextToken = new __prostojs_parser.BasicNode({
1381
- icon: "T",
1382
- tokens: [RegExp("(?<quote>[\"'])", "u"), (context) => new RegExp(`(?<end>${context.getCustomData().quote || ""}|\\n)`)],
1383
- backSlash: "-ignore",
1384
- tokenOE: "omit-omit"
1385
- }).mapContent("text", "join-clear").onMatch((context) => {
1386
- context.customData.type = "text";
1387
- }).onPop((context) => {
1388
- context.customData.multiline = context.customData.end === "\n";
1389
- });
1390
-
1391
1378
  //#endregion
1392
1379
  //#region packages/core/src/tokenizer/tokens/regexp.token.ts
1393
1380
  const REGEXP_LITERAL_RE = /\/(?![/*])(?:\\.|\[.*?]|[^/\\\n\r[])*\/[dgimsuy]*/;
@@ -1401,6 +1388,19 @@ const RegExpToken = new __prostojs_parser.BasicNode({
1401
1388
  ctx.customData.text = ctx.matched[0];
1402
1389
  });
1403
1390
 
1391
+ //#endregion
1392
+ //#region packages/core/src/tokenizer/tokens/text.node.ts
1393
+ const TextToken = new __prostojs_parser.BasicNode({
1394
+ icon: "T",
1395
+ tokens: [RegExp("(?<quote>[\"'])", "u"), (context) => new RegExp(`(?<end>${context.getCustomData().quote || ""}|\\n)`)],
1396
+ backSlash: "-ignore",
1397
+ tokenOE: "omit-omit"
1398
+ }).mapContent("text", "join-clear").onMatch((context) => {
1399
+ context.customData.type = "text";
1400
+ }).onPop((context) => {
1401
+ context.customData.multiline = context.customData.end === "\n";
1402
+ });
1403
+
1404
1404
  //#endregion
1405
1405
  //#region packages/core/src/tokenizer/tokens/index.ts
1406
1406
  const tokens = {
@@ -1948,13 +1948,14 @@ function propName() {
1948
1948
  return { handler(ni, target) {
1949
1949
  switch (ni.$?.type) {
1950
1950
  case "identifier":
1951
- case "text":
1951
+ case "text": {
1952
1952
  target.node.saveToken(new Token(ni.$), "identifier");
1953
1953
  ni.accepted();
1954
1954
  ni.move();
1955
1955
  ni.skip(["\n"]);
1956
1956
  return true;
1957
- case "block":
1957
+ }
1958
+ case "block": {
1958
1959
  const childrenLength = ni.$.children?.length || 0;
1959
1960
  const firstText = ni.$.children?.[0]?.text;
1960
1961
  if (ni.$.text === "[" && ni.$.children?.[0]?.type === "unknown" && childrenLength === 1 && ni.$.children[0].text === "*" || ni.$.text === "[" && ni.$.children?.[0]?.type === "regexp" && childrenLength === 1) {
@@ -1964,8 +1965,8 @@ function propName() {
1964
1965
  });
1965
1966
  try {
1966
1967
  t.pattern = firstText === "*" ? /./ : parseRegExpLiteral(firstText);
1967
- } catch (e) {
1968
- ni.unexpected(false, e.message);
1968
+ } catch (error) {
1969
+ ni.unexpected(false, error.message);
1969
1970
  return false;
1970
1971
  }
1971
1972
  target.node.saveToken(t, "identifier");
@@ -1978,9 +1979,11 @@ function propName() {
1978
1979
  if (ni.$.text === "[" && childrenLength > 1) ni.unexpected(false, firstText?.startsWith("/") ? "Invalid Regular Expression" : "To many arguments in prop pattern []");
1979
1980
  else ni.unexpected(false, "Unexpected identifier at property name");
1980
1981
  return false;
1981
- default:
1982
+ }
1983
+ default: {
1982
1984
  ni.unexpected(false, "Unexpected identifier at property name");
1983
1985
  return false;
1986
+ }
1984
1987
  }
1985
1988
  } };
1986
1989
  }
@@ -2353,12 +2356,14 @@ var AtscriptDoc = class {
2353
2356
  } else {
2354
2357
  let severity = 0;
2355
2358
  switch (this.config.unknownAnnotation) {
2356
- case "warn":
2359
+ case "warn": {
2357
2360
  severity = 2;
2358
2361
  break;
2359
- case "error":
2362
+ }
2363
+ case "error": {
2360
2364
  severity = 1;
2361
2365
  break;
2366
+ }
2362
2367
  default:
2363
2368
  }
2364
2369
  if (severity > 0) this.registerMessage(mainToken, `Unknown annotation "${mainToken.text}"`, severity, "dim");
@@ -2683,22 +2688,26 @@ else if (isStructure(def) || isInterface(def) || isPrimitive(def)) def = def.pro
2683
2688
  let sc = "";
2684
2689
  let banner = "[atscript]";
2685
2690
  switch (m.severity) {
2686
- case TSeverity.Error:
2691
+ case TSeverity.Error: {
2687
2692
  sc = c.red;
2688
2693
  banner += "[Error]";
2689
2694
  break;
2690
- case TSeverity.Warning:
2695
+ }
2696
+ case TSeverity.Warning: {
2691
2697
  sc = c.yellow;
2692
2698
  banner += "[Warning]";
2693
2699
  break;
2694
- case TSeverity.Info:
2700
+ }
2701
+ case TSeverity.Info: {
2695
2702
  sc = "";
2696
2703
  banner += "[Info]";
2697
2704
  break;
2698
- case TSeverity.Hint:
2705
+ }
2706
+ case TSeverity.Hint: {
2699
2707
  sc = c.dim;
2700
2708
  banner += "[Hint]";
2701
2709
  break;
2710
+ }
2702
2711
  default: sc = "";
2703
2712
  }
2704
2713
  const n = m.range.start.line + 1;
@@ -2721,12 +2730,12 @@ else if (isStructure(def) || isInterface(def) || isPrimitive(def)) def = def.pro
2721
2730
  ].filter(Boolean);
2722
2731
  const nl = String(n).length + 1;
2723
2732
  for (const { l, i } of renderLines) {
2724
- const prefix = `${c.dim + c.cyan}${("0" + i).slice(-nl)} | ${c.reset}`;
2733
+ const prefix = `${c.dim + c.cyan}${`0${i}`.slice(-nl)} | ${c.reset}`;
2725
2734
  out += `\n${prefix}${l}${c.reset}`;
2726
2735
  }
2727
2736
  out += `\n${" ".repeat(nl + 3 + m.range.start.character)}${c.red}${"^".repeat(m.range.end.character - m.range.start.character)}${c.reset}`;
2728
2737
  }
2729
- return out + "\n";
2738
+ return `${out}\n`;
2730
2739
  }
2731
2740
  getDiagMessages() {
2732
2741
  if (!this._allMessages) {
@@ -2786,7 +2795,7 @@ else if (isStructure(def) || isInterface(def) || isPrimitive(def)) def = def.pro
2786
2795
  }
2787
2796
  if (isPrimitive(def) && def.config.isContainer) this._allMessages.push({
2788
2797
  severity: 1,
2789
- message: `"${t.parentNode.id}${t.parentNode.hasChain ? "." + t.parentNode.chain.map((c) => c.text).join(".") : ""}" is a container type — use one of its extensions`,
2798
+ message: `"${t.parentNode.id}${t.parentNode.hasChain ? `.${t.parentNode.chain.map((c) => c.text).join(".")}` : ""}" is a container type — use one of its extensions`,
2790
2799
  range: t.range
2791
2800
  });
2792
2801
  if (t.parentNode.hasChain) {
@@ -2953,7 +2962,7 @@ else if (isStructure(def) || isInterface(def) || isPrimitive(def)) def = def.pro
2953
2962
  }
2954
2963
  for (const a of left || []) {
2955
2964
  const spec = this.resolveAnnotation(a.name);
2956
- let append = spec && spec.config.multiple && spec.config.mergeStrategy === "append";
2965
+ const append = spec && spec.config.multiple && spec.config.mergeStrategy === "append";
2957
2966
  if (append || !savedAnnotations.has(a.name)) annotations$1.push(a);
2958
2967
  }
2959
2968
  return annotations$1;
@@ -3030,6 +3039,181 @@ const zeroRange = {
3030
3039
  }
3031
3040
  };
3032
3041
 
3042
+ //#endregion
3043
+ //#region packages/core/src/defaults/emit-annotations.ts
3044
+ const emitAnnotations = { jsonSchema: new AnnotationSpec({
3045
+ nodeType: ["interface"],
3046
+ description: "Pre-compute and embed JSON Schema at build time for this interface, regardless of the global jsonSchema plugin option."
3047
+ }) };
3048
+
3049
+ //#endregion
3050
+ //#region packages/core/src/defaults/expect-annotations.ts
3051
+ const expectAnnotations = {
3052
+ minLength: new AnnotationSpec({
3053
+ description: "Validates that a string or array has a minimum length.\n\n**Example:**```atscript@expect.minLength 5name: string```",
3054
+ defType: ["array", "string"],
3055
+ argument: [{
3056
+ name: "length",
3057
+ type: "number",
3058
+ description: "The minimum length of the string or array."
3059
+ }, {
3060
+ name: "message",
3061
+ optional: true,
3062
+ type: "string",
3063
+ description: "Optional error message to display if the validation fails."
3064
+ }]
3065
+ }),
3066
+ maxLength: new AnnotationSpec({
3067
+ description: "Validates that a string or array has a maximum length.\n\n**Example:**```atscript@expect.maxLength 5name: string```",
3068
+ defType: ["array", "string"],
3069
+ argument: [{
3070
+ name: "length",
3071
+ type: "number",
3072
+ description: "The maximum length of the string or array."
3073
+ }, {
3074
+ name: "message",
3075
+ optional: true,
3076
+ type: "string",
3077
+ description: "Optional error message to display if the validation fails."
3078
+ }]
3079
+ }),
3080
+ min: new AnnotationSpec({
3081
+ description: "Validates that a number is greater than or equal to a minimum value.\n\n**Example:**```atscript@expect.min 18age: number```",
3082
+ defType: ["number"],
3083
+ argument: [{
3084
+ name: "minValue",
3085
+ type: "number",
3086
+ description: "The minimum value."
3087
+ }, {
3088
+ name: "message",
3089
+ optional: true,
3090
+ type: "string",
3091
+ description: "Optional error message to display if the validation fails."
3092
+ }]
3093
+ }),
3094
+ max: new AnnotationSpec({
3095
+ description: "Validates that a number is less than or equal to a maximum value.\n\n**Example:**```atscript@expect.max 10count: number```",
3096
+ defType: ["number"],
3097
+ argument: [{
3098
+ name: "maxValue",
3099
+ type: "number",
3100
+ description: "The maximum value."
3101
+ }, {
3102
+ name: "message",
3103
+ optional: true,
3104
+ type: "string",
3105
+ description: "Optional error message to display if the validation fails."
3106
+ }]
3107
+ }),
3108
+ int: new AnnotationSpec({
3109
+ description: "Validates that a number is an integer (no decimal places).\n\n**Example:**```atscript@expect.intage: number```",
3110
+ defType: ["number"]
3111
+ }),
3112
+ pattern: new AnnotationSpec({
3113
+ description: "Validates that a string matches a specific pattern.\n\n**Example:**```atscript@expect.pattern \"[a-z]+\", \"u\"name: string```",
3114
+ defType: ["string"],
3115
+ multiple: true,
3116
+ mergeStrategy: "append",
3117
+ argument: [
3118
+ {
3119
+ name: "pattern",
3120
+ type: "string",
3121
+ description: "The regular expression pattern to match."
3122
+ },
3123
+ {
3124
+ name: "flags",
3125
+ optional: true,
3126
+ type: "string",
3127
+ values: [
3128
+ "g",
3129
+ "gi",
3130
+ "gim",
3131
+ "gims",
3132
+ "gimsu",
3133
+ "gimsuy",
3134
+ "gimsy",
3135
+ "gimu",
3136
+ "gimuy",
3137
+ "gimy",
3138
+ "gis",
3139
+ "gisu",
3140
+ "gisuy",
3141
+ "gisy",
3142
+ "giu",
3143
+ "giuy",
3144
+ "giy",
3145
+ "gm",
3146
+ "gms",
3147
+ "gmsu",
3148
+ "gmsuy",
3149
+ "gmsy",
3150
+ "gmu",
3151
+ "gmuy",
3152
+ "gmy",
3153
+ "gs",
3154
+ "gsu",
3155
+ "gsuy",
3156
+ "gsy",
3157
+ "gu",
3158
+ "guy",
3159
+ "gy",
3160
+ "i",
3161
+ "im",
3162
+ "ims",
3163
+ "imsu",
3164
+ "imsuy",
3165
+ "imsy",
3166
+ "imu",
3167
+ "imuy",
3168
+ "imy",
3169
+ "is",
3170
+ "isu",
3171
+ "isuy",
3172
+ "isy",
3173
+ "iu",
3174
+ "iuy",
3175
+ "iy",
3176
+ "m",
3177
+ "ms",
3178
+ "msu",
3179
+ "msuy",
3180
+ "msy",
3181
+ "mu",
3182
+ "muy",
3183
+ "my",
3184
+ "s",
3185
+ "su",
3186
+ "suy",
3187
+ "sy",
3188
+ "u",
3189
+ "uy",
3190
+ "y"
3191
+ ],
3192
+ description: "Optional flags for the regular expression."
3193
+ },
3194
+ {
3195
+ name: "message",
3196
+ optional: true,
3197
+ type: "string",
3198
+ description: "Optional error message to display if the validation fails."
3199
+ }
3200
+ ],
3201
+ validate(mainToken, args) {
3202
+ if (args[0]) try {
3203
+ new RegExp(args[0].text);
3204
+ return [];
3205
+ } catch (error) {
3206
+ return [{
3207
+ message: "Invalid regular expression",
3208
+ range: args[0].range,
3209
+ severity: 1
3210
+ }];
3211
+ }
3212
+ return [];
3213
+ }
3214
+ })
3215
+ };
3216
+
3033
3217
  //#endregion
3034
3218
  //#region packages/core/src/defaults/meta-annotations.ts
3035
3219
  const metaAnnotations = {
@@ -3069,7 +3253,7 @@ const metaAnnotations = {
3069
3253
  }),
3070
3254
  placeholder: new AnnotationSpec({
3071
3255
  description: "Defines a **default placeholder value** for UI input fields.\n\n**Example:**```atscript@meta.placeholder \"Enter your name\"name: string```",
3072
- nodeType: ["prop"],
3256
+ nodeType: ["prop", "type"],
3073
3257
  argument: {
3074
3258
  name: "text",
3075
3259
  type: "string",
@@ -3078,12 +3262,12 @@ const metaAnnotations = {
3078
3262
  }),
3079
3263
  sensitive: new AnnotationSpec({
3080
3264
  description: "Marks a field as **sensitive** (e.g., passwords, API keys), ensuring it is hidden in logs and UI.\n\n**Example:**```atscript@meta.sensitivepassword: string```",
3081
- nodeType: ["prop"],
3265
+ nodeType: ["prop", "type"],
3082
3266
  multiple: false
3083
3267
  }),
3084
3268
  readonly: new AnnotationSpec({
3085
3269
  description: "Marks a field as **read-only**.\n\n**Example:**```atscript@meta.readonlycreatedAt: string.date```",
3086
- nodeType: ["prop"],
3270
+ nodeType: ["prop", "type"],
3087
3271
  multiple: false
3088
3272
  }),
3089
3273
  required: new AnnotationSpec({
@@ -3098,7 +3282,7 @@ const metaAnnotations = {
3098
3282
  }),
3099
3283
  isKey: new AnnotationSpec({
3100
3284
  description: "Marks a **key field** inside an array. This annotation is used to identify unique fields within an array that can be used as **lookup keys**.\n\n\n\n**Example:**\n```atscript\nexport interface User {\n id: string\n profiles: {\n @meta.isKey\n profileId: string\n name: string\n }[]\n}\n```\n",
3101
- nodeType: ["prop"],
3285
+ nodeType: ["prop", "type"],
3102
3286
  multiple: false,
3103
3287
  validate(token, args, doc) {
3104
3288
  const field = token.parentNode;
@@ -3246,181 +3430,6 @@ const primitives = {
3246
3430
  }
3247
3431
  };
3248
3432
 
3249
- //#endregion
3250
- //#region packages/core/src/defaults/expect-annotations.ts
3251
- const expectAnnotations = {
3252
- minLength: new AnnotationSpec({
3253
- description: "Validates that a string or array has a minimum length.\n\n**Example:**```atscript@expect.minLength 5name: string```",
3254
- defType: ["array", "string"],
3255
- argument: [{
3256
- name: "length",
3257
- type: "number",
3258
- description: "The minimum length of the string or array."
3259
- }, {
3260
- name: "message",
3261
- optional: true,
3262
- type: "string",
3263
- description: "Optional error message to display if the validation fails."
3264
- }]
3265
- }),
3266
- maxLength: new AnnotationSpec({
3267
- description: "Validates that a string or array has a maximum length.\n\n**Example:**```atscript@expect.maxLength 5name: string```",
3268
- defType: ["array", "string"],
3269
- argument: [{
3270
- name: "length",
3271
- type: "number",
3272
- description: "The maximum length of the string or array."
3273
- }, {
3274
- name: "message",
3275
- optional: true,
3276
- type: "string",
3277
- description: "Optional error message to display if the validation fails."
3278
- }]
3279
- }),
3280
- min: new AnnotationSpec({
3281
- description: "Validates that a number is greater than or equal to a minimum value.\n\n**Example:**```atscript@expect.min 18age: number```",
3282
- defType: ["number"],
3283
- argument: [{
3284
- name: "minValue",
3285
- type: "number",
3286
- description: "The minimum value."
3287
- }, {
3288
- name: "message",
3289
- optional: true,
3290
- type: "string",
3291
- description: "Optional error message to display if the validation fails."
3292
- }]
3293
- }),
3294
- max: new AnnotationSpec({
3295
- description: "Validates that a number is less than or equal to a maximum value.\n\n**Example:**```atscript@expect.max 10count: number```",
3296
- defType: ["number"],
3297
- argument: [{
3298
- name: "maxValue",
3299
- type: "number",
3300
- description: "The maximum value."
3301
- }, {
3302
- name: "message",
3303
- optional: true,
3304
- type: "string",
3305
- description: "Optional error message to display if the validation fails."
3306
- }]
3307
- }),
3308
- int: new AnnotationSpec({
3309
- description: "Validates that a number is an integer (no decimal places).\n\n**Example:**```atscript@expect.intage: number```",
3310
- defType: ["number"]
3311
- }),
3312
- pattern: new AnnotationSpec({
3313
- description: "Validates that a string matches a specific pattern.\n\n**Example:**```atscript@expect.pattern \"[a-z]+\", \"u\"name: string```",
3314
- defType: ["string"],
3315
- multiple: true,
3316
- mergeStrategy: "append",
3317
- argument: [
3318
- {
3319
- name: "pattern",
3320
- type: "string",
3321
- description: "The regular expression pattern to match."
3322
- },
3323
- {
3324
- name: "flags",
3325
- optional: true,
3326
- type: "string",
3327
- values: [
3328
- "g",
3329
- "gi",
3330
- "gim",
3331
- "gims",
3332
- "gimsu",
3333
- "gimsuy",
3334
- "gimsy",
3335
- "gimu",
3336
- "gimuy",
3337
- "gimy",
3338
- "gis",
3339
- "gisu",
3340
- "gisuy",
3341
- "gisy",
3342
- "giu",
3343
- "giuy",
3344
- "giy",
3345
- "gm",
3346
- "gms",
3347
- "gmsu",
3348
- "gmsuy",
3349
- "gmsy",
3350
- "gmu",
3351
- "gmuy",
3352
- "gmy",
3353
- "gs",
3354
- "gsu",
3355
- "gsuy",
3356
- "gsy",
3357
- "gu",
3358
- "guy",
3359
- "gy",
3360
- "i",
3361
- "im",
3362
- "ims",
3363
- "imsu",
3364
- "imsuy",
3365
- "imsy",
3366
- "imu",
3367
- "imuy",
3368
- "imy",
3369
- "is",
3370
- "isu",
3371
- "isuy",
3372
- "isy",
3373
- "iu",
3374
- "iuy",
3375
- "iy",
3376
- "m",
3377
- "ms",
3378
- "msu",
3379
- "msuy",
3380
- "msy",
3381
- "mu",
3382
- "muy",
3383
- "my",
3384
- "s",
3385
- "su",
3386
- "suy",
3387
- "sy",
3388
- "u",
3389
- "uy",
3390
- "y"
3391
- ],
3392
- description: "Optional flags for the regular expression."
3393
- },
3394
- {
3395
- name: "message",
3396
- optional: true,
3397
- type: "string",
3398
- description: "Optional error message to display if the validation fails."
3399
- }
3400
- ],
3401
- validate(mainToken, args) {
3402
- if (args[0]) try {
3403
- new RegExp(args[0].text);
3404
- return [];
3405
- } catch (e) {
3406
- return [{
3407
- message: "Invalid regular expression",
3408
- range: args[0].range,
3409
- severity: 1
3410
- }];
3411
- }
3412
- return [];
3413
- }
3414
- })
3415
- };
3416
-
3417
- //#endregion
3418
- //#region packages/core/src/defaults/emit-annotations.ts
3419
- const emitAnnotations = { jsonSchema: new AnnotationSpec({
3420
- nodeType: ["interface"],
3421
- description: "Pre-compute and embed JSON Schema at build time for this interface, regardless of the global jsonSchema plugin option."
3422
- }) };
3423
-
3424
3433
  //#endregion
3425
3434
  //#region packages/core/src/default-atscript-config.ts
3426
3435
  function getDefaultAtscriptConfig() {
@@ -3500,8 +3509,8 @@ var PluginManager = class {
3500
3509
  const content = await (0, node_fs_promises.readFile)(filePath, "utf8");
3501
3510
  return content.toString();
3502
3511
  }
3503
- async onDocumnet(doc) {
3504
- for (const plugin of this.plugins) if (plugin.onDocumnet) await plugin.onDocumnet(doc);
3512
+ async onDocument(doc) {
3513
+ for (const plugin of this.plugins) if (plugin.onDocument) await plugin.onDocument(doc);
3505
3514
  }
3506
3515
  async render(doc, format) {
3507
3516
  const files = [];
@@ -3595,8 +3604,8 @@ else types.push({ type: "boolean" });
3595
3604
  for (const { name, token, args } of awaited.annotations) {
3596
3605
  if (annotations$1[name]?.fromSpec) continue;
3597
3606
  if (!annotations$1[name]) {
3598
- let types = [];
3599
- let multiple = false;
3607
+ const types = [];
3608
+ const multiple = false;
3600
3609
  annotations$1[name] = {
3601
3610
  multiple,
3602
3611
  fromSpec: false,
@@ -3698,10 +3707,10 @@ else types.push({ type: "boolean" });
3698
3707
  const newId = await manager.resolve(id);
3699
3708
  if (!newId) throw new Error(`Document not resolved: ${id}`);
3700
3709
  const content = text$2 || await manager.load(newId);
3701
- if (typeof content !== "string") throw new Error(`Document not found: ${newId}`);
3710
+ if (typeof content !== "string") throw new TypeError(`Document not found: ${newId}`);
3702
3711
  const atscript = new AtscriptDoc(id, await manager.getDocConfig(), manager);
3703
3712
  atscript.update(content);
3704
- await manager.onDocumnet(atscript);
3713
+ await manager.onDocument(atscript);
3705
3714
  return atscript;
3706
3715
  }
3707
3716
  async checkDoc(atscript) {
@@ -3773,6 +3782,7 @@ else types.push({ type: "boolean" });
3773
3782
 
3774
3783
  //#endregion
3775
3784
  //#region packages/core/src/plugin/types.ts
3785
+ const DEFAULT_FORMAT = "__default__";
3776
3786
  const createAtscriptPlugin = (plugin) => plugin;
3777
3787
 
3778
3788
  //#endregion
@@ -3804,7 +3814,7 @@ else {
3804
3814
  entries.push(...found);
3805
3815
  }
3806
3816
  const documents = [];
3807
- for (const entry of entries) documents.push(await repo.openDocument("file://" + entry));
3817
+ for (const entry of entries) documents.push(await repo.openDocument(`file://${entry}`));
3808
3818
  return new BuildRepo(rootDir, repo, documents.filter(Boolean));
3809
3819
  }
3810
3820
  var BuildRepo = class {
@@ -3863,6 +3873,7 @@ exports.AnnotationSpec = AnnotationSpec
3863
3873
  exports.AtscriptDoc = AtscriptDoc
3864
3874
  exports.AtscriptRepo = AtscriptRepo
3865
3875
  exports.BuildRepo = BuildRepo
3876
+ exports.DEFAULT_FORMAT = DEFAULT_FORMAT
3866
3877
  exports.PluginManager = PluginManager
3867
3878
  exports.SemanticAnnotateNode = SemanticAnnotateNode
3868
3879
  exports.SemanticArrayNode = SemanticArrayNode