@atscript/core 0.1.12 → 0.1.14
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 +21 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +21 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -443,6 +443,11 @@ var SemanticPrimitiveNode = class SemanticPrimitiveNode extends SemanticNode {
|
|
|
443
443
|
});
|
|
444
444
|
}
|
|
445
445
|
if (this.type === "string") {
|
|
446
|
+
if (this.config.expect?.filled === true) this.annotations.push({
|
|
447
|
+
name: "expect.filled",
|
|
448
|
+
token: dummyToken,
|
|
449
|
+
args: []
|
|
450
|
+
});
|
|
446
451
|
if (typeof this.config.expect?.pattern !== "undefined") {
|
|
447
452
|
const patterns = Array.isArray(this.config.expect.pattern) ? this.config.expect.pattern : [this.config.expect.pattern];
|
|
448
453
|
for (const p of patterns) {
|
|
@@ -967,13 +972,13 @@ async function bundleTsConfig(configFile, forceFormat) {
|
|
|
967
972
|
input: configFile,
|
|
968
973
|
platform: "node",
|
|
969
974
|
resolve: { mainFields: ["main"] },
|
|
970
|
-
define: {
|
|
975
|
+
transform: { define: {
|
|
971
976
|
"__dirname": dirnameVarName,
|
|
972
977
|
"__filename": filenameVarName,
|
|
973
978
|
"import.meta.url": importMetaUrlVarName,
|
|
974
979
|
"import.meta.dirname": dirnameVarName,
|
|
975
980
|
"import.meta.filename": filenameVarName
|
|
976
|
-
},
|
|
981
|
+
} },
|
|
977
982
|
treeshake: false,
|
|
978
983
|
external: [/^[\w@][^:]/u],
|
|
979
984
|
plugins: [{
|
|
@@ -3162,6 +3167,10 @@ const primitives = {
|
|
|
3162
3167
|
pattern: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
|
|
3163
3168
|
message: "Invalid UUID format."
|
|
3164
3169
|
}
|
|
3170
|
+
},
|
|
3171
|
+
filled: {
|
|
3172
|
+
documentation: "Non-empty string that contains at least one non-whitespace character.",
|
|
3173
|
+
expect: { filled: true }
|
|
3165
3174
|
}
|
|
3166
3175
|
}
|
|
3167
3176
|
},
|
|
@@ -3278,6 +3287,16 @@ const expectAnnotations = {
|
|
|
3278
3287
|
description: "Validates that a number is an integer (no decimal places).\n\n**Example:**```atscript@expect.intage: number```",
|
|
3279
3288
|
defType: ["number"]
|
|
3280
3289
|
}),
|
|
3290
|
+
filled: new AnnotationSpec({
|
|
3291
|
+
description: "Validates that a string is not empty and contains at least one non-whitespace character.\n\n**Example:**```atscript@expect.filledname: string```",
|
|
3292
|
+
defType: ["string"],
|
|
3293
|
+
argument: [{
|
|
3294
|
+
name: "message",
|
|
3295
|
+
optional: true,
|
|
3296
|
+
type: "string",
|
|
3297
|
+
description: "Optional error message to display if the validation fails."
|
|
3298
|
+
}]
|
|
3299
|
+
}),
|
|
3281
3300
|
pattern: new AnnotationSpec({
|
|
3282
3301
|
description: "Validates that a string matches a specific pattern.\n\n**Example:**```atscript@expect.pattern \"[a-z]+\", \"u\"name: string```",
|
|
3283
3302
|
defType: ["string"],
|
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -419,6 +419,11 @@ var SemanticPrimitiveNode = class SemanticPrimitiveNode extends SemanticNode {
|
|
|
419
419
|
});
|
|
420
420
|
}
|
|
421
421
|
if (this.type === "string") {
|
|
422
|
+
if (this.config.expect?.filled === true) this.annotations.push({
|
|
423
|
+
name: "expect.filled",
|
|
424
|
+
token: dummyToken,
|
|
425
|
+
args: []
|
|
426
|
+
});
|
|
422
427
|
if (typeof this.config.expect?.pattern !== "undefined") {
|
|
423
428
|
const patterns = Array.isArray(this.config.expect.pattern) ? this.config.expect.pattern : [this.config.expect.pattern];
|
|
424
429
|
for (const p of patterns) {
|
|
@@ -943,13 +948,13 @@ async function bundleTsConfig(configFile, forceFormat) {
|
|
|
943
948
|
input: configFile,
|
|
944
949
|
platform: "node",
|
|
945
950
|
resolve: { mainFields: ["main"] },
|
|
946
|
-
define: {
|
|
951
|
+
transform: { define: {
|
|
947
952
|
"__dirname": dirnameVarName,
|
|
948
953
|
"__filename": filenameVarName,
|
|
949
954
|
"import.meta.url": importMetaUrlVarName,
|
|
950
955
|
"import.meta.dirname": dirnameVarName,
|
|
951
956
|
"import.meta.filename": filenameVarName
|
|
952
|
-
},
|
|
957
|
+
} },
|
|
953
958
|
treeshake: false,
|
|
954
959
|
external: [/^[\w@][^:]/u],
|
|
955
960
|
plugins: [{
|
|
@@ -3138,6 +3143,10 @@ const primitives = {
|
|
|
3138
3143
|
pattern: /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,
|
|
3139
3144
|
message: "Invalid UUID format."
|
|
3140
3145
|
}
|
|
3146
|
+
},
|
|
3147
|
+
filled: {
|
|
3148
|
+
documentation: "Non-empty string that contains at least one non-whitespace character.",
|
|
3149
|
+
expect: { filled: true }
|
|
3141
3150
|
}
|
|
3142
3151
|
}
|
|
3143
3152
|
},
|
|
@@ -3254,6 +3263,16 @@ const expectAnnotations = {
|
|
|
3254
3263
|
description: "Validates that a number is an integer (no decimal places).\n\n**Example:**```atscript@expect.intage: number```",
|
|
3255
3264
|
defType: ["number"]
|
|
3256
3265
|
}),
|
|
3266
|
+
filled: new AnnotationSpec({
|
|
3267
|
+
description: "Validates that a string is not empty and contains at least one non-whitespace character.\n\n**Example:**```atscript@expect.filledname: string```",
|
|
3268
|
+
defType: ["string"],
|
|
3269
|
+
argument: [{
|
|
3270
|
+
name: "message",
|
|
3271
|
+
optional: true,
|
|
3272
|
+
type: "string",
|
|
3273
|
+
description: "Optional error message to display if the validation fails."
|
|
3274
|
+
}]
|
|
3275
|
+
}),
|
|
3257
3276
|
pattern: new AnnotationSpec({
|
|
3258
3277
|
description: "Validates that a string matches a specific pattern.\n\n**Example:**```atscript@expect.pattern \"[a-z]+\", \"u\"name: string```",
|
|
3259
3278
|
defType: ["string"],
|