@weborigami/language 0.6.14 → 0.6.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weborigami/language",
3
- "version": "0.6.14",
3
+ "version": "0.6.15",
4
4
  "description": "Web Origami expression language compiler and runtime",
5
5
  "type": "module",
6
6
  "main": "./main.js",
@@ -11,7 +11,7 @@
11
11
  "typescript": "5.9.3"
12
12
  },
13
13
  "dependencies": {
14
- "@weborigami/async-tree": "0.6.14",
14
+ "@weborigami/async-tree": "0.6.15",
15
15
  "exif-parser": "0.1.12",
16
16
  "watcher": "2.3.1",
17
17
  "yaml": "2.8.2"
@@ -1,7 +1,8 @@
1
1
  import { Mixin } from "../../index.ts";
2
2
 
3
3
  declare const WatchFilesMixin: Mixin<{
4
- watch(): Promise<void>;
4
+ unwatch(): void;
5
+ watch(): void;
5
6
  }>;
6
7
 
7
8
  export default WatchFilesMixin;
@@ -27,7 +27,7 @@ export default function WatchFilesMixin(Base) {
27
27
  this.dispatchEvent(new TreeEvent("change", { filePath }));
28
28
  }
29
29
 
30
- async unwatch() {
30
+ unwatch() {
31
31
  if (!this.watching) {
32
32
  return;
33
33
  }
@@ -37,7 +37,7 @@ export default function WatchFilesMixin(Base) {
37
37
  }
38
38
 
39
39
  // Turn on watching for the directory.
40
- async watch() {
40
+ watch() {
41
41
  if (this.watching) {
42
42
  return;
43
43
  }
@@ -27,8 +27,9 @@ export default async function explainTraverseError(error) {
27
27
  }
28
28
 
29
29
  // The key that caused the error is the one before the current position
30
- const path = pathFromKeys(keys.slice(0, position));
31
- let message = `The path traversal ended unexpectedly at: ${path}`;
30
+ const path = pathFromKeys(keys);
31
+ const problemKey = keys[position - 1];
32
+ let message = `Tried to traverse path: ${path}\nStopped unexpectedly at: ${problemKey}`;
32
33
 
33
34
  const key = trailingSlash.remove(keys[position - 1]);
34
35
 
@@ -210,7 +210,8 @@ evaluating: \x1B[31mrepeat\x1B[0m`,
210
210
  await assertError(
211
211
  `a/b/sup/c`,
212
212
  `TraverseError: A path hit a null or undefined value.
213
- The path traversal ended unexpectedly at: a/b/sup/
213
+ Tried to traverse path: a/b/sup/c
214
+ Stopped unexpectedly at: sup/
214
215
  Perhaps you intended: sub/
215
216
  evaluating: \x1B[31msup/\x1B[0m`,
216
217
  { parent },
@@ -224,7 +225,8 @@ evaluating: \x1B[31msup/\x1B[0m`,
224
225
  await assertError(
225
226
  `map/1/a`,
226
227
  `TraverseError: A path hit a null or undefined value.
227
- The path traversal ended unexpectedly at: map/1/
228
+ Tried to traverse path: map/1/a
229
+ Stopped unexpectedly at: 1/
228
230
  Slash-separated keys are searched as strings. Here there's no string "1" key, but there is a number 1 key.
229
231
  To get the value for that number key, use parentheses: map/(1)
230
232
  evaluating: \x1B[31m1/\x1B[0m`,
@@ -239,7 +241,8 @@ evaluating: \x1B[31m1/\x1B[0m`,
239
241
  await assertError(
240
242
  `file.foo/bar`,
241
243
  `TraverseError: A path hit binary file data that can't be unpacked.
242
- The path traversal ended unexpectedly at: file.foo/
244
+ Tried to traverse path: file.foo/bar
245
+ Stopped unexpectedly at: file.foo/
243
246
  The value couldn't be unpacked because no file extension handler is registered for ".foo".
244
247
  evaluating: \x1B[31mfile.foo/\x1B[0m`,
245
248
  { parent },
@@ -255,7 +258,8 @@ evaluating: \x1B[31mfile.foo/\x1B[0m`,
255
258
  await assertError(
256
259
  `a/b/`,
257
260
  `TraverseError: A path tried to unpack data that's already unpacked.
258
- The path traversal ended unexpectedly at: a/b/
261
+ Tried to traverse path: a/b/
262
+ Stopped unexpectedly at: b/
259
263
  You can drop the trailing slash and just use: b
260
264
  evaluating: \x1B[31mb/\x1B[0m`,
261
265
  { parent },
@@ -269,7 +273,8 @@ evaluating: \x1B[31mb/\x1B[0m`,
269
273
  await assertError(
270
274
  `a/b/`,
271
275
  `TraverseError: A path tried to unpack a value that doesn't exist.
272
- The path traversal ended unexpectedly at: a/b/
276
+ Tried to traverse path: a/b/
277
+ Stopped unexpectedly at: b/
273
278
  evaluating: \x1B[31mb/\x1B[0m`,
274
279
  { parent },
275
280
  );