iterable-string-interceptor 2.3.1 → 3.0.0

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/README.md CHANGED
@@ -69,7 +69,7 @@ Type: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Sta
69
69
  * `leadIn` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** expression entry sequence
70
70
  * `leadOut` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** expression exit sequence
71
71
 
72
- Returns **AsyncIterator<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** transformed source
72
+ Returns **AsyncIterable<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** transformed source
73
73
 
74
74
  ## EarlyConsumerCallback
75
75
 
@@ -93,7 +93,7 @@ and asking a transformer for a replacement iterable string.
93
93
  * `leadIn` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** expression entry sequence (optional, default `"{{"`)
94
94
  * `leadOut` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** expression exit sequence (optional, default `"}}"`)
95
95
 
96
- Returns **AsyncIterator<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** transformed source
96
+ Returns **AsyncIterable<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** transformed source
97
97
 
98
98
  # install
99
99
 
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "iterable-string-interceptor",
3
- "version": "2.3.1",
3
+ "version": "3.0.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true
7
7
  },
8
+ "types": "./types/iterable-string-interceptor.d.mts",
8
9
  "exports": {
9
10
  ".": {
10
- "types": "./dist/iterable-string-interceptor.d.mts",
11
- "default": "./src/iterable-string-interceptor.mjs"
11
+ "default": "./src/iterable-string-interceptor.mjs",
12
+ "types": "./types/iterable-string-interceptor.d.mts"
12
13
  }
13
14
  },
14
- "types": "./dist/iterable-string-interceptor.d.mts",
15
15
  "description": "Intercept iterable string - backbone for template engines",
16
16
  "keywords": [
17
17
  "chunk",
@@ -25,26 +25,27 @@
25
25
  ],
26
26
  "license": "BSD-2-Clause",
27
27
  "scripts": {
28
- "prepare": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir dist -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs",
28
+ "prepare": "npm run prepare:typescript",
29
+ "prepare:typescript": "tsc --allowJs --declaration --emitDeclarationOnly --declarationDir types --resolveJsonModule -t esnext -m esnext --module nodenext --moduleResolution nodenext --rootDir src ./src**/*.mjs",
29
30
  "test": "npm run test:browser-ava && npm run test:ava",
30
31
  "test:ava": "ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs",
31
32
  "test:browser-ava": "browser-ava --headless --no-keep-open tests/*-ava.mjs tests/*-ava-browser.mjs",
32
33
  "cover": "c8 -x 'tests/**/*' --temp-directory build/tmp ava --timeout 4m tests/*-ava.mjs tests/*-ava-node.mjs && c8 report -r lcov -o build/coverage --temp-directory build/tmp",
33
34
  "docs": "documentation readme --section=API ./src/**/*.mjs",
34
- "lint": "npm run lint:docs && npm run lint:tsc",
35
+ "lint": "npm run lint:docs && npm run lint:typescript",
35
36
  "lint:docs": "documentation lint ./src/**/*.mjs",
36
- "lint:tsc": "tsc --allowJs --checkJs --noEmit -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
37
+ "lint:typescript": "tsc --allowJs --checkJs --noEmit --resolveJsonModule -t esnext -m esnext --module nodenext --moduleResolution nodenext ./src**/*.mjs"
37
38
  },
38
39
  "devDependencies": {
39
- "ava": "^6.1.1",
40
- "browser-ava": "^2.1.12",
40
+ "ava": "^6.1.2",
41
+ "browser-ava": "^2.2.2",
41
42
  "c8": "^9.1.0",
42
43
  "documentation": "^14.0.3",
43
44
  "semantic-release": "^23.0.2",
44
- "typescript": "^5.3.3"
45
+ "typescript": "^5.4.2"
45
46
  },
46
47
  "engines": {
47
- "node": ">=16.20.2"
48
+ "node": ">=20.11.1"
48
49
  },
49
50
  "repository": {
50
51
  "type": "git",
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @typedef {Function} ExpressionTransformer
2
+ * @typedef {function(string,string,Iterable<string>,EarlyConsumerCallback,string,string):AsyncIterable<string>} ExpressionTransformer
3
3
  * @param {string} expression detected expression without leadIn / leadOut
4
4
  * @param {string} remainder chunk after leadOut
5
5
  * @param {Iterable<string>} source original source
@@ -11,7 +11,7 @@
11
11
 
12
12
  /**
13
13
  * Will be called from the ExpressionTransformer if the given remainder needs to be altered.
14
- * @typedef {Function} EarlyConsumerCallback
14
+ * @typedef {function(string):void} EarlyConsumerCallback
15
15
  * @param {string} remainder new remainder to be used by iterableStringInterceptor
16
16
  */
17
17
 
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @typedef {Function} ExpressionTransformer
2
+ * @typedef {function(string,string,Iterable<string>,EarlyConsumerCallback,string,string):AsyncIterable<string>} ExpressionTransformer
3
3
  * @param {string} expression detected expression without leadIn / leadOut
4
4
  * @param {string} remainder chunk after leadOut
5
5
  * @param {Iterable<string>} source original source
@@ -10,7 +10,7 @@
10
10
  */
11
11
  /**
12
12
  * Will be called from the ExpressionTransformer if the given remainder needs to be altered.
13
- * @typedef {Function} EarlyConsumerCallback
13
+ * @typedef {function(string):void} EarlyConsumerCallback
14
14
  * @param {string} remainder new remainder to be used by iterableStringInterceptor
15
15
  */
16
16
  /**
@@ -23,8 +23,8 @@
23
23
  * @return {AsyncIterable<string>} transformed source
24
24
  */
25
25
  export function iterableStringInterceptor(source: Iterable<string>, transform: ExpressionTransformer, leadIn?: string, leadOut?: string): AsyncIterable<string>;
26
- export type ExpressionTransformer = Function;
26
+ export type ExpressionTransformer = (arg0: string, arg1: string, arg2: Iterable<string>, arg3: EarlyConsumerCallback, arg4: string, arg5: string) => AsyncIterable<string>;
27
27
  /**
28
28
  * Will be called from the ExpressionTransformer if the given remainder needs to be altered.
29
29
  */
30
- export type EarlyConsumerCallback = Function;
30
+ export type EarlyConsumerCallback = (arg0: string) => void;