properties-file 2.1.26 → 2.1.27
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/lib/content/index.js +2 -2
- package/lib/properties.js +2 -1
- package/lib/property-line.d.ts +3 -3
- package/lib/property-line.js +6 -6
- package/package.json +29 -28
package/lib/content/index.js
CHANGED
|
@@ -27,7 +27,7 @@ var getProperties = function (content) {
|
|
|
27
27
|
if (property) {
|
|
28
28
|
// Continue parsing an existing property.
|
|
29
29
|
property.addLine(propertyLine);
|
|
30
|
-
if (propertyLine.
|
|
30
|
+
if (propertyLine.isContinuing) {
|
|
31
31
|
continue;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -38,7 +38,7 @@ var getProperties = function (content) {
|
|
|
38
38
|
}
|
|
39
39
|
// The line is a new property.
|
|
40
40
|
property = new property_1.Property(propertyLine, lineNumber);
|
|
41
|
-
if (propertyLine.
|
|
41
|
+
if (propertyLine.isContinuing) {
|
|
42
42
|
continue; // Continue parsing the next line.
|
|
43
43
|
}
|
|
44
44
|
}
|
package/lib/properties.js
CHANGED
|
@@ -20,8 +20,9 @@ var Properties = /** @class */ (function () {
|
|
|
20
20
|
*/
|
|
21
21
|
Properties.prototype.add = function (property) {
|
|
22
22
|
var _a;
|
|
23
|
-
if (property === undefined)
|
|
23
|
+
if (property === undefined) {
|
|
24
24
|
return undefined;
|
|
25
|
+
}
|
|
25
26
|
property.setKeyAndValue();
|
|
26
27
|
if ((_a = this.keyLineNumbers[property.key]) === null || _a === void 0 ? void 0 : _a.length) {
|
|
27
28
|
this.keyLineNumbers[property.key].push(property.startingLineNumber);
|
package/lib/property-line.d.ts
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* Object representing a line from the content of .properties file.
|
|
3
3
|
*/
|
|
4
4
|
export declare class PropertyLine {
|
|
5
|
-
/** The line content, minus the trailing \ that identifies that the line
|
|
5
|
+
/** The line content, minus the trailing \ that identifies that the line is continuing. */
|
|
6
6
|
content: string;
|
|
7
|
-
/** True if the line
|
|
8
|
-
|
|
7
|
+
/** True if the line is continuing to the next line, otherwise false. */
|
|
8
|
+
isContinuing: boolean;
|
|
9
9
|
/** True if the line is blank, otherwise false. */
|
|
10
10
|
isBlank: boolean;
|
|
11
11
|
/** True if the line is a comment, otherwise false. */
|
package/lib/property-line.js
CHANGED
|
@@ -12,8 +12,8 @@ var PropertyLine = /** @class */ (function () {
|
|
|
12
12
|
* @param isMultiline - Is the line spreading on multiple lines?
|
|
13
13
|
*/
|
|
14
14
|
function PropertyLine(line, isMultiline) {
|
|
15
|
-
/** True if the line
|
|
16
|
-
this.
|
|
15
|
+
/** True if the line is continuing to the next line, otherwise false. */
|
|
16
|
+
this.isContinuing = false;
|
|
17
17
|
/** True if the line is blank, otherwise false. */
|
|
18
18
|
this.isBlank = false;
|
|
19
19
|
/** True if the line is a comment, otherwise false. */
|
|
@@ -30,12 +30,12 @@ var PropertyLine = /** @class */ (function () {
|
|
|
30
30
|
this.isComment = !!/^[!#]/.test(this.content);
|
|
31
31
|
}
|
|
32
32
|
if (!this.isComment) {
|
|
33
|
-
// Otherwise, check if the line
|
|
33
|
+
// Otherwise, check if the line is continuing on the next line.
|
|
34
34
|
var backslashMatch = this.content.match(/(?<backslashes>\\+)$/);
|
|
35
35
|
if (backslashMatch === null || backslashMatch === void 0 ? void 0 : backslashMatch.groups) {
|
|
36
|
-
// If the number of backslashes is odd, the line
|
|
37
|
-
this.
|
|
38
|
-
if (this.
|
|
36
|
+
// If the number of backslashes is odd, the line is continuing, otherwise it doesn't.
|
|
37
|
+
this.isContinuing = !!(backslashMatch.groups.backslashes.length % 2);
|
|
38
|
+
if (this.isContinuing) {
|
|
39
39
|
// Remove the trailing slash so that we can concatenate the line with the next one.
|
|
40
40
|
this.content = this.content.slice(0, -1);
|
|
41
41
|
}
|
package/package.json
CHANGED
|
@@ -1,19 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "properties-file",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.27",
|
|
4
4
|
"description": ".properties file parser, JSON converter and Webpack loader.",
|
|
5
|
-
"
|
|
5
|
+
"keywords": [
|
|
6
|
+
".properties",
|
|
7
|
+
"properties",
|
|
8
|
+
".properties file",
|
|
9
|
+
"properties file",
|
|
10
|
+
"parser",
|
|
11
|
+
"Java",
|
|
12
|
+
"intl",
|
|
13
|
+
"i18n",
|
|
14
|
+
"properties Webpack loader",
|
|
15
|
+
"Webpack loader",
|
|
16
|
+
"internationalization"
|
|
17
|
+
],
|
|
6
18
|
"repository": {
|
|
7
19
|
"type": "git",
|
|
8
20
|
"url": "git+https://github.com/Avansai/properties-file.git"
|
|
9
21
|
},
|
|
10
|
-
"
|
|
11
|
-
"
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"author": "Avansai (https://avansai.com)",
|
|
12
24
|
"exports": {
|
|
13
25
|
".": "./lib/index.js",
|
|
14
26
|
"./content": "./lib/content/index.js",
|
|
15
27
|
"./webpack-loader": "./lib/loader/webpack.js"
|
|
16
28
|
},
|
|
29
|
+
"main": "lib/index.js",
|
|
30
|
+
"types": "lib/index.d.ts",
|
|
17
31
|
"typesVersions": {
|
|
18
32
|
"*": {
|
|
19
33
|
"content": [
|
|
@@ -24,51 +38,38 @@
|
|
|
24
38
|
]
|
|
25
39
|
}
|
|
26
40
|
},
|
|
27
|
-
"license": "MIT",
|
|
28
41
|
"files": [
|
|
29
42
|
"lib"
|
|
30
43
|
],
|
|
31
|
-
"keywords": [
|
|
32
|
-
".properties",
|
|
33
|
-
"properties",
|
|
34
|
-
".properties file",
|
|
35
|
-
"properties file",
|
|
36
|
-
"parser",
|
|
37
|
-
"Java",
|
|
38
|
-
"intl",
|
|
39
|
-
"i18n",
|
|
40
|
-
"properties Webpack loader",
|
|
41
|
-
"Webpack loader",
|
|
42
|
-
"internationalization"
|
|
43
|
-
],
|
|
44
44
|
"scripts": {
|
|
45
|
+
"add-import-type": "node ./src/add-import-type.mjs",
|
|
45
46
|
"build": "npm run prettier && npm run lint-fix && rm -Rf ./lib && tsc && npm run add-import-type && npm run test",
|
|
46
|
-
"lint-
|
|
47
|
-
"lint-
|
|
47
|
+
"lint-check": "eslint --ext .js --ext .jsx --ext .ts --ext .tsx --ext .json .",
|
|
48
|
+
"lint-fix": "eslint --ext .js --ext .jsx --ext .ts --ext .tsx --ext .json --fix .",
|
|
48
49
|
"lint-print-config": "eslint --print-config ./eslintrc.yaml",
|
|
49
50
|
"prettier": "prettier --write .",
|
|
50
|
-
"
|
|
51
|
-
"test": "jest --coverage"
|
|
52
|
-
"release": "dotenv -- release-it --only-version"
|
|
51
|
+
"release": "dotenv -- release-it --only-version",
|
|
52
|
+
"test": "jest --coverage"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"@release-it/conventional-changelog": "^5.1.1",
|
|
56
56
|
"@types/jest": "^29.4.0",
|
|
57
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
58
|
-
"@typescript-eslint/parser": "^5.
|
|
57
|
+
"@typescript-eslint/eslint-plugin": "^5.51.0",
|
|
58
|
+
"@typescript-eslint/parser": "^5.51.0",
|
|
59
59
|
"dotenv-cli": "^7.0.0",
|
|
60
|
-
"eslint": "^8.
|
|
60
|
+
"eslint": "^8.34.0",
|
|
61
61
|
"eslint-config-prettier": "^8.6.0",
|
|
62
62
|
"eslint-import-resolver-node": "^0.3.7",
|
|
63
63
|
"eslint-import-resolver-typescript": "^3.5.3",
|
|
64
64
|
"eslint-plugin-import": "^2.27.5",
|
|
65
65
|
"eslint-plugin-jest": "^27.2.1",
|
|
66
|
+
"eslint-plugin-json-files": "^2.1.0",
|
|
66
67
|
"eslint-plugin-prefer-arrow-functions": "^3.1.4",
|
|
67
68
|
"eslint-plugin-prettier": "^4.2.1",
|
|
68
69
|
"eslint-plugin-tsdoc": "^0.2.17",
|
|
69
70
|
"eslint-plugin-unicorn": "^45.0.2",
|
|
70
|
-
"jest": "^29.4.
|
|
71
|
-
"prettier": "^2.8.
|
|
71
|
+
"jest": "^29.4.2",
|
|
72
|
+
"prettier": "^2.8.4",
|
|
72
73
|
"prettier-plugin-organize-imports": "^3.2.2",
|
|
73
74
|
"prettier-plugin-sh": "^0.12.8",
|
|
74
75
|
"release-it": "^15.6.0",
|