@wcstack/typescript 4.9.0 → 4.10.1
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.esm.js +1 -1
- package/dist/schema-core.cjs +7795 -7157
- package/dist/tsc-core.cjs +33 -32
- package/dist/wcs-schema.mjs +1 -1
- package/dist/wcs-tsc.mjs +1 -1
- package/package.json +1 -1
package/dist/tsc-core.cjs
CHANGED
|
@@ -5786,6 +5786,7 @@ function closingParenEnd(code, bodyStart) {
|
|
|
5786
5786
|
function asciiLowerCase(text2) {
|
|
5787
5787
|
return text2.replace(/[A-Z]+/g, (upper2) => upper2.toLowerCase());
|
|
5788
5788
|
}
|
|
5789
|
+
var MODULE_PATH_ATTRIBUTE = "wcs-lint-src";
|
|
5789
5790
|
function parseWcsScriptBlocks(html, stateTagName = "wcs-state") {
|
|
5790
5791
|
return parseWcsStateElements(html, stateTagName).flatMap((element) => element.scriptBlocks);
|
|
5791
5792
|
}
|
|
@@ -5874,12 +5875,14 @@ function parseWcsStateElements(html, stateTagName = "wcs-state") {
|
|
|
5874
5875
|
const typeAttr = extractAttribute(inner.open.tagContent, "type");
|
|
5875
5876
|
if (typeAttr?.toLowerCase() === "module" && inner.closed) {
|
|
5876
5877
|
const contentStart = inner.open.end;
|
|
5878
|
+
const modulePath = extractAttribute(inner.open.tagContent, MODULE_PATH_ATTRIBUTE);
|
|
5877
5879
|
scriptBlocks.push({
|
|
5878
5880
|
contentStart,
|
|
5879
5881
|
contentEnd: inner.contentEnd,
|
|
5880
5882
|
content: html.slice(contentStart, inner.contentEnd),
|
|
5881
5883
|
mountPath,
|
|
5882
|
-
bindComponent
|
|
5884
|
+
bindComponent,
|
|
5885
|
+
...modulePath !== null ? { modulePath } : {}
|
|
5883
5886
|
});
|
|
5884
5887
|
}
|
|
5885
5888
|
}
|
|
@@ -6231,12 +6234,6 @@ var upper = () => (value) => String(value).toUpperCase();
|
|
|
6231
6234
|
var lower = () => (value) => String(value).toLowerCase();
|
|
6232
6235
|
var capitalize = () => (value) => {
|
|
6233
6236
|
const v = String(value);
|
|
6234
|
-
if (v.length === 0) {
|
|
6235
|
-
return v;
|
|
6236
|
-
}
|
|
6237
|
-
if (v.length === 1) {
|
|
6238
|
-
return v.toUpperCase();
|
|
6239
|
-
}
|
|
6240
6237
|
return v.charAt(0).toUpperCase() + v.slice(1);
|
|
6241
6238
|
};
|
|
6242
6239
|
var trim = () => (value) => String(value).trim();
|
|
@@ -6285,14 +6282,20 @@ var join = (options) => {
|
|
|
6285
6282
|
};
|
|
6286
6283
|
var STYLES = ["full", "long", "medium", "short"];
|
|
6287
6284
|
function dateOptions(options, fn) {
|
|
6288
|
-
let [loc, style] = options ?? [];
|
|
6289
|
-
if (style
|
|
6290
|
-
if (style
|
|
6291
|
-
|
|
6285
|
+
let [loc, style, zone] = (options ?? []).map((option) => option || void 0);
|
|
6286
|
+
if (!style && STYLES.includes(loc)) [loc, style] = [void 0, loc];
|
|
6287
|
+
else if (!style && !zone && /\/|^UTC$/.test(loc)) [loc, zone] = [void 0, loc];
|
|
6288
|
+
if (style && !STYLES.includes(style)) styleInvalid(fn, style);
|
|
6289
|
+
try {
|
|
6290
|
+
if (zone) new Intl.DateTimeFormat(void 0, { timeZone: zone });
|
|
6291
|
+
} catch {
|
|
6292
|
+
raise2(54, [fn, zone]);
|
|
6293
|
+
}
|
|
6294
|
+
return [loc, style, zone];
|
|
6292
6295
|
}
|
|
6293
6296
|
var date = (options) => {
|
|
6294
|
-
const [explicit, style] = dateOptions(options, "date");
|
|
6295
|
-
const format = style && { dateStyle: style };
|
|
6297
|
+
const [explicit, style, timeZone] = dateOptions(options, "date");
|
|
6298
|
+
const format = (style || timeZone) && { dateStyle: style, timeZone };
|
|
6296
6299
|
return (value) => {
|
|
6297
6300
|
if (!(value instanceof Date)) {
|
|
6298
6301
|
valueMustBeDate("date", value);
|
|
@@ -6301,8 +6304,8 @@ var date = (options) => {
|
|
|
6301
6304
|
};
|
|
6302
6305
|
};
|
|
6303
6306
|
var time = (options) => {
|
|
6304
|
-
const [explicit, style] = dateOptions(options, "time");
|
|
6305
|
-
const format = style && { timeStyle: style };
|
|
6307
|
+
const [explicit, style, timeZone] = dateOptions(options, "time");
|
|
6308
|
+
const format = (style || timeZone) && { timeStyle: style, timeZone };
|
|
6306
6309
|
return (value) => {
|
|
6307
6310
|
if (!(value instanceof Date)) {
|
|
6308
6311
|
valueMustBeDate("time", value);
|
|
@@ -6311,8 +6314,8 @@ var time = (options) => {
|
|
|
6311
6314
|
};
|
|
6312
6315
|
};
|
|
6313
6316
|
var datetime = (options) => {
|
|
6314
|
-
const [explicit, style] = dateOptions(options, "datetime");
|
|
6315
|
-
const format = style && { dateStyle: style, timeStyle: style };
|
|
6317
|
+
const [explicit, style, timeZone] = dateOptions(options, "datetime");
|
|
6318
|
+
const format = (style || timeZone) && { dateStyle: style, timeStyle: style, timeZone };
|
|
6316
6319
|
return (value) => {
|
|
6317
6320
|
if (!(value instanceof Date)) {
|
|
6318
6321
|
valueMustBeDate("datetime", value);
|
|
@@ -6320,16 +6323,14 @@ var datetime = (options) => {
|
|
|
6320
6323
|
return value.toLocaleString(explicit ?? defaultLocale(), format);
|
|
6321
6324
|
};
|
|
6322
6325
|
};
|
|
6326
|
+
var two = (n) => String(n).padStart(2, "0");
|
|
6323
6327
|
var ymd = (options) => {
|
|
6324
6328
|
const opt = options?.[0] ?? "-";
|
|
6325
6329
|
return (value) => {
|
|
6326
6330
|
if (!(value instanceof Date)) {
|
|
6327
6331
|
valueMustBeDate("ymd", value);
|
|
6328
6332
|
}
|
|
6329
|
-
|
|
6330
|
-
const month = (value.getMonth() + 1).toString().padStart(2, "0");
|
|
6331
|
-
const day = value.getDate().toString().padStart(2, "0");
|
|
6332
|
-
return `${year}${opt}${month}${opt}${day}`;
|
|
6333
|
+
return `${value.getFullYear()}${opt}${two(value.getMonth() + 1)}${opt}${two(value.getDate())}`;
|
|
6333
6334
|
};
|
|
6334
6335
|
};
|
|
6335
6336
|
var hms = (options) => {
|
|
@@ -6338,10 +6339,7 @@ var hms = (options) => {
|
|
|
6338
6339
|
if (!(value instanceof Date)) {
|
|
6339
6340
|
valueMustBeDate("hms", value);
|
|
6340
6341
|
}
|
|
6341
|
-
|
|
6342
|
-
const minutes = value.getMinutes().toString().padStart(2, "0");
|
|
6343
|
-
const seconds = value.getSeconds().toString().padStart(2, "0");
|
|
6344
|
-
return `${hours}${opt}${minutes}${opt}${seconds}`;
|
|
6342
|
+
return `${two(value.getHours())}${opt}${two(value.getMinutes())}${opt}${two(value.getSeconds())}`;
|
|
6345
6343
|
};
|
|
6346
6344
|
};
|
|
6347
6345
|
var abs = () => (value) => {
|
|
@@ -6402,10 +6400,11 @@ var registered = {
|
|
|
6402
6400
|
ceil: { factory: ceil, arity: [0, 1] },
|
|
6403
6401
|
percent: { factory: percent, arity: [0, 1] },
|
|
6404
6402
|
unit: { factory: nullishPassthrough(unit), arity: [1, 1] },
|
|
6405
|
-
// The locale-dependent three take a locale like `locale` does (`date(ja-JP)`),
|
|
6406
|
-
|
|
6407
|
-
|
|
6408
|
-
|
|
6403
|
+
// The locale-dependent three take a locale like `locale` does (`date(ja-JP)`), a style (`date(ja-JP,long)`)
|
|
6404
|
+
// and, since 4.10, a time zone (`date(ja-JP,long,Asia/Tokyo)`)
|
|
6405
|
+
date: { factory: nullishPassthrough(date), arity: [0, 3] },
|
|
6406
|
+
time: { factory: nullishPassthrough(time), arity: [0, 3] },
|
|
6407
|
+
datetime: { factory: nullishPassthrough(datetime), arity: [0, 3] },
|
|
6409
6408
|
ymd: { factory: nullishPassthrough(ymd), arity: [0, 1] },
|
|
6410
6409
|
hms: { factory: nullishPassthrough(hms), arity: [0, 1] },
|
|
6411
6410
|
// the core set of 4.0.0-rc.3 (the core's own: eq ne not lt le gt ge falsy truthy boolean)
|
|
@@ -6508,9 +6507,11 @@ var builtinFilterMeta = {
|
|
|
6508
6507
|
// `locale` と同じくロケールを 1 つ受ける(`date(ja-JP)`)。実装は最初からこれを読んでいたが、
|
|
6509
6508
|
// メタデータ側が maxArgs: 0 だったため lint と補完が正しい書き方を誤りとして報告していた。
|
|
6510
6509
|
// 4.2: 2 つ目は書式(full / long / medium / short — Intl の dateStyle / timeStyle)。書式だけなら既定のロケール
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6510
|
+
// 4.10: 3 つ目は IANA のタイムゾーン(Intl の timeZone)。無ければ実行環境のゾーン(読み手の、SSR ではサーバーの)。
|
|
6511
|
+
// 空の引数は既定のまま(`date(,,Asia/Tokyo)`)
|
|
6512
|
+
date: { description: "\u30ED\u30B1\u30FC\u30EB\u5F62\u5F0F\u306E\u65E5\u4ED8 ([locale][, style][, zone]\u3002style \u306F full / long / medium / short\u3001zone \u306F IANA \u306E\u30BF\u30A4\u30E0\u30BE\u30FC\u30F3\uFF08Asia/Tokyo \u2014 \u7121\u3051\u308C\u3070\u8AAD\u307F\u624B\u306E\u30BE\u30FC\u30F3\uFF09\u3001\u7A7A\u306E\u5F15\u6570\u306F\u65E2\u5B9A\u3001\u65E2\u5B9A\u306E\u30ED\u30B1\u30FC\u30EB\u306F config.locale)", hasArgs: true, resultType: "string", acceptTypes: "any", minArgs: 0, maxArgs: 3, argTypes: ["string", "string", "string"] },
|
|
6513
|
+
time: { description: "\u30ED\u30B1\u30FC\u30EB\u5F62\u5F0F\u306E\u6642\u523B ([locale][, style][, zone]\u3002style \u306F full / long / medium / short\u3001zone \u306F IANA \u306E\u30BF\u30A4\u30E0\u30BE\u30FC\u30F3\uFF08Asia/Tokyo \u2014 \u7121\u3051\u308C\u3070\u8AAD\u307F\u624B\u306E\u30BE\u30FC\u30F3\uFF09\u3001\u7A7A\u306E\u5F15\u6570\u306F\u65E2\u5B9A\u3001\u65E2\u5B9A\u306E\u30ED\u30B1\u30FC\u30EB\u306F config.locale)", hasArgs: true, resultType: "string", acceptTypes: "any", minArgs: 0, maxArgs: 3, argTypes: ["string", "string", "string"] },
|
|
6514
|
+
datetime: { description: "\u30ED\u30B1\u30FC\u30EB\u5F62\u5F0F\u306E\u65E5\u6642 ([locale][, style][, zone]\u3002style \u306F full / long / medium / short\u3001zone \u306F IANA \u306E\u30BF\u30A4\u30E0\u30BE\u30FC\u30F3\uFF08Asia/Tokyo \u2014 \u7121\u3051\u308C\u3070\u8AAD\u307F\u624B\u306E\u30BE\u30FC\u30F3\uFF09\u3001\u7A7A\u306E\u5F15\u6570\u306F\u65E2\u5B9A\u3001\u65E2\u5B9A\u306E\u30ED\u30B1\u30FC\u30EB\u306F config.locale)", hasArgs: true, resultType: "string", acceptTypes: "any", minArgs: 0, maxArgs: 3, argTypes: ["string", "string", "string"] },
|
|
6514
6515
|
ymd: { description: "YYYY-MM-DD \u5F62\u5F0F ([separator]\u3002\u65E2\u5B9A\u306F -)", hasArgs: true, resultType: "string", acceptTypes: "any", minArgs: 0, maxArgs: 1, argTypes: ["string"] },
|
|
6515
6516
|
hms: { description: "HH:MM:SS \u5F62\u5F0F ([separator]\u3002\u65E2\u5B9A\u306F :)", hasArgs: true, resultType: "string", acceptTypes: "any", minArgs: 0, maxArgs: 1, argTypes: ["string"] },
|
|
6516
6517
|
// 真偽値・変換
|
package/dist/wcs-schema.mjs
CHANGED
package/dist/wcs-tsc.mjs
CHANGED
|
@@ -25,7 +25,7 @@ function unsupportedTypeScriptMessage(version) {
|
|
|
25
25
|
return `@wcstack/typescript runs on TypeScript 5 or 6, and the project has TypeScript ${version}, which has no JavaScript compiler API: npm i -D typescript@6`;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
var version = "4.
|
|
28
|
+
var version = "4.10.1";
|
|
29
29
|
var pkg = {
|
|
30
30
|
version: version};
|
|
31
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wcstack/typescript",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.1",
|
|
4
4
|
"description": "TypeScript tooling for wcstack apps: wcs-schema generates the sidecar stateSchema from a typed state file, so wcs-validate checks data-wcs paths against real types in CI and every editor.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.esm.js",
|