properties-file 3.7.0 → 5.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 +253 -285
- package/dist/cjs/bundler/bun.d.ts +10 -0
- package/dist/cjs/bundler/bun.js +1 -0
- package/dist/cjs/bundler/esbuild.d.ts +11 -0
- package/dist/cjs/bundler/esbuild.js +1 -0
- package/dist/cjs/bundler/rollup.d.ts +11 -0
- package/dist/cjs/bundler/rollup.js +1 -0
- package/dist/cjs/bundler/webpack.d.ts +12 -0
- package/dist/cjs/bundler/webpack.js +1 -0
- package/dist/cjs/editor/index.d.ts +76 -93
- package/dist/cjs/editor/index.js +1 -1
- package/dist/cjs/escape/index.js +1 -1
- package/dist/cjs/index.d.ts +0 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/parse-properties.d.ts +22 -0
- package/dist/cjs/parse-properties.js +1 -0
- package/dist/cjs/parser/index.d.ts +3 -0
- package/dist/cjs/parser/index.js +1 -0
- package/dist/cjs/parser/nodes.d.ts +113 -0
- package/dist/cjs/parser/nodes.js +1 -0
- package/dist/cjs/parser/normalize.d.ts +12 -0
- package/dist/cjs/parser/normalize.js +1 -0
- package/dist/cjs/parser/parse.d.ts +23 -0
- package/dist/cjs/parser/parse.js +1 -0
- package/dist/cjs/parser/properties.d.ts +93 -0
- package/dist/cjs/parser/properties.js +1 -0
- package/dist/cjs/unescape/index.d.ts +4 -0
- package/dist/cjs/unescape/index.js +1 -1
- package/dist/esm/bundler/bun.d.ts +10 -0
- package/dist/esm/bundler/bun.js +1 -0
- package/dist/esm/bundler/esbuild.d.ts +11 -0
- package/dist/esm/bundler/esbuild.js +1 -0
- package/dist/esm/bundler/rollup.d.ts +11 -0
- package/dist/esm/bundler/rollup.js +1 -0
- package/dist/esm/bundler/webpack.d.ts +12 -0
- package/dist/esm/editor/index.d.ts +76 -93
- package/dist/esm/editor/index.js +1 -1
- package/dist/esm/escape/index.js +1 -1
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/parse-properties.d.ts +22 -0
- package/dist/esm/parse-properties.js +1 -0
- package/dist/esm/parser/index.d.ts +3 -0
- package/dist/esm/parser/index.js +1 -0
- package/dist/esm/parser/nodes.d.ts +113 -0
- package/dist/esm/parser/nodes.js +1 -0
- package/dist/esm/parser/normalize.d.ts +12 -0
- package/dist/esm/parser/normalize.js +1 -0
- package/dist/esm/parser/parse.d.ts +23 -0
- package/dist/esm/parser/parse.js +1 -0
- package/dist/esm/parser/properties.d.ts +93 -0
- package/dist/esm/parser/properties.js +1 -0
- package/dist/esm/unescape/index.d.ts +4 -0
- package/dist/esm/unescape/index.js +1 -1
- package/package.json +81 -30
- package/dist/cjs/loader/webpack.d.ts +0 -12
- package/dist/cjs/loader/webpack.js +0 -1
- package/dist/cjs/properties.d.ts +0 -96
- package/dist/cjs/properties.js +0 -1
- package/dist/cjs/property-line.d.ts +0 -22
- package/dist/cjs/property-line.js +0 -1
- package/dist/cjs/property.d.ts +0 -81
- package/dist/cjs/property.js +0 -1
- package/dist/esm/loader/webpack.d.ts +0 -12
- package/dist/esm/properties.d.ts +0 -96
- package/dist/esm/properties.js +0 -1
- package/dist/esm/property-line.d.ts +0 -22
- package/dist/esm/property-line.js +0 -1
- package/dist/esm/property.d.ts +0 -81
- package/dist/esm/property.js +0 -1
- /package/dist/esm/{loader → bundler}/webpack.js +0 -0
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Object representing a line from the content of .properties file.
|
|
3
|
-
*/
|
|
4
|
-
export declare class PropertyLine {
|
|
5
|
-
/** The line content, minus the trailing `\` that identifies that the line is continuing. */
|
|
6
|
-
content: string;
|
|
7
|
-
/** True if the line is continuing to the next line, otherwise false. */
|
|
8
|
-
isContinuing: boolean;
|
|
9
|
-
/** True if the line is blank, otherwise false. */
|
|
10
|
-
isBlank: boolean;
|
|
11
|
-
/** True if the line is a comment, otherwise false. */
|
|
12
|
-
isComment: boolean;
|
|
13
|
-
/** Is the line object a continuation from a previous line? */
|
|
14
|
-
isMultiline: boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Create a new line object.
|
|
17
|
-
*
|
|
18
|
-
* @param line - The raw content of a line.
|
|
19
|
-
* @param isMultiline - Is the line spreading on multiple lines?
|
|
20
|
-
*/
|
|
21
|
-
constructor(line: string, isMultiline: boolean);
|
|
22
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var REGEX_LEADING_WHITESPACE=/^\s+/,REGEX_COMMENT=/^[!#]/,REGEX_TRAILING_BACKSLASHES=/(\\+)$/,PropertyLine=function(t,i){if(this.isContinuing=!1,this.isBlank=!1,this.isComment=!1,this.content=t.replace(REGEX_LEADING_WHITESPACE,""),this.isMultiline=i,0===this.content.length)this.isBlank=!0;else if(this.isMultiline||(this.isComment=REGEX_COMMENT.test(this.content)),!this.isComment){var n=this.content.match(REGEX_TRAILING_BACKSLASHES);n&&(this.isContinuing=n[1].length%2==1,this.isContinuing&&(this.content=this.content.slice(0,-1)))}};export{PropertyLine};
|
package/dist/esm/property.d.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { PropertyLine } from './property-line.js';
|
|
2
|
-
/**
|
|
3
|
-
* Object representing a property (key/value).
|
|
4
|
-
*/
|
|
5
|
-
export declare class Property {
|
|
6
|
-
/** The content of one or multiple lines when applicable. */
|
|
7
|
-
linesContent: string;
|
|
8
|
-
/** The property key (unescaped). */
|
|
9
|
-
key: string;
|
|
10
|
-
/** The property key, including its escaped characters. */
|
|
11
|
-
escapedKey: string;
|
|
12
|
-
/** Is the key empty? */
|
|
13
|
-
private hasNoKey;
|
|
14
|
-
/** Does the key definition spread across multiple lines? */
|
|
15
|
-
private hasMultilineKey;
|
|
16
|
-
/** Starting line numbers of property objects with the same key. */
|
|
17
|
-
keyCollisionLines: number[];
|
|
18
|
-
/** Was the property's key used more than once? */
|
|
19
|
-
hasKeyCollisions: boolean;
|
|
20
|
-
/** The key/value pair separator */
|
|
21
|
-
separator: string | undefined;
|
|
22
|
-
/** The length of the key/value pair separator, including its whitespace characters. */
|
|
23
|
-
separatorLength: number | undefined;
|
|
24
|
-
/** The starting position of the key/value pair separator. */
|
|
25
|
-
separatorPosition: number | undefined;
|
|
26
|
-
/** The property value (unescaped). */
|
|
27
|
-
value: string;
|
|
28
|
-
/** The starting position of the value. */
|
|
29
|
-
valuePosition: number | undefined;
|
|
30
|
-
/** The property value, including its escaped characters. */
|
|
31
|
-
escapedValue: string;
|
|
32
|
-
/** Positions of the newline characters if any. */
|
|
33
|
-
newlinePositions: number[];
|
|
34
|
-
/** The line number at which the property starts. */
|
|
35
|
-
readonly startingLineNumber: number;
|
|
36
|
-
/** The line number at which the property ends. */
|
|
37
|
-
endingLineNumber: number;
|
|
38
|
-
/** The previous property object if it exists. */
|
|
39
|
-
readonly previousProperty?: Property;
|
|
40
|
-
/** The next property object if it exists. */
|
|
41
|
-
nextProperty?: Property;
|
|
42
|
-
/**
|
|
43
|
-
* Create a new property object.
|
|
44
|
-
*
|
|
45
|
-
* @param propertyLine - A property line object.
|
|
46
|
-
* @param startingLineNumber - The line number at which the property starts.
|
|
47
|
-
*/
|
|
48
|
-
constructor(propertyLine: PropertyLine, startingLineNumber: number, previousProperty?: Property);
|
|
49
|
-
/**
|
|
50
|
-
* Set the next property object.
|
|
51
|
-
*
|
|
52
|
-
* @param property - The next property object
|
|
53
|
-
*/
|
|
54
|
-
setNextProperty(property: Property): void;
|
|
55
|
-
/**
|
|
56
|
-
* Add the a line to a multiline property object.
|
|
57
|
-
*
|
|
58
|
-
* @param propertyLine - A property line object.
|
|
59
|
-
*/
|
|
60
|
-
addLine(propertyLine: PropertyLine): void;
|
|
61
|
-
/**
|
|
62
|
-
* Set the property's key and value.
|
|
63
|
-
*/
|
|
64
|
-
setKeyAndValue(): void;
|
|
65
|
-
/**
|
|
66
|
-
* Unescape the content from either key or value of a property.
|
|
67
|
-
*
|
|
68
|
-
* @param escapedContent - The content to unescape.
|
|
69
|
-
* @param startingLineNumber - The starting line number of the content being unescaped.
|
|
70
|
-
*
|
|
71
|
-
* @returns The unescaped content.
|
|
72
|
-
*
|
|
73
|
-
* @throws {@link Error}
|
|
74
|
-
* This exception is thrown if malformed escaped unicode characters are present.
|
|
75
|
-
*/
|
|
76
|
-
private unescapeLine;
|
|
77
|
-
/**
|
|
78
|
-
* Find the character separating the key from the value.
|
|
79
|
-
*/
|
|
80
|
-
private findSeparator;
|
|
81
|
-
}
|
package/dist/esm/property.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{unescapeContent}from"./unescape/index.js";var REGEX_TRAILING_BACKSLASHES=/(\\+)$/,REGEX_LEADING_WHITESPACE=/^([\t\n\v\f\r ]+)/,REGEX_SEPARATOR=/[\t\f :=]/g,REGEX_COLON_OR_EQUALS=/[:=]/,Property=function(){function t(t,e,i){this.key="",this.escapedKey="",this.hasNoKey=!1,this.hasMultilineKey=!1,this.keyCollisionLines=[],this.hasKeyCollisions=!1,this.value="",this.escapedValue="",this.newlinePositions=[],this.linesContent=t.content,this.startingLineNumber=e,this.endingLineNumber=e,this.previousProperty=i,null==i||i.setNextProperty(this)}return t.prototype.setNextProperty=function(t){this.nextProperty=t},t.prototype.addLine=function(t){this.linesContent.length>0&&(this.newlinePositions.push(this.linesContent.length),this.endingLineNumber++),this.linesContent+=t.content},t.prototype.setKeyAndValue=function(){this.findSeparator(),void 0!==this.separatorPosition&&void 0!==this.separatorLength?(this.hasNoKey||(this.escapedKey=this.linesContent.slice(0,this.separatorPosition),this.key=this.unescapeLine(this.escapedKey,this.startingLineNumber)),this.escapedValue=this.linesContent.slice(this.separatorPosition+this.separatorLength),this.value=this.unescapeLine(this.escapedValue,this.startingLineNumber)):(this.escapedKey=this.linesContent,this.key=this.unescapeLine(this.escapedKey,this.startingLineNumber))},t.prototype.unescapeLine=function(t,e){try{return unescapeContent(t)}catch(t){throw new Error("".concat(t.message," in property starting at line ").concat(e))}},t.prototype.findSeparator=function(){var t,e,i,s;if(!this.hasNoKey&&!this.separator){var n;for(REGEX_SEPARATOR.lastIndex=0;null!==(n=REGEX_SEPARATOR.exec(this.linesContent));){var o=n.index,h=this.linesContent.slice(0,o).match(REGEX_TRAILING_BACKSLASHES);if(h)if(h[1].length%2==1)continue;var r="";this.separatorPosition=o;var a=this.linesContent.slice(o),l=null!==(e=null===(t=a.match(REGEX_LEADING_WHITESPACE))||void 0===t?void 0:t[0])&&void 0!==e?e:"";l.length>0&&(r+=l,a=a.slice(l.length)),REGEX_COLON_OR_EQUALS.test(a[0])&&(r+=a[0],r+=null!==(s=null===(i=(a=a.slice(1)).match(REGEX_LEADING_WHITESPACE))||void 0===i?void 0:i[0])&&void 0!==s?s:""),this.separatorLength=r.length,this.valuePosition=this.separatorPosition+this.separatorLength,this.separator=this.linesContent.slice(this.separatorPosition,this.separatorPosition+this.separatorLength),o||(this.hasNoKey=!0);break}void 0!==this.separatorPosition&&this.newlinePositions.length>0&&this.newlinePositions[0]<this.separatorPosition&&(this.hasMultilineKey=!0)}},t}();export{Property};
|
|
File without changes
|