@wcstack/typescript 4.1.0 → 4.1.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 +33 -5
- package/dist/wcs-schema.mjs +1 -1
- package/dist/wcs-tsc.mjs +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
package/dist/schema-core.cjs
CHANGED
|
@@ -10914,6 +10914,35 @@ function propertyKeyIs(property, name) {
|
|
|
10914
10914
|
if (!property.computed && key.type === "Identifier") return key.name === name;
|
|
10915
10915
|
return key.type === "Literal" && key.value === name;
|
|
10916
10916
|
}
|
|
10917
|
+
function findOwnThis(text3, kind) {
|
|
10918
|
+
let program;
|
|
10919
|
+
const prefix = kind === "body" ? PREFIX : VALUE_PREFIX;
|
|
10920
|
+
try {
|
|
10921
|
+
program = parse3(prefix + text3 + (kind === "body" ? SUFFIX : VALUE_SUFFIX), { ecmaVersion: "latest", sourceType: "module" });
|
|
10922
|
+
} catch {
|
|
10923
|
+
return null;
|
|
10924
|
+
}
|
|
10925
|
+
const wrapper = unwrapWrapper(program);
|
|
10926
|
+
if (wrapper === null) return null;
|
|
10927
|
+
let root = wrapper.body;
|
|
10928
|
+
if (kind === "value") {
|
|
10929
|
+
const statement = wrapper.body.body.length === 1 ? wrapper.body.body[0] : null;
|
|
10930
|
+
if (statement === null || statement.type !== "ExpressionStatement" || statement.expression.type !== "FunctionExpression") return null;
|
|
10931
|
+
root = statement.expression.body;
|
|
10932
|
+
}
|
|
10933
|
+
let found = null;
|
|
10934
|
+
const walk = (node) => {
|
|
10935
|
+
if (found !== null || isClassNode(node)) return;
|
|
10936
|
+
if (isFunctionNode(node) && node.type !== "ArrowFunctionExpression") return;
|
|
10937
|
+
if (node.type === "ThisExpression") {
|
|
10938
|
+
found = { start: node.start - prefix.length, end: node.end - prefix.length };
|
|
10939
|
+
return;
|
|
10940
|
+
}
|
|
10941
|
+
forEachChild(node, walk);
|
|
10942
|
+
};
|
|
10943
|
+
forEachChild(root, walk);
|
|
10944
|
+
return found;
|
|
10945
|
+
}
|
|
10917
10946
|
|
|
10918
10947
|
// src/core/messages.ts
|
|
10919
10948
|
function resolveLocale(locale2) {
|
|
@@ -13544,7 +13573,8 @@ var BUILTIN_TAGS = {
|
|
|
13544
13573
|
"downlink",
|
|
13545
13574
|
"rtt",
|
|
13546
13575
|
"saveData",
|
|
13547
|
-
"supported"
|
|
13576
|
+
"supported",
|
|
13577
|
+
"offline"
|
|
13548
13578
|
],
|
|
13549
13579
|
"commands": []
|
|
13550
13580
|
},
|
|
@@ -16153,14 +16183,12 @@ function hasOutOfRangeIndexName(script) {
|
|
|
16153
16183
|
}
|
|
16154
16184
|
return false;
|
|
16155
16185
|
}
|
|
16156
|
-
var ANY_MEMBER = { has: () => true };
|
|
16157
16186
|
function validateOnHandlerThis(script, scriptStart, locale2) {
|
|
16158
16187
|
const msgs = getMessages(locale2);
|
|
16159
16188
|
const out = [];
|
|
16160
16189
|
for (const handler of analyzeOnHandlerSources(script)) {
|
|
16161
|
-
const
|
|
16162
|
-
|
|
16163
|
-
if (first === void 0) continue;
|
|
16190
|
+
const first = findOwnThis(handler.text, handler.kind);
|
|
16191
|
+
if (first === null) continue;
|
|
16164
16192
|
out.push({
|
|
16165
16193
|
code: WcsDiagnosticCode.OnHandlerThis,
|
|
16166
16194
|
start: scriptStart + handler.start + first.start,
|
package/dist/wcs-schema.mjs
CHANGED
package/dist/wcs-tsc.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wcstack/typescript",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.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",
|