njk-tool 0.0.1 → 0.0.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/bundle/app.min.js
CHANGED
|
@@ -6,6 +6,8 @@ import require$$0$3 from 'path';
|
|
|
6
6
|
import require$$2 from 'util';
|
|
7
7
|
import require$$1 from 'stream';
|
|
8
8
|
import require$$2$1 from 'os';
|
|
9
|
+
import { join } from 'node:path';
|
|
10
|
+
import { fileURLToPath } from 'node:url';
|
|
9
11
|
|
|
10
12
|
/******************************************************************************
|
|
11
13
|
Copyright (c) Microsoft Corporation.
|
|
@@ -13326,13 +13328,16 @@ var TagType;
|
|
|
13326
13328
|
TagType["Table"] = "table";
|
|
13327
13329
|
})(TagType || (TagType = {}));
|
|
13328
13330
|
|
|
13329
|
-
const externalTemplatesDir = `${
|
|
13331
|
+
const externalTemplatesDir = fileURLToPath(new URL("../bundle/src", `${import.meta.url}`));
|
|
13330
13332
|
nunjucks.configure(externalTemplatesDir, {
|
|
13331
13333
|
autoescape: true,
|
|
13332
13334
|
noCache: true
|
|
13333
13335
|
});
|
|
13334
|
-
const BASE_STYLE_PATH =
|
|
13335
|
-
const TEMPLATES_DIR =
|
|
13336
|
+
const BASE_STYLE_PATH = join(externalTemplatesDir, "base.style");
|
|
13337
|
+
const TEMPLATES_DIR = join(externalTemplatesDir, "index.html");
|
|
13338
|
+
console.log({ externalTemplatesDir });
|
|
13339
|
+
console.log({ BASE_STYLE_PATH });
|
|
13340
|
+
console.log({ TEMPLATES_DIR });
|
|
13336
13341
|
const loadStyle = (basePath) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13337
13342
|
try {
|
|
13338
13343
|
return yield import('fs/promises').then(({ readFile }) => readFile(basePath, "utf8"));
|
|
@@ -13397,7 +13402,7 @@ const njkRenderSync = (config, options = {}) => {
|
|
|
13397
13402
|
const processedConfig = Array.isArray(config)
|
|
13398
13403
|
? processConfig(config, cssUrl)
|
|
13399
13404
|
: processConfig([config], cssUrl);
|
|
13400
|
-
const html = nunjucks.render(
|
|
13405
|
+
const html = nunjucks.render('index.html', {
|
|
13401
13406
|
ctx: processedConfig,
|
|
13402
13407
|
});
|
|
13403
13408
|
return getStyleContent({ isAsync: true }) + html;
|