mancha 0.3.11 → 0.3.13
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/browser.js +1 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -3
- package/dist/mancha.js +1 -1
- package/dist/web.d.ts +2 -0
- package/dist/web.js +22 -3
- package/package.json +1 -1
- package/yarn-error.log +3935 -0
package/dist/browser.js
CHANGED
|
@@ -14,12 +14,11 @@ const Mancha = require("./web.js");
|
|
|
14
14
|
self["Mancha"] = Mancha;
|
|
15
15
|
if ((_b = (_a = self.document) === null || _a === void 0 ? void 0 : _a.currentScript) === null || _b === void 0 ? void 0 : _b.hasAttribute("init")) {
|
|
16
16
|
const vars = JSON.parse(self.document.currentScript.dataset["vars"] || "{}");
|
|
17
|
-
const fsroot = self.location.href.split("/").slice(0, -1).join("/") + "/";
|
|
18
17
|
const attributes = Array.from(((_c = self.document.currentScript) === null || _c === void 0 ? void 0 : _c.attributes) || []).reduce((dict, attr) => Object.assign(dict, { [attr.name]: attr.value }), {});
|
|
19
18
|
const targets = ((_d = attributes["target"]) === null || _d === void 0 ? void 0 : _d.split(",")) || ["body"];
|
|
20
19
|
const renderings = targets.map((target) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
20
|
const node = self.document[target];
|
|
22
|
-
node.innerHTML = yield Mancha.renderContent(node.innerHTML, vars
|
|
21
|
+
node.innerHTML = yield Mancha.renderContent(node.innerHTML, vars);
|
|
23
22
|
}));
|
|
24
23
|
Promise.all(renderings).then(() => {
|
|
25
24
|
if (attributes["onrender"]) {
|
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export declare function renderLocalPath(fpath: string, vars?: {
|
|
|
5
5
|
export declare function renderContent(content: string, vars?: {
|
|
6
6
|
[key: string]: string;
|
|
7
7
|
}, fsroot?: string | null, maxdepth?: number): Promise<string>;
|
|
8
|
-
export { preprocess, renderRemotePath, encodeHtmlAttrib, decodeHtmlAttrib } from "./web";
|
|
8
|
+
export { preprocess, resolvePath, folderPath, renderRemotePath, encodeHtmlAttrib, decodeHtmlAttrib, } from "./web";
|
package/dist/index.js
CHANGED
|
@@ -9,14 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.decodeHtmlAttrib = exports.encodeHtmlAttrib = exports.renderRemotePath = exports.preprocess = exports.renderContent = exports.renderLocalPath = void 0;
|
|
12
|
+
exports.decodeHtmlAttrib = exports.encodeHtmlAttrib = exports.renderRemotePath = exports.folderPath = exports.resolvePath = exports.preprocess = exports.renderContent = exports.renderLocalPath = void 0;
|
|
13
13
|
const fs = require("fs/promises");
|
|
14
|
-
const path = require("path");
|
|
15
14
|
const web_1 = require("./web");
|
|
16
15
|
function renderLocalPath(fpath, vars = {}, encoding = "utf8") {
|
|
17
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18
17
|
const content = yield fs.readFile(fpath, { encoding: encoding });
|
|
19
|
-
return renderContent(content, vars,
|
|
18
|
+
return renderContent(content, vars, (0, web_1.folderPath)(fpath));
|
|
20
19
|
});
|
|
21
20
|
}
|
|
22
21
|
exports.renderLocalPath = renderLocalPath;
|
|
@@ -30,6 +29,8 @@ exports.renderContent = renderContent;
|
|
|
30
29
|
// Re-exports from web.
|
|
31
30
|
var web_2 = require("./web");
|
|
32
31
|
Object.defineProperty(exports, "preprocess", { enumerable: true, get: function () { return web_2.preprocess; } });
|
|
32
|
+
Object.defineProperty(exports, "resolvePath", { enumerable: true, get: function () { return web_2.resolvePath; } });
|
|
33
|
+
Object.defineProperty(exports, "folderPath", { enumerable: true, get: function () { return web_2.folderPath; } });
|
|
33
34
|
Object.defineProperty(exports, "renderRemotePath", { enumerable: true, get: function () { return web_2.renderRemotePath; } });
|
|
34
35
|
Object.defineProperty(exports, "encodeHtmlAttrib", { enumerable: true, get: function () { return web_2.encodeHtmlAttrib; } });
|
|
35
36
|
Object.defineProperty(exports, "decodeHtmlAttrib", { enumerable: true, get: function () { return web_2.decodeHtmlAttrib; } });
|