@nsis/dent 0.1.1 → 0.2.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/dist/index.mjs +7 -3
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -76,6 +76,7 @@ var rules = {
|
|
|
76
76
|
// src/main.ts
|
|
77
77
|
var Dent = class {
|
|
78
78
|
options = {
|
|
79
|
+
endOfLines: void 0,
|
|
79
80
|
indentSize: 2,
|
|
80
81
|
trimEmptyLines: true,
|
|
81
82
|
useTabs: true
|
|
@@ -134,9 +135,12 @@ var Dent = class {
|
|
|
134
135
|
return formattedLines.join(lineEndings);
|
|
135
136
|
}
|
|
136
137
|
appendLine(line, level) {
|
|
137
|
-
return line.length ? `${this.getIndentChar(
|
|
138
|
+
return line.length ? `${this.getIndentChar().repeat(level)}${line.trim()}` : "";
|
|
138
139
|
}
|
|
139
140
|
detectEOL(input) {
|
|
141
|
+
if (this.options.endOfLines) {
|
|
142
|
+
return this.options.endOfLines === "crlf" ? "\r\n" : "\n";
|
|
143
|
+
}
|
|
140
144
|
const newLine = detectNewline(input);
|
|
141
145
|
if (newLine !== void 0) {
|
|
142
146
|
return newLine;
|
|
@@ -144,8 +148,8 @@ var Dent = class {
|
|
|
144
148
|
return platform() === "win32" ? "\r\n" : "\n";
|
|
145
149
|
}
|
|
146
150
|
}
|
|
147
|
-
getIndentChar(
|
|
148
|
-
return options.useTabs ? " " : " ".repeat(options.indentSize);
|
|
151
|
+
getIndentChar() {
|
|
152
|
+
return this.options.useTabs ? " ".repeat(this.options.indentSize) : " ".repeat(this.options.indentSize);
|
|
149
153
|
}
|
|
150
154
|
};
|
|
151
155
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nsis/dent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "An opinionated code formatter for NSIS scripts",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"scripts": {
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"formatter"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
+
"detect-newline": "^4.0.0",
|
|
41
42
|
"globby": "^13.1.4"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"@types/node": "^20.2.1",
|
|
45
46
|
"@typescript-eslint/eslint-plugin": "^5.59.6",
|
|
46
47
|
"@typescript-eslint/parser": "^5.59.6",
|
|
47
|
-
"detect-newline": "^4.0.0",
|
|
48
48
|
"esbuild": "^0.17.19",
|
|
49
49
|
"eslint": "^8.41.0",
|
|
50
50
|
"eslint-plugin-json": "^3.1.0",
|