littoral-templates 0.4.0 → 0.4.1
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/CHANGELOG.md +7 -1
- package/dist/eol.d.ts +1 -1
- package/dist/eol.d.ts.map +1 -1
- package/dist/eol.js +4 -48
- package/dist/eol.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.4.1
|
4
|
+
|
5
|
+
* The `setEOLStyleFromOS` is now synchronous.
|
6
|
+
This might cause warnings in existing code, but makes the function easier to work with.
|
7
|
+
|
8
|
+
|
3
9
|
## 0.4.0
|
4
10
|
|
5
11
|
* Thunks returning a `Template` are now `Template`s as well.
|
@@ -10,7 +16,7 @@
|
|
10
16
|
* The `withNewlineAppended` function has been renamed to `withEmptyLineAppended`.
|
11
17
|
(The former is kept as a legacy alias.)
|
12
18
|
* An object constant `commonIndentations` is added and exposed which holds the most common indentation styles: “2 spaces”, “4 spaces”, and “1 tab”.
|
13
|
-
*
|
19
|
+
* Significant updates to the [README](./README.md)!
|
14
20
|
|
15
21
|
*Note*: `asString` now behaves more consistently on EOLs, meaning that existing templates might behave differently, particularly when using multi-line strings (nested) inside templates.
|
16
22
|
(Also see the updated [README](./README.md).)
|
package/dist/eol.d.ts
CHANGED
@@ -15,7 +15,7 @@ export declare let eol: string;
|
|
15
15
|
/**
|
16
16
|
* Sets the EOL to the OS-dependent value.
|
17
17
|
*/
|
18
|
-
export declare const setEOLStyleFromOS: () =>
|
18
|
+
export declare const setEOLStyleFromOS: () => void;
|
19
19
|
/**
|
20
20
|
* Sets the EOL explicitly to the given value.
|
21
21
|
* (This is especially useful for testing.)
|
package/dist/eol.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"eol.d.ts","sourceRoot":"","sources":["../src/eol.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
1
|
+
{"version":3,"file":"eol.d.ts","sourceRoot":"","sources":["../src/eol.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,eAAO,MAAM,SAAS;;;CAGZ,CAAA;AAGV;;GAEG;AACH,eAAO,IAAI,GAAG,EAAE,MAAqB,CAAA;AAGrC;;GAEG;AACH,eAAO,MAAM,iBAAiB,YAE7B,CAAA;AAGD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,WAAY,MAAM,SAE9C,CAAA;AAKD;;;GAGG;AACH,eAAO,MAAM,UAAU,QAAS,MAAM,KAAG,MAAM,EACtB,CAAA"}
|
package/dist/eol.js
CHANGED
@@ -1,42 +1,7 @@
|
|
1
1
|
/**
|
2
2
|
* EOL-related constants and functions.
|
3
3
|
*/
|
4
|
-
|
5
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
6
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
7
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
8
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
9
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
10
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
11
|
-
});
|
12
|
-
};
|
13
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
14
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
15
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
16
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
17
|
-
function step(op) {
|
18
|
-
if (f) throw new TypeError("Generator is already executing.");
|
19
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
20
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
21
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
22
|
-
switch (op[0]) {
|
23
|
-
case 0: case 1: t = op; break;
|
24
|
-
case 4: _.label++; return { value: op[1], done: false };
|
25
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
26
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
27
|
-
default:
|
28
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
29
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
30
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
31
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
32
|
-
if (t[2]) _.ops.pop();
|
33
|
-
_.trys.pop(); continue;
|
34
|
-
}
|
35
|
-
op = body.call(thisArg, _);
|
36
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
37
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
38
|
-
}
|
39
|
-
};
|
4
|
+
import { EOL } from "os";
|
40
5
|
/**
|
41
6
|
* Common EOL styles.
|
42
7
|
*/
|
@@ -51,18 +16,9 @@ export var eol = eolStyles.lf;
|
|
51
16
|
/**
|
52
17
|
* Sets the EOL to the OS-dependent value.
|
53
18
|
*/
|
54
|
-
export var setEOLStyleFromOS = function () {
|
55
|
-
|
56
|
-
|
57
|
-
eol = os.EOL;
|
58
|
-
})
|
59
|
-
/**
|
60
|
-
* Sets the EOL explicitly to the given value.
|
61
|
-
* (This is especially useful for testing.)
|
62
|
-
*/
|
63
|
-
];
|
64
|
-
});
|
65
|
-
}); };
|
19
|
+
export var setEOLStyleFromOS = function () {
|
20
|
+
eol = EOL;
|
21
|
+
};
|
66
22
|
/**
|
67
23
|
* Sets the EOL explicitly to the given value.
|
68
24
|
* (This is especially useful for testing.)
|
package/dist/eol.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"eol.js","sourceRoot":"","sources":["../src/eol.ts"],"names":[],"mappings":"AAAA;;GAEG
|
1
|
+
{"version":3,"file":"eol.js","sourceRoot":"","sources":["../src/eol.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,GAAG,EAAC,MAAM,IAAI,CAAA;AAEtB;;GAEG;AACH,MAAM,CAAC,IAAM,SAAS,GAAG;IACrB,EAAE,EAAE,IAAI;IACR,IAAI,EAAE,MAAM;CACN,CAAA;AAGV;;GAEG;AACH,MAAM,CAAC,IAAI,GAAG,GAAW,SAAS,CAAC,EAAE,CAAA;AAGrC;;GAEG;AACH,MAAM,CAAC,IAAM,iBAAiB,GAAG;IAC7B,GAAG,GAAG,GAAG,CAAA;AACb,CAAC,CAAA;AAGD;;;GAGG;AACH,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAAC,MAAc;IAC3C,GAAG,GAAG,MAAM,CAAA;AAChB,CAAC,CAAA;AAGD,IAAM,UAAU,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAA;AAEtC;;;GAGG;AACH,MAAM,CAAC,IAAM,UAAU,GAAG,UAAC,GAAW;IAClC,OAAA,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC;AAArB,CAAqB,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "littoral-templates",
|
3
|
-
"version": "0.4.
|
3
|
+
"version": "0.4.1",
|
4
4
|
"description": "A small JavaScript/TypeScript framework to do templating comfortably using the template literal syntax in either JavaScript or TypeScript.",
|
5
5
|
"type": "module",
|
6
6
|
"main": "dist/index.js",
|