ilib-tools-common 1.9.0 → 1.10.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 +10 -1
- package/docs/Resource.html +1 -1
- package/docs/Resource.js.html +1 -1
- package/docs/ResourceArray.html +1 -1
- package/docs/ResourceArray.js.html +1 -1
- package/docs/ResourcePlural.html +1 -1
- package/docs/ResourcePlural.js.html +1 -1
- package/docs/ResourceString.html +1 -1
- package/docs/ResourceString.js.html +1 -1
- package/docs/ResourceXliff.html +1 -1
- package/docs/ResourceXliff.js.html +1 -1
- package/docs/TranslationSet.html +1 -1
- package/docs/TranslationSet.js.html +1 -1
- package/docs/TranslationUnit.html +1 -1
- package/docs/TranslationUnit.js.html +1 -1
- package/docs/TranslationVariant.html +1 -1
- package/docs/TranslationVariant.js.html +1 -1
- package/docs/global.html +1 -1
- package/docs/index.html +1 -1
- package/docs/utils.js.html +1 -1
- package/lib/Resource.js +243 -0
- package/lib/Resource.js.map +1 -0
- package/lib/ResourceArray.js +165 -0
- package/lib/ResourceArray.js.map +1 -0
- package/lib/ResourcePlural.js +188 -0
- package/lib/ResourcePlural.js.map +1 -0
- package/lib/ResourceString.js +118 -0
- package/lib/ResourceString.js.map +1 -0
- package/lib/ResourceXliff.js +82 -0
- package/lib/ResourceXliff.js.map +1 -0
- package/lib/TranslationSet.js +145 -0
- package/lib/TranslationSet.js.map +1 -0
- package/lib/TranslationUnit.js +99 -0
- package/lib/TranslationUnit.js.map +1 -0
- package/lib/TranslationVariant.js +32 -0
- package/lib/TranslationVariant.js.map +1 -0
- package/lib/index.js +2 -0
- package/lib/index.js.map +1 -0
- package/lib/package.json +1 -0
- package/lib/utils.js +132 -0
- package/lib/utils.js.map +1 -0
- package/package.json +41 -14
- package/src/index.js +12 -2
- package/src/package.json +1 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Common code shared between the command-line tools such as loctool and i18nlint
|
|
|
4
4
|
|
|
5
5
|
## License
|
|
6
6
|
|
|
7
|
-
Copyright © 2022-
|
|
7
|
+
Copyright © 2022-2024, JEDLSoft
|
|
8
8
|
|
|
9
9
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
10
|
you may not use this file except in compliance with the License.
|
|
@@ -21,6 +21,15 @@ limitations under the License.
|
|
|
21
21
|
|
|
22
22
|
## Release Notes
|
|
23
23
|
|
|
24
|
+
### v1.10.0
|
|
25
|
+
|
|
26
|
+
- now ships with commonjs code as well as modern ESM in the same package
|
|
27
|
+
- updated dependencies
|
|
28
|
+
|
|
29
|
+
### v1.9.1
|
|
30
|
+
|
|
31
|
+
- forgot to export the HTML data in the previous version from the main entry point
|
|
32
|
+
|
|
24
33
|
### v1.9.0
|
|
25
34
|
|
|
26
35
|
- added data about HTML in the Utils
|
package/docs/Resource.html
CHANGED
|
@@ -3896,7 +3896,7 @@ stage of life of this resource. Currently, it can be one of "new",
|
|
|
3896
3896
|
<br class="clear">
|
|
3897
3897
|
|
|
3898
3898
|
<footer>
|
|
3899
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
3899
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
3900
3900
|
</footer>
|
|
3901
3901
|
|
|
3902
3902
|
<script>prettyPrint();</script>
|
package/docs/Resource.js.html
CHANGED
|
@@ -548,7 +548,7 @@ export default Resource;
|
|
|
548
548
|
<br class="clear">
|
|
549
549
|
|
|
550
550
|
<footer>
|
|
551
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
551
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
552
552
|
</footer>
|
|
553
553
|
|
|
554
554
|
<script>prettyPrint();</script>
|
package/docs/ResourceArray.html
CHANGED
|
@@ -6445,7 +6445,7 @@ parameters.</li></ul></dd>
|
|
|
6445
6445
|
<br class="clear">
|
|
6446
6446
|
|
|
6447
6447
|
<footer>
|
|
6448
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
6448
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
6449
6449
|
</footer>
|
|
6450
6450
|
|
|
6451
6451
|
<script>prettyPrint();</script>
|
|
@@ -465,7 +465,7 @@ export default ResourceArray;
|
|
|
465
465
|
<br class="clear">
|
|
466
466
|
|
|
467
467
|
<footer>
|
|
468
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
468
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
469
469
|
</footer>
|
|
470
470
|
|
|
471
471
|
<script>prettyPrint();</script>
|
package/docs/ResourcePlural.html
CHANGED
|
@@ -6800,7 +6800,7 @@ parameters.</li></ul></dd>
|
|
|
6800
6800
|
<br class="clear">
|
|
6801
6801
|
|
|
6802
6802
|
<footer>
|
|
6803
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
6803
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
6804
6804
|
</footer>
|
|
6805
6805
|
|
|
6806
6806
|
<script>prettyPrint();</script>
|
|
@@ -464,7 +464,7 @@ export default ResourcePlural;
|
|
|
464
464
|
<br class="clear">
|
|
465
465
|
|
|
466
466
|
<footer>
|
|
467
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
467
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
468
468
|
</footer>
|
|
469
469
|
|
|
470
470
|
<script>prettyPrint();</script>
|
package/docs/ResourceString.html
CHANGED
|
@@ -5852,7 +5852,7 @@ parameters.</li></ul></dd>
|
|
|
5852
5852
|
<br class="clear">
|
|
5853
5853
|
|
|
5854
5854
|
<footer>
|
|
5855
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
5855
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
5856
5856
|
</footer>
|
|
5857
5857
|
|
|
5858
5858
|
<script>prettyPrint();</script>
|
|
@@ -289,7 +289,7 @@ export default ResourceString;
|
|
|
289
289
|
<br class="clear">
|
|
290
290
|
|
|
291
291
|
<footer>
|
|
292
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
292
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
293
293
|
</footer>
|
|
294
294
|
|
|
295
295
|
<script>prettyPrint();</script>
|
package/docs/ResourceXliff.html
CHANGED
|
@@ -588,7 +588,7 @@ xliff v1.2 and v2.0.</li></ul></dd>
|
|
|
588
588
|
<br class="clear">
|
|
589
589
|
|
|
590
590
|
<footer>
|
|
591
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
591
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
592
592
|
</footer>
|
|
593
593
|
|
|
594
594
|
<script>prettyPrint();</script>
|
|
@@ -522,7 +522,7 @@ export default ResourceXliff;
|
|
|
522
522
|
<br class="clear">
|
|
523
523
|
|
|
524
524
|
<footer>
|
|
525
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
525
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
526
526
|
</footer>
|
|
527
527
|
|
|
528
528
|
<script>prettyPrint();</script>
|
package/docs/TranslationSet.html
CHANGED
|
@@ -2678,7 +2678,7 @@ the dirty flag to true again.</li></ul></dd>
|
|
|
2678
2678
|
<br class="clear">
|
|
2679
2679
|
|
|
2680
2680
|
<footer>
|
|
2681
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
2681
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
2682
2682
|
</footer>
|
|
2683
2683
|
|
|
2684
2684
|
<script>prettyPrint();</script>
|
|
@@ -458,7 +458,7 @@ export default TranslationSet;
|
|
|
458
458
|
<br class="clear">
|
|
459
459
|
|
|
460
460
|
<footer>
|
|
461
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
461
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
462
462
|
</footer>
|
|
463
463
|
|
|
464
464
|
<script>prettyPrint();</script>
|
|
@@ -1173,7 +1173,7 @@ the unit.</li></ul></dd>
|
|
|
1173
1173
|
<br class="clear">
|
|
1174
1174
|
|
|
1175
1175
|
<footer>
|
|
1176
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
1176
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
1177
1177
|
</footer>
|
|
1178
1178
|
|
|
1179
1179
|
<script>prettyPrint();</script>
|
|
@@ -242,7 +242,7 @@ export default TranslationUnit;</code></pre>
|
|
|
242
242
|
<br class="clear">
|
|
243
243
|
|
|
244
244
|
<footer>
|
|
245
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
245
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
246
246
|
</footer>
|
|
247
247
|
|
|
248
248
|
<script>prettyPrint();</script>
|
|
@@ -350,7 +350,7 @@ hash key is calculated from the source string and locale.</li></ul></dd>
|
|
|
350
350
|
<br class="clear">
|
|
351
351
|
|
|
352
352
|
<footer>
|
|
353
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
353
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
354
354
|
</footer>
|
|
355
355
|
|
|
356
356
|
<script>prettyPrint();</script>
|
|
@@ -109,7 +109,7 @@ export default TranslationVariant;</code></pre>
|
|
|
109
109
|
<br class="clear">
|
|
110
110
|
|
|
111
111
|
<footer>
|
|
112
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
112
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
113
113
|
</footer>
|
|
114
114
|
|
|
115
115
|
<script>prettyPrint();</script>
|
package/docs/global.html
CHANGED
|
@@ -1845,7 +1845,7 @@ the pathname
|
|
|
1845
1845
|
<br class="clear">
|
|
1846
1846
|
|
|
1847
1847
|
<footer>
|
|
1848
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
1848
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
1849
1849
|
</footer>
|
|
1850
1850
|
|
|
1851
1851
|
<script>prettyPrint();</script>
|
package/docs/index.html
CHANGED
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
<br class="clear">
|
|
72
72
|
|
|
73
73
|
<footer>
|
|
74
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
74
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
75
75
|
</footer>
|
|
76
76
|
|
|
77
77
|
<script>prettyPrint();</script>
|
package/docs/utils.js.html
CHANGED
|
@@ -594,7 +594,7 @@ export const localizableAttributes = {
|
|
|
594
594
|
<br class="clear">
|
|
595
595
|
|
|
596
596
|
<footer>
|
|
597
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.
|
|
597
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.3</a> on Tue May 21 2024 17:34:37 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
598
598
|
</footer>
|
|
599
599
|
|
|
600
600
|
<script>prettyPrint();</script>
|
package/lib/Resource.js
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports["default"]=void 0;function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor)}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}/*
|
|
2
|
+
* Resource.js - super class that represents a resource
|
|
3
|
+
*
|
|
4
|
+
* Copyright © 2022-2023 JEDLSoft
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
*
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/var validStates={"new":true,"translated":true,"accepted":true};var translationImportant=["context","datatype","dnt","flavor","project","reskey","resType","sourceLocale","targetLocale"];/**
|
|
19
|
+
* @class Represents a resource from a resource file or
|
|
20
|
+
* extracted from the code.
|
|
21
|
+
* @abstract
|
|
22
|
+
*/var Resource=/*#__PURE__*/function(){/**
|
|
23
|
+
* Construct a new Resource instance.
|
|
24
|
+
* The props may contain any
|
|
25
|
+
* of the following properties:
|
|
26
|
+
*
|
|
27
|
+
* <ul>
|
|
28
|
+
* <li>project {String} - the project that this resource is in
|
|
29
|
+
* <li><i>context</i> {String} - The context for this resource,
|
|
30
|
+
* such as "landscape mode", or "7200dp", which differentiates it
|
|
31
|
+
* from the base resource that has no special context. The default
|
|
32
|
+
* if this property is not specified is undefined, meaning no
|
|
33
|
+
* context.
|
|
34
|
+
* <li>sourceLocale {String} - the locale of the source resource.
|
|
35
|
+
* <li>targetLocale {String} - the locale of the target resource.
|
|
36
|
+
* <li>key {String} - the unique key of this string, which should include the context
|
|
37
|
+
* of the string
|
|
38
|
+
* <li>pathName {String} - pathName to the file where the string was extracted from
|
|
39
|
+
* <li>autoKey {boolean} - true if the key was generated based on the source text
|
|
40
|
+
* <li>state {String} - current state of the resource (ie. "new", "translated", or "accepted")
|
|
41
|
+
* </ul>
|
|
42
|
+
*
|
|
43
|
+
* @constructor
|
|
44
|
+
* @param {Object} props properties of the string, as defined above
|
|
45
|
+
*/function Resource(props){_classCallCheck(this,Resource);if(this.constructor===Resource){throw new Error("Cannot instantiate abstract class Resource!")}this.autoKey=false;if(props){this.project=props.project;this.context=props.context||undefined;// avoid the empty string
|
|
46
|
+
this.sourceLocale=props.sourceLocale||props.locale;this.targetLocale=props.targetLocale;this.reskey=props.key||props.reskey;this.pathName=props.pathName;this.autoKey=typeof props.autoKey==="boolean"?props.autoKey:false;this.state=props.state||undefined;this.id=props.id;// the database id
|
|
47
|
+
this.formatted=props.formatted;// for Android layout resources
|
|
48
|
+
this.comment=props.comment;this.origin=props.origin||"source";this.dnt=props.dnt;this.datatype=props.datatype;this.sourceHash=props.sourceHash;this.localize=typeof props.localize==="boolean"?props.localize:true;// some files have resources we do not want to localize/translate
|
|
49
|
+
this.flavor=props.flavor;this.index=props.index;this.location=props.location;// optional location of the transunits in the xml file
|
|
50
|
+
}this.instances=[];this.pathName=this.pathName||"";this.dirty=false}/**
|
|
51
|
+
* Return the project that this resource was found in.
|
|
52
|
+
*
|
|
53
|
+
* @returns {String} the project of this resource
|
|
54
|
+
*/return _createClass(Resource,[{key:"getProject",value:function getProject(){return this.project}/**
|
|
55
|
+
* Return the unique key of this resource.
|
|
56
|
+
*
|
|
57
|
+
* @returns {String} the unique key of this resource
|
|
58
|
+
*/},{key:"getKey",value:function getKey(){return this.reskey}/**
|
|
59
|
+
* Return the source string or strings for this resource.
|
|
60
|
+
*
|
|
61
|
+
* @returns {String|Array.<String>|Object} the source string or
|
|
62
|
+
* strings of this resource
|
|
63
|
+
*/},{key:"getSource",value:function getSource(){return this.source}/**
|
|
64
|
+
* Return the target string or strings for this resource.
|
|
65
|
+
*
|
|
66
|
+
* @returns {String|Array.<String>|Object} the source string or
|
|
67
|
+
* strings of this resource
|
|
68
|
+
*/},{key:"getTarget",value:function getTarget(){return this.target}/**
|
|
69
|
+
* Return the resource type of this resource. This is one of
|
|
70
|
+
* string, array, or plural.
|
|
71
|
+
*
|
|
72
|
+
* @returns {String} the resource type of this resource
|
|
73
|
+
*/},{key:"getType",value:function getType(){return this.resType||"string"}/**
|
|
74
|
+
* Return the data type of this resource.
|
|
75
|
+
*
|
|
76
|
+
* @returns {String} the data type of this resource
|
|
77
|
+
*/},{key:"getDataType",value:function getDataType(){return this.datatype}/**
|
|
78
|
+
* Return true if the key of this resource was automatically generated,
|
|
79
|
+
* and false if it was an explicit key.
|
|
80
|
+
*
|
|
81
|
+
* @returns {boolean} true if the key of this string was auto generated,
|
|
82
|
+
* false otherwise
|
|
83
|
+
*/},{key:"getAutoKey",value:function getAutoKey(){return this.autoKey}/**
|
|
84
|
+
* Return the context of this resource, or undefined if there
|
|
85
|
+
* is no context.
|
|
86
|
+
* @returns {String|undefined} the context of this resource, or undefined if there
|
|
87
|
+
* is no context.
|
|
88
|
+
*/},{key:"getContext",value:function getContext(){return this.context}/**
|
|
89
|
+
* Return the source locale of this resource, or undefined if there
|
|
90
|
+
* is no context or the locale is the same as the project's source locale.
|
|
91
|
+
* @returns {String|undefined} the locale of this resource, or undefined if there
|
|
92
|
+
* is no locale.
|
|
93
|
+
*/},{key:"getSourceLocale",value:function getSourceLocale(){return this.sourceLocale||"en-US"}/**
|
|
94
|
+
* Set the source locale of this resource.
|
|
95
|
+
* @param {String} locale the source locale of this resource
|
|
96
|
+
*/},{key:"setSourceLocale",value:function setSourceLocale(locale){this.sourceLocale=locale||this.sourceLocale;this.dirty=true}/**
|
|
97
|
+
* Return the target locale of this resource, or undefined if the resource
|
|
98
|
+
* is a source-only resource.
|
|
99
|
+
* @returns {String|undefined} the locale of this resource, or undefined if there
|
|
100
|
+
* is no locale.
|
|
101
|
+
*/},{key:"getTargetLocale",value:function getTargetLocale(){return this.targetLocale}/**
|
|
102
|
+
* Set the target locale of this resource.
|
|
103
|
+
* @param {String} locale the target locale of this resource
|
|
104
|
+
*/},{key:"setTargetLocale",value:function setTargetLocale(locale){this.targetLocale=locale||this.targetLocale;this.dirty=true}/**
|
|
105
|
+
* Return the state of this resource. This is a string that gives the
|
|
106
|
+
* stage of life of this resource. Currently, it can be one of "new",
|
|
107
|
+
* "translated", or "accepted".
|
|
108
|
+
*
|
|
109
|
+
* @returns {String} the state of this resource
|
|
110
|
+
*/},{key:"getState",value:function getState(){return this.state}/**
|
|
111
|
+
* Set the project of this resource. This is a string that gives the
|
|
112
|
+
* id of the project for this resource.
|
|
113
|
+
*
|
|
114
|
+
* @param {String} project the project name to set for this resource
|
|
115
|
+
*/},{key:"setProject",value:function setProject(project){this.project=project;this.dirty=true}/**
|
|
116
|
+
* Set the state of this resource. This is a string that gives the
|
|
117
|
+
* stage of life of this resource. Currently, it can be one of "new",
|
|
118
|
+
* "translated", or "accepted".
|
|
119
|
+
*
|
|
120
|
+
* @param {String} state the state of this resource
|
|
121
|
+
*/},{key:"setState",value:function setState(state){this.state=validStates[state]?state:this.state;this.dirty=true}/**
|
|
122
|
+
* Return the original path to the file from which this resource was
|
|
123
|
+
* originally extracted.
|
|
124
|
+
*
|
|
125
|
+
* @returns {String} the path to the file containing this resource
|
|
126
|
+
*/},{key:"getPath",value:function getPath(){return this.pathName}/**
|
|
127
|
+
* Return the translator's comment for this resource if there is
|
|
128
|
+
* one, or undefined if not.
|
|
129
|
+
*
|
|
130
|
+
* @returns {String|undefined} the translator's comment for this resource
|
|
131
|
+
* if the engineer put one in the code
|
|
132
|
+
*/},{key:"getComment",value:function getComment(){return this.comment}/**
|
|
133
|
+
* Set the translator's comment for this resource.
|
|
134
|
+
*
|
|
135
|
+
* @param {String|undefined} comment the translator's comment to set. Use
|
|
136
|
+
* undefined to clear the comment
|
|
137
|
+
*/},{key:"setComment",value:function setComment(comment){this.comment=comment;this.dirty=true}/**
|
|
138
|
+
* Return the database id if this resource has previously been saved in the
|
|
139
|
+
* database.
|
|
140
|
+
*
|
|
141
|
+
* @returns {number|undefined} the database id if this resource has previously
|
|
142
|
+
* been saved in the database, or undefined if it is has not
|
|
143
|
+
*/},{key:"getId",value:function getId(){return this.id}/**
|
|
144
|
+
* Return the origin of this resource. The origin may be either the string
|
|
145
|
+
* "source" or "target". Source origin resources are ones that are extracted
|
|
146
|
+
* from the source code, whereas target ones are translations from the
|
|
147
|
+
* translators.
|
|
148
|
+
*
|
|
149
|
+
* @returns {String} the origin of this resource
|
|
150
|
+
*/},{key:"getOrigin",value:function getOrigin(){return this.origin}/**
|
|
151
|
+
* Return the localize flag of this resource.
|
|
152
|
+
* This flag indicates whether we should look up a translation for this resource.
|
|
153
|
+
* When false, we should simply substitute the source back
|
|
154
|
+
*
|
|
155
|
+
* @returns {Boolean} the localize flag of this resource
|
|
156
|
+
*/},{key:"getLocalize",value:function getLocalize(){return this.localize}/**
|
|
157
|
+
* Return the name of the flavor for this resource, or undefined
|
|
158
|
+
* for the "main" or default flavor.
|
|
159
|
+
*
|
|
160
|
+
* @return {String|undefined} the name of the flavor for this
|
|
161
|
+
* resource or undefined for the main or default flavor
|
|
162
|
+
*/},{key:"getFlavor",value:function getFlavor(){return this.flavor}/**
|
|
163
|
+
* Return true if the other resource represents the same resource as
|
|
164
|
+
* the current one. The project, context, locale, key, flavor, and type must
|
|
165
|
+
* match. Other fields such as the pathName, state, and comment fields are
|
|
166
|
+
* ignored as minor variations.
|
|
167
|
+
*
|
|
168
|
+
* @param {Resource} other another resource to test against the current one
|
|
169
|
+
* @returns {boolean} true if these represent the same resource, false otherwise
|
|
170
|
+
*/},{key:"same",value:function same(other){if(!other)return false;var props=["project","context","sourceLocale","targetLocale","reskey","resType","flavor"];for(var i=0;i<props.length;i++){if(this[props[i]]!==other[props[i]]){return false}}return true}/**
|
|
171
|
+
* Escape text for writing to a database in a SQL command. This puts single
|
|
172
|
+
* quotes around the string, and makes sure that all single quotes within
|
|
173
|
+
* the string are escaped.
|
|
174
|
+
*
|
|
175
|
+
* @param {Object} str the item to escape
|
|
176
|
+
* @returns {String} the escaped string
|
|
177
|
+
*/},{key:"escapeText",value:function escapeText(str){switch(_typeof(str)){case"string":// unescape first, then re-escape to make everything consistent
|
|
178
|
+
return"'"+str.replace(/\\'/g,"'").replace(/'/g,"\\'")+"'";case"undefined":return"NULL";case"boolean":return str?"TRUE":"FALSE";default:if(str===null){return"NULL"}return str.toString()}}/**
|
|
179
|
+
* Add an instance of the same resource to the list of
|
|
180
|
+
* instances. If the given resource matches the
|
|
181
|
+
* current instance in all properties that affect the
|
|
182
|
+
* possible translation, and differs from the current
|
|
183
|
+
* instance by some property that does not affect
|
|
184
|
+
* its translation, it will be added as an instance of
|
|
185
|
+
* the same string. The following properties affect the
|
|
186
|
+
* translation:
|
|
187
|
+
*
|
|
188
|
+
* <ul>
|
|
189
|
+
* <li>context</li>
|
|
190
|
+
* <li>datatype</li>
|
|
191
|
+
* <li>dnt</li>
|
|
192
|
+
* <li>flavor</li>
|
|
193
|
+
* <li>project</li>
|
|
194
|
+
* <li>reskey</li>
|
|
195
|
+
* <li>resType</li>
|
|
196
|
+
* <li>source</li>
|
|
197
|
+
* <li>sourceHash</li>
|
|
198
|
+
* <li>sourceArray</li>
|
|
199
|
+
* <li>sourceLocale</li>
|
|
200
|
+
* <li>targetLocale</li>
|
|
201
|
+
* </ul>
|
|
202
|
+
*
|
|
203
|
+
* Differences in other properties, such as "comment" or
|
|
204
|
+
* "origin" are considered instances of the same resource.
|
|
205
|
+
*
|
|
206
|
+
* If this method is given a resource that differs from
|
|
207
|
+
* the current one by one of the above translation affecting
|
|
208
|
+
* properties, it is not added to the list of instances. This
|
|
209
|
+
* can be checked easily by calling the isInstance() method.
|
|
210
|
+
*
|
|
211
|
+
* @param {Resource} an instance of the current resource to
|
|
212
|
+
* record
|
|
213
|
+
* @returns {boolean} true if the instance was added, and
|
|
214
|
+
* and false otherwise
|
|
215
|
+
*/},{key:"addInstance",value:function addInstance(resource){if(!this.isInstance(resource)){return false}var unique=this!==resource&&this.instances.every(function(res){return res!==resource});if(!unique){return false}this.instances.push(resource);this.dirty=true;return true}/**
|
|
216
|
+
* Check if the given resource is an instance of the current
|
|
217
|
+
* resource. This method returns true if all properties which
|
|
218
|
+
* affect the possible translation match between the given and
|
|
219
|
+
* the current resource.
|
|
220
|
+
*
|
|
221
|
+
* @param {Resource} a resource to check
|
|
222
|
+
* @returns {boolean} true if this is an instance of
|
|
223
|
+
* the current resource, false otherwise.
|
|
224
|
+
*/},{key:"isInstance",value:function isInstance(resource){var _this=this;if(_typeof(resource)!=="object"||!(resource instanceof Resource)){return false}return translationImportant.every(function(prop){return _this[prop]===resource[prop]})}/**
|
|
225
|
+
* Return the list of instances of the current resource.
|
|
226
|
+
*
|
|
227
|
+
* @returns {Array.<Resource>} the list of instances of
|
|
228
|
+
* the current resource
|
|
229
|
+
*/},{key:"getInstances",value:function getInstances(){return this.instances}/**
|
|
230
|
+
* Return true if this instance has been modified since its creation, and false otherwise.
|
|
231
|
+
*/},{key:"isDirty",value:function isDirty(){return this.dirty}/**
|
|
232
|
+
* Clear the dirty flag. This is used for example when the Resource was
|
|
233
|
+
* written to disk and the modifications are already recorded, allowing
|
|
234
|
+
* new modifications later.
|
|
235
|
+
*/},{key:"clearDirty",value:function clearDirty(){this.dirty=false}/**
|
|
236
|
+
* Return the location of the resource instance in the original file where it was read
|
|
237
|
+
* from. This is usually an object containing a line and a char property which gives the
|
|
238
|
+
* line number and character within that line where the representation of the resource
|
|
239
|
+
* instance starts.
|
|
240
|
+
*
|
|
241
|
+
* @returns {Object<{line, char}>} the location information
|
|
242
|
+
*/},{key:"getLocation",value:function getLocation(){return this.location}}])}();var _default=exports["default"]=Resource;module.exports=exports.default;
|
|
243
|
+
//# sourceMappingURL=Resource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Resource.js","names":["validStates","translationImportant","Resource","props","_classCallCheck","constructor","Error","autoKey","project","context","undefined","sourceLocale","locale","targetLocale","reskey","key","pathName","state","id","formatted","comment","origin","dnt","datatype","sourceHash","localize","flavor","index","location","instances","dirty","_createClass","value","getProject","getKey","getSource","source","getTarget","target","getType","resType","getDataType","getAutoKey","getContext","getSourceLocale","setSourceLocale","getTargetLocale","setTargetLocale","getState","setProject","setState","getPath","getComment","setComment","getId","getOrigin","getLocalize","getFlavor","same","other","i","length","escapeText","str","_typeof","replace","toString","addInstance","resource","isInstance","unique","every","res","push","_this","prop","getInstances","isDirty","clearDirty","getLocation","_default","exports","module","default"],"sources":["../src/Resource.js"],"sourcesContent":["/*\n * Resource.js - super class that represents a resource\n *\n * Copyright © 2022-2023 JEDLSoft\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst validStates = {\n \"new\":true,\n \"translated\":true,\n \"accepted\":true\n}\n\nconst translationImportant = [\n \"context\",\n \"datatype\",\n \"dnt\",\n \"flavor\",\n \"project\",\n \"reskey\",\n \"resType\",\n \"sourceLocale\",\n \"targetLocale\"\n];\n\n\n/**\n * @class Represents a resource from a resource file or\n * extracted from the code.\n * @abstract\n */\nclass Resource {\n /**\n * Construct a new Resource instance.\n * The props may contain any\n * of the following properties:\n *\n * <ul>\n * <li>project {String} - the project that this resource is in\n * <li><i>context</i> {String} - The context for this resource,\n * such as \"landscape mode\", or \"7200dp\", which differentiates it\n * from the base resource that has no special context. The default\n * if this property is not specified is undefined, meaning no\n * context.\n * <li>sourceLocale {String} - the locale of the source resource.\n * <li>targetLocale {String} - the locale of the target resource.\n * <li>key {String} - the unique key of this string, which should include the context\n * of the string\n * <li>pathName {String} - pathName to the file where the string was extracted from\n * <li>autoKey {boolean} - true if the key was generated based on the source text\n * <li>state {String} - current state of the resource (ie. \"new\", \"translated\", or \"accepted\")\n * </ul>\n *\n * @constructor\n * @param {Object} props properties of the string, as defined above\n */\n constructor(props) {\n if (this.constructor === Resource) {\n throw new Error(\"Cannot instantiate abstract class Resource!\");\n }\n\n this.autoKey = false;\n\n if (props) {\n this.project = props.project;\n this.context = props.context || undefined; // avoid the empty string\n this.sourceLocale = props.sourceLocale || props.locale;\n this.targetLocale = props.targetLocale;\n this.reskey = props.key || props.reskey;\n this.pathName = props.pathName;\n this.autoKey = typeof(props.autoKey) === \"boolean\" ? props.autoKey : false;\n this.state = props.state || undefined;\n this.id = props.id; // the database id\n this.formatted = props.formatted; // for Android layout resources\n this.comment = props.comment;\n this.origin = props.origin || \"source\";\n this.dnt = props.dnt;\n this.datatype = props.datatype;\n this.sourceHash = props.sourceHash;\n this.localize = typeof(props.localize) === \"boolean\" ? props.localize : true; // some files have resources we do not want to localize/translate\n this.flavor = props.flavor;\n this.index = props.index;\n this.location = props.location; // optional location of the transunits in the xml file\n }\n\n this.instances = [];\n this.pathName = this.pathName || \"\";\n this.dirty = false;\n }\n\n /**\n * Return the project that this resource was found in.\n *\n * @returns {String} the project of this resource\n */\n getProject() {\n return this.project;\n }\n\n /**\n * Return the unique key of this resource.\n *\n * @returns {String} the unique key of this resource\n */\n getKey() {\n return this.reskey;\n }\n\n /**\n * Return the source string or strings for this resource.\n *\n * @returns {String|Array.<String>|Object} the source string or\n * strings of this resource\n */\n getSource() {\n return this.source;\n }\n\n /**\n * Return the target string or strings for this resource.\n *\n * @returns {String|Array.<String>|Object} the source string or\n * strings of this resource\n */\n getTarget() {\n return this.target;\n }\n\n /**\n * Return the resource type of this resource. This is one of\n * string, array, or plural.\n *\n * @returns {String} the resource type of this resource\n */\n getType() {\n return this.resType || \"string\";\n }\n\n /**\n * Return the data type of this resource.\n *\n * @returns {String} the data type of this resource\n */\n getDataType() {\n return this.datatype;\n }\n\n /**\n * Return true if the key of this resource was automatically generated,\n * and false if it was an explicit key.\n *\n * @returns {boolean} true if the key of this string was auto generated,\n * false otherwise\n */\n getAutoKey() {\n return this.autoKey;\n }\n\n /**\n * Return the context of this resource, or undefined if there\n * is no context.\n * @returns {String|undefined} the context of this resource, or undefined if there\n * is no context.\n */\n getContext() {\n return this.context;\n }\n\n /**\n * Return the source locale of this resource, or undefined if there\n * is no context or the locale is the same as the project's source locale.\n * @returns {String|undefined} the locale of this resource, or undefined if there\n * is no locale.\n */\n getSourceLocale() {\n return this.sourceLocale || \"en-US\";\n }\n\n /**\n * Set the source locale of this resource.\n * @param {String} locale the source locale of this resource\n */\n setSourceLocale(locale) {\n this.sourceLocale = locale || this.sourceLocale;\n this.dirty = true;\n }\n\n /**\n * Return the target locale of this resource, or undefined if the resource\n * is a source-only resource.\n * @returns {String|undefined} the locale of this resource, or undefined if there\n * is no locale.\n */\n getTargetLocale() {\n return this.targetLocale;\n }\n\n /**\n * Set the target locale of this resource.\n * @param {String} locale the target locale of this resource\n */\n setTargetLocale(locale) {\n this.targetLocale = locale || this.targetLocale;\n this.dirty = true;\n }\n\n /**\n * Return the state of this resource. This is a string that gives the\n * stage of life of this resource. Currently, it can be one of \"new\",\n * \"translated\", or \"accepted\".\n *\n * @returns {String} the state of this resource\n */\n getState() {\n return this.state;\n }\n\n /**\n * Set the project of this resource. This is a string that gives the\n * id of the project for this resource.\n *\n * @param {String} project the project name to set for this resource\n */\n setProject(project) {\n this.project = project;\n this.dirty = true;\n }\n\n /**\n * Set the state of this resource. This is a string that gives the\n * stage of life of this resource. Currently, it can be one of \"new\",\n * \"translated\", or \"accepted\".\n *\n * @param {String} state the state of this resource\n */\n setState(state) {\n this.state = validStates[state] ? state : this.state;\n this.dirty = true;\n }\n\n /**\n * Return the original path to the file from which this resource was\n * originally extracted.\n *\n * @returns {String} the path to the file containing this resource\n */\n getPath() {\n return this.pathName;\n }\n\n /**\n * Return the translator's comment for this resource if there is\n * one, or undefined if not.\n *\n * @returns {String|undefined} the translator's comment for this resource\n * if the engineer put one in the code\n */\n getComment() {\n return this.comment;\n }\n\n /**\n * Set the translator's comment for this resource.\n *\n * @param {String|undefined} comment the translator's comment to set. Use\n * undefined to clear the comment\n */\n setComment(comment) {\n this.comment = comment;\n this.dirty = true;\n }\n\n /**\n * Return the database id if this resource has previously been saved in the\n * database.\n *\n * @returns {number|undefined} the database id if this resource has previously\n * been saved in the database, or undefined if it is has not\n */\n getId() {\n return this.id;\n }\n\n /**\n * Return the origin of this resource. The origin may be either the string\n * \"source\" or \"target\". Source origin resources are ones that are extracted\n * from the source code, whereas target ones are translations from the\n * translators.\n *\n * @returns {String} the origin of this resource\n */\n getOrigin() {\n return this.origin;\n }\n\n /**\n * Return the localize flag of this resource.\n * This flag indicates whether we should look up a translation for this resource.\n * When false, we should simply substitute the source back\n *\n * @returns {Boolean} the localize flag of this resource\n */\n getLocalize() {\n return this.localize;\n }\n\n /**\n * Return the name of the flavor for this resource, or undefined\n * for the \"main\" or default flavor.\n *\n * @return {String|undefined} the name of the flavor for this\n * resource or undefined for the main or default flavor\n */\n getFlavor() {\n return this.flavor;\n }\n\n /**\n * Return true if the other resource represents the same resource as\n * the current one. The project, context, locale, key, flavor, and type must\n * match. Other fields such as the pathName, state, and comment fields are\n * ignored as minor variations.\n *\n * @param {Resource} other another resource to test against the current one\n * @returns {boolean} true if these represent the same resource, false otherwise\n */\n same(other) {\n if (!other) return false;\n\n const props = [\"project\", \"context\", \"sourceLocale\", \"targetLocale\", \"reskey\", \"resType\", \"flavor\"];\n for (let i = 0; i < props.length; i++) {\n if (this[props[i]] !== other[props[i]]) {\n return false;\n }\n }\n\n return true;\n }\n\n /**\n * Escape text for writing to a database in a SQL command. This puts single\n * quotes around the string, and makes sure that all single quotes within\n * the string are escaped.\n *\n * @param {Object} str the item to escape\n * @returns {String} the escaped string\n */\n escapeText(str) {\n switch (typeof(str)) {\n case \"string\":\n // unescape first, then re-escape to make everything consistent\n return \"'\" + str.replace(/\\\\'/g, \"'\").replace(/'/g, \"\\\\'\") + \"'\";\n case \"undefined\":\n return \"NULL\";\n case \"boolean\":\n return str ? \"TRUE\" : \"FALSE\";\n default:\n if (str === null) {\n return \"NULL\";\n }\n return str.toString();\n }\n }\n\n /**\n * Add an instance of the same resource to the list of\n * instances. If the given resource matches the\n * current instance in all properties that affect the\n * possible translation, and differs from the current\n * instance by some property that does not affect\n * its translation, it will be added as an instance of\n * the same string. The following properties affect the\n * translation:\n *\n * <ul>\n * <li>context</li>\n * <li>datatype</li>\n * <li>dnt</li>\n * <li>flavor</li>\n * <li>project</li>\n * <li>reskey</li>\n * <li>resType</li>\n * <li>source</li>\n * <li>sourceHash</li>\n * <li>sourceArray</li>\n * <li>sourceLocale</li>\n * <li>targetLocale</li>\n * </ul>\n *\n * Differences in other properties, such as \"comment\" or\n * \"origin\" are considered instances of the same resource.\n *\n * If this method is given a resource that differs from\n * the current one by one of the above translation affecting\n * properties, it is not added to the list of instances. This\n * can be checked easily by calling the isInstance() method.\n *\n * @param {Resource} an instance of the current resource to\n * record\n * @returns {boolean} true if the instance was added, and\n * and false otherwise\n */\n addInstance(resource) {\n if (!this.isInstance(resource)) {\n return false;\n }\n const unique = this !== resource && this.instances.every(res => {\n return res !== resource;\n });\n if (!unique) {\n return false;\n }\n this.instances.push(resource);\n this.dirty = true;\n return true;\n }\n\n /**\n * Check if the given resource is an instance of the current\n * resource. This method returns true if all properties which\n * affect the possible translation match between the given and\n * the current resource.\n *\n * @param {Resource} a resource to check\n * @returns {boolean} true if this is an instance of\n * the current resource, false otherwise.\n */\n isInstance(resource) {\n if (typeof(resource) !== 'object' || !(resource instanceof Resource)) {\n return false;\n }\n\n return translationImportant.every(prop => {\n return this[prop] === resource[prop];\n });\n }\n\n /**\n * Return the list of instances of the current resource.\n *\n * @returns {Array.<Resource>} the list of instances of\n * the current resource\n */\n getInstances() {\n return this.instances;\n }\n\n /**\n * Return true if this instance has been modified since its creation, and false otherwise.\n */\n isDirty() {\n return this.dirty\n }\n\n /**\n * Clear the dirty flag. This is used for example when the Resource was\n * written to disk and the modifications are already recorded, allowing\n * new modifications later.\n */\n clearDirty() {\n this.dirty = false;\n }\n\n /**\n * Return the location of the resource instance in the original file where it was read\n * from. This is usually an object containing a line and a char property which gives the\n * line number and character within that line where the representation of the resource\n * instance starts.\n *\n * @returns {Object<{line, char}>} the location information\n */\n getLocation() {\n return this.location;\n }\n}\n\nexport default Resource;\n"],"mappings":"q6CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAEA,GAAM,CAAAA,WAAW,CAAG,CAChB,KAAK,CAAC,IAAI,CACV,YAAY,CAAC,IAAI,CACjB,UAAU,CAAC,IACf,CAAC,CAED,GAAM,CAAAC,oBAAoB,CAAG,CACzB,SAAS,CACT,UAAU,CACV,KAAK,CACL,QAAQ,CACR,SAAS,CACT,QAAQ,CACR,SAAS,CACT,cAAc,CACd,cAAc,CACjB,CAGD;AACA;AACA;AACA;AACA,GAJA,GAKM,CAAAC,QAAQ,yBACV;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OACI,SAAAA,SAAYC,KAAK,CAAE,CAAAC,eAAA,MAAAF,QAAA,EACf,GAAI,IAAI,CAACG,WAAW,GAAKH,QAAQ,CAAE,CAC/B,KAAM,IAAI,CAAAI,KAAK,CAAC,6CAA6C,CACjE,CAEA,IAAI,CAACC,OAAO,CAAG,KAAK,CAEpB,GAAIJ,KAAK,CAAE,CACP,IAAI,CAACK,OAAO,CAAGL,KAAK,CAACK,OAAO,CAC5B,IAAI,CAACC,OAAO,CAAGN,KAAK,CAACM,OAAO,EAAIC,SAAS,CAAE;AAC3C,IAAI,CAACC,YAAY,CAAGR,KAAK,CAACQ,YAAY,EAAIR,KAAK,CAACS,MAAM,CACtD,IAAI,CAACC,YAAY,CAAGV,KAAK,CAACU,YAAY,CACtC,IAAI,CAACC,MAAM,CAAGX,KAAK,CAACY,GAAG,EAAIZ,KAAK,CAACW,MAAM,CACvC,IAAI,CAACE,QAAQ,CAAGb,KAAK,CAACa,QAAQ,CAC9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