@takeshape/ssg 9.103.28 → 9.104.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/nunjucks.d.ts +0 -1
- package/dist/nunjucks.d.ts.map +1 -1
- package/dist/nunjucks.js +2 -6
- package/es/nunjucks.js +2 -5
- package/package.json +5 -5
package/dist/nunjucks.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import TemplateRenderError from './errors/template-render-error';
|
|
2
2
|
import { RenderTemplate, Stats } from './types';
|
|
3
3
|
import { Config, SyncFileLoader } from './config';
|
|
4
|
-
export declare function fixPrototype<T>(obj: T): T;
|
|
5
4
|
export declare function formatError(error: Error): TemplateRenderError;
|
|
6
5
|
export type TemplateContext = Record<string, any>;
|
|
7
6
|
export type NunjucksRender = (templateName: string, context: TemplateContext) => Promise<string>;
|
package/dist/nunjucks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nunjucks.d.ts","sourceRoot":"","sources":["../../src/nunjucks.ts"],"names":[],"mappings":"AACA,OAAO,mBAAmB,MAAM,gCAAgC,CAAC;AAYjE,OAAO,EAAmB,cAAc,EAAgB,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAC,MAAM,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"nunjucks.d.ts","sourceRoot":"","sources":["../../src/nunjucks.ts"],"names":[],"mappings":"AACA,OAAO,mBAAmB,MAAM,gCAAgC,CAAC;AAYjE,OAAO,EAAmB,cAAc,EAAgB,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9E,OAAO,EAAC,MAAM,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;AAkBhD,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,mBAAmB,CAM7D;AAmBD,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;AAmBjG,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,cAAc,CAkChH"}
|
package/dist/nunjucks.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = nunjucksFactory;
|
|
7
|
-
exports.fixPrototype = fixPrototype;
|
|
8
7
|
exports.formatError = formatError;
|
|
9
8
|
var _path = _interopRequireDefault(require("path"));
|
|
10
9
|
var _templateRenderError = _interopRequireDefault(require("./errors/template-render-error"));
|
|
@@ -19,11 +18,8 @@ var _pluralizeFilter = _interopRequireDefault(require("./filters/pluralize-filte
|
|
|
19
18
|
var _arrayFilters = require("./filters/array-filters");
|
|
20
19
|
var _paths = require("./paths");
|
|
21
20
|
var _vmNunjucks = _interopRequireDefault(require("@takeshape/vm-nunjucks"));
|
|
21
|
+
var _util = require("@takeshape/util");
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
function fixPrototype(obj) {
|
|
24
|
-
// This is a hack because nunjucks doesn't support objects without a prototype
|
|
25
|
-
return JSON.parse(JSON.stringify(obj));
|
|
26
|
-
}
|
|
27
23
|
function parseLocation(line) {
|
|
28
24
|
const groups = /\(([^)]+)\)(?: \[Line (\d+)(?:, Column (\d+))?])?/.exec(line);
|
|
29
25
|
if (groups) {
|
|
@@ -93,7 +89,7 @@ function nunjucksFactory(fileLoader, config, stats) {
|
|
|
93
89
|
stats.pagesGenerated++;
|
|
94
90
|
return {
|
|
95
91
|
path: (0, _paths.permalink)(path),
|
|
96
|
-
contents: await render(template,
|
|
92
|
+
contents: await render(template, (0, _util.deepClone)(context))
|
|
97
93
|
};
|
|
98
94
|
} catch (e) {
|
|
99
95
|
throw e instanceof _templateRenderError.default ? e : formatError(e);
|
package/es/nunjucks.js
CHANGED
|
@@ -11,10 +11,7 @@ import pluralizeFilter from './filters/pluralize-filter';
|
|
|
11
11
|
import { intersectionFilter, unionFilter } from './filters/array-filters';
|
|
12
12
|
import { permalink } from './paths';
|
|
13
13
|
import nunjucks from '@takeshape/vm-nunjucks';
|
|
14
|
-
|
|
15
|
-
// This is a hack because nunjucks doesn't support objects without a prototype
|
|
16
|
-
return JSON.parse(JSON.stringify(obj));
|
|
17
|
-
}
|
|
14
|
+
import { deepClone } from '@takeshape/util';
|
|
18
15
|
function parseLocation(line) {
|
|
19
16
|
const groups = /\(([^)]+)\)(?: \[Line (\d+)(?:, Column (\d+))?])?/.exec(line);
|
|
20
17
|
if (groups) {
|
|
@@ -84,7 +81,7 @@ export default function nunjucksFactory(fileLoader, config, stats) {
|
|
|
84
81
|
stats.pagesGenerated++;
|
|
85
82
|
return {
|
|
86
83
|
path: permalink(path),
|
|
87
|
-
contents: await render(template,
|
|
84
|
+
contents: await render(template, deepClone(context))
|
|
88
85
|
};
|
|
89
86
|
} catch (e) {
|
|
90
87
|
throw e instanceof TemplateRenderError ? e : formatError(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takeshape/ssg",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.104.0",
|
|
4
4
|
"description": "Static Site Generator",
|
|
5
5
|
"homepage": "https://www.takeshape.io",
|
|
6
6
|
"repository": {
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"prismjs": "^1.22.0",
|
|
40
40
|
"pumpify": "^2.0.1",
|
|
41
41
|
"resolve": "^1.19.0",
|
|
42
|
-
"@takeshape/
|
|
43
|
-
"@takeshape/
|
|
44
|
-
"@takeshape/
|
|
42
|
+
"@takeshape/streams": "9.104.0",
|
|
43
|
+
"@takeshape/routing": "9.104.0",
|
|
44
|
+
"@takeshape/util": "9.104.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/bluebird": "^3.5.33",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@types/prismjs": "^1.16.2",
|
|
58
58
|
"@types/pumpify": "^1.4.1",
|
|
59
59
|
"graphql-type-json": "^0.3.2",
|
|
60
|
-
"@takeshape/typescript-jest-junit-reporter": "9.
|
|
60
|
+
"@takeshape/typescript-jest-junit-reporter": "9.104.0"
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=16"
|