@prostojs/rewrite 0.2.2 → 0.2.3
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.cjs +6 -6
- package/dist/index.mjs +6 -6
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -142,7 +142,7 @@ function escapeRegex(s) {
|
|
|
142
142
|
return s.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
143
143
|
}
|
|
144
144
|
function debug(message) {
|
|
145
|
-
console.log(
|
|
145
|
+
console.log("\x1B[33m\x1B[1m\x1B[2m[rewrite] DEBUG: " + message + "\x1B[0m");
|
|
146
146
|
}
|
|
147
147
|
//#endregion
|
|
148
148
|
//#region src/rw-common.ts
|
|
@@ -241,7 +241,7 @@ function throwErrorFromFunction(e, code) {
|
|
|
241
241
|
const row = parseInt(match[1], 10) - 2;
|
|
242
242
|
const col = parseInt(match[2], 10) - 1;
|
|
243
243
|
const output = renderCodeFragmentSimple(code.split("\n"), row, col);
|
|
244
|
-
console.error(
|
|
244
|
+
console.error("\x1B[91m" + e.message + "\x1B[39m");
|
|
245
245
|
console.error(output);
|
|
246
246
|
}
|
|
247
247
|
throw e;
|
|
@@ -792,15 +792,15 @@ var ProstoRewrite = class {
|
|
|
792
792
|
const mode = this.determineMode(opts.mode || this.options.defaultMode, opts.input, file);
|
|
793
793
|
let output = file;
|
|
794
794
|
if (mode) {
|
|
795
|
-
this.debug("Parsing file in " + mode + " mode. " +
|
|
795
|
+
this.debug("Parsing file in " + mode + " mode. \x1B[4m\x1B[22m" + opts.input);
|
|
796
796
|
output = this.mixedRewriter[mode].rewrite(file, context);
|
|
797
|
-
} else this.debug("File isn't recognized as text nor as html. " +
|
|
797
|
+
} else this.debug("File isn't recognized as text nor as html. \x1B[4m\x1B[22m" + opts.input);
|
|
798
798
|
if (opts.output) if (mode) {
|
|
799
799
|
await writeFile(opts.output, output);
|
|
800
|
-
this.debug("File has been rewritten in " + mode + " mode. " +
|
|
800
|
+
this.debug("File has been rewritten in " + mode + " mode. \x1B[4m\x1B[22m" + opts.output);
|
|
801
801
|
} else {
|
|
802
802
|
await copyFile(opts.input, opts.output);
|
|
803
|
-
this.debug("File rewriting was skipped. File copied. " +
|
|
803
|
+
this.debug("File rewriting was skipped. File copied. \x1B[4m\x1B[22m" + opts.output);
|
|
804
804
|
}
|
|
805
805
|
return output;
|
|
806
806
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -141,7 +141,7 @@ function escapeRegex(s) {
|
|
|
141
141
|
return s.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
142
142
|
}
|
|
143
143
|
function debug(message) {
|
|
144
|
-
console.log(
|
|
144
|
+
console.log("\x1B[33m\x1B[1m\x1B[2m[rewrite] DEBUG: " + message + "\x1B[0m");
|
|
145
145
|
}
|
|
146
146
|
//#endregion
|
|
147
147
|
//#region src/rw-common.ts
|
|
@@ -240,7 +240,7 @@ function throwErrorFromFunction(e, code) {
|
|
|
240
240
|
const row = parseInt(match[1], 10) - 2;
|
|
241
241
|
const col = parseInt(match[2], 10) - 1;
|
|
242
242
|
const output = renderCodeFragmentSimple(code.split("\n"), row, col);
|
|
243
|
-
console.error(
|
|
243
|
+
console.error("\x1B[91m" + e.message + "\x1B[39m");
|
|
244
244
|
console.error(output);
|
|
245
245
|
}
|
|
246
246
|
throw e;
|
|
@@ -791,15 +791,15 @@ var ProstoRewrite = class {
|
|
|
791
791
|
const mode = this.determineMode(opts.mode || this.options.defaultMode, opts.input, file);
|
|
792
792
|
let output = file;
|
|
793
793
|
if (mode) {
|
|
794
|
-
this.debug("Parsing file in " + mode + " mode. " +
|
|
794
|
+
this.debug("Parsing file in " + mode + " mode. \x1B[4m\x1B[22m" + opts.input);
|
|
795
795
|
output = this.mixedRewriter[mode].rewrite(file, context);
|
|
796
|
-
} else this.debug("File isn't recognized as text nor as html. " +
|
|
796
|
+
} else this.debug("File isn't recognized as text nor as html. \x1B[4m\x1B[22m" + opts.input);
|
|
797
797
|
if (opts.output) if (mode) {
|
|
798
798
|
await writeFile(opts.output, output);
|
|
799
|
-
this.debug("File has been rewritten in " + mode + " mode. " +
|
|
799
|
+
this.debug("File has been rewritten in " + mode + " mode. \x1B[4m\x1B[22m" + opts.output);
|
|
800
800
|
} else {
|
|
801
801
|
await copyFile(opts.input, opts.output);
|
|
802
|
-
this.debug("File rewriting was skipped. File copied. " +
|
|
802
|
+
this.debug("File rewriting was skipped. File copied. \x1B[4m\x1B[22m" + opts.output);
|
|
803
803
|
}
|
|
804
804
|
return output;
|
|
805
805
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prostojs/rewrite",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Easy and light templates renderer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"prostojs",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"minimatch": "^10.2.4"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@prostojs/dye": "^0.4.
|
|
55
|
+
"@prostojs/dye": "^0.4.10",
|
|
56
56
|
"@types/node": "^20.19.35",
|
|
57
57
|
"conventional-changelog": "^5.1.0",
|
|
58
58
|
"conventional-changelog-cli": "^4.1.0",
|