generaltranslation 8.1.16 → 8.1.18
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/CHANGELOG.md +12 -0
- package/dist/{static → derive}/declareVar.d.ts +8 -4
- package/dist/derive/derive.d.ts +38 -0
- package/dist/{static → derive}/index.d.ts +1 -1
- package/dist/index.cjs.min.cjs +1 -1
- package/dist/index.cjs.min.cjs.map +1 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.esm.min.mjs +1 -1
- package/dist/index.esm.min.mjs.map +1 -1
- package/dist/internal.cjs.min.cjs +1 -1
- package/dist/internal.cjs.min.cjs.map +1 -1
- package/dist/internal.d.ts +33 -9
- package/dist/internal.esm.min.mjs +1 -1
- package/dist/internal.esm.min.mjs.map +1 -1
- package/dist/translate/enqueueFiles.d.ts +0 -1
- package/dist/translate/publishFiles.d.ts +15 -0
- package/dist/types-dir/api/enqueueFiles.d.ts +0 -2
- package/dist/types.d.ts +17 -3
- package/package.json +1 -1
- package/dist/static/declareStatic.d.ts +0 -18
- /package/dist/{static → derive}/condenseVars.d.ts +0 -0
- /package/dist/{static → derive}/decodeVars.d.ts +0 -0
- /package/dist/{static → derive}/extractVars.d.ts +0 -0
- /package/dist/{static → derive}/indexVars.d.ts +0 -0
- /package/dist/{static → derive}/utils/constants.d.ts +0 -0
- /package/dist/{static → derive}/utils/regex.d.ts +0 -0
- /package/dist/{static → derive}/utils/sanitizeVar.d.ts +0 -0
- /package/dist/{static → derive}/utils/traverseHelpers.d.ts +0 -0
- /package/dist/{static → derive}/utils/traverseIcu.d.ts +0 -0
- /package/dist/{static → derive}/utils/types.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# generaltranslation
|
|
2
2
|
|
|
3
|
+
## 8.1.18
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1122](https://github.com/generaltranslation/gt/pull/1122) [`6d516a7`](https://github.com/generaltranslation/gt/commit/6d516a784f1192f7758689fcf4557e8a19de740a) Thanks [@fernando-aviles](https://github.com/fernando-aviles)! - Adding CDN publishing for all file types
|
|
8
|
+
|
|
9
|
+
## 8.1.17
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#1062](https://github.com/generaltranslation/gt/pull/1062) [`2274e23`](https://github.com/generaltranslation/gt/commit/2274e23d448c8a96d661d30e5c7fc737814c1fb0) Thanks [@ErnestM1234](https://github.com/ErnestM1234)! - refactor: rename static to derive, and deprecate static
|
|
14
|
+
|
|
3
15
|
## 8.1.16
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Mark as a non-translatable string. Use within a
|
|
2
|
+
* Mark as a non-translatable string. Use within a derive() call to mark content as not derivable (e.g., not possible to statically analyze).
|
|
3
3
|
*
|
|
4
4
|
* @example
|
|
5
|
-
* function
|
|
5
|
+
* function nonDerivableFunction() {
|
|
6
|
+
* return Math.random();
|
|
7
|
+
* }
|
|
8
|
+
*
|
|
9
|
+
* function derivableFunction() {
|
|
6
10
|
* if (condition) {
|
|
7
|
-
* return declareVar(
|
|
11
|
+
* return declareVar(nonDerivableFunction())
|
|
8
12
|
* }
|
|
9
13
|
* return 'John Doe';
|
|
10
14
|
* }
|
|
11
15
|
*
|
|
12
16
|
* const gt = useGT();
|
|
13
|
-
* gt(`My name is ${
|
|
17
|
+
* gt(`My name is ${derive(derivableFunction())}`);
|
|
14
18
|
*
|
|
15
19
|
* @param {string | number | boolean | null | undefined} variable - The variable to sanitize.
|
|
16
20
|
* @param {Object} [options] - The options for the sanitization.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* derive() is a powerful but dangerous function which marks its argument as derivable (statically analyzable) for the compiler and CLI tool.
|
|
3
|
+
*
|
|
4
|
+
* This function is dangerous because it can cause the compiler and CLI tool to throw an error if the argument is not derivable.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```jsx
|
|
8
|
+
* function getSubject() {
|
|
9
|
+
* return (Math.random() > 0.5) ? "Alice" : "Brian";
|
|
10
|
+
* }
|
|
11
|
+
* ...
|
|
12
|
+
* gt(`My name is ${derive(getSubject())}`);
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param {T extends string | boolean | number | null | undefined} content - Content to mark as derivable.
|
|
16
|
+
* @returns content
|
|
17
|
+
*/
|
|
18
|
+
export declare function derive<T extends string | boolean | number | null | undefined>(content: T): T;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use derive() instead.
|
|
21
|
+
*
|
|
22
|
+
* declareStatic() is a powerful but dangerous function which marks its argument as derivable (statically analyzable) for the compiler and CLI tool.
|
|
23
|
+
*
|
|
24
|
+
* This function is dangerous because it can cause the compiler and CLI tool to throw an error if the argument is not derivable.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```jsx
|
|
28
|
+
* function getSubject() {
|
|
29
|
+
* return (Math.random() > 0.5) ? "Alice" : "Brian";
|
|
30
|
+
* }
|
|
31
|
+
* ...
|
|
32
|
+
* gt(`My name is ${declareStatic(getSubject())}`);
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @param {T extends string | boolean | number | null | undefined} content - Content to mark as derivable.
|
|
36
|
+
* @returns content
|
|
37
|
+
*/
|
|
38
|
+
export declare const declareStatic: typeof derive;
|