@normed/bundle 4.2.2 → 4.3.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 +8 -0
- package/bundles/bin/cli.js +33 -20
- package/bundles/bin/cli.js.map +3 -3
- package/bundles/index.js +33 -20
- package/bundles/index.js.map +3 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,14 @@ Given a version number MAJOR.MINOR.PATCH, increment the:
|
|
|
6
6
|
2. MINOR version when you add functionality in a backwards compatible manner, and
|
|
7
7
|
3. PATCH version when you make backwards compatible bug fixes.
|
|
8
8
|
|
|
9
|
+
# 4.3.1
|
|
10
|
+
|
|
11
|
+
* MINOR: Fixes artefact check for building less files (resolves unexpected artefact / missing artefact).
|
|
12
|
+
|
|
13
|
+
# 4.3.0
|
|
14
|
+
|
|
15
|
+
* MINOR: Adds the escape filter (:escape) which escapes HTML.
|
|
16
|
+
|
|
9
17
|
# 4.2.2
|
|
10
18
|
|
|
11
19
|
* PATCH: Fixes bug where pug files will not build if they have a `script` element with no attributes.
|
package/bundles/bin/cli.js
CHANGED
|
@@ -34664,15 +34664,15 @@ var require_pug_parser = __commonJS({
|
|
|
34664
34664
|
column: tok.loc.start.column,
|
|
34665
34665
|
filename: this.filename
|
|
34666
34666
|
};
|
|
34667
|
-
var
|
|
34667
|
+
var filters2 = [];
|
|
34668
34668
|
while (this.peek().type === "filter") {
|
|
34669
|
-
|
|
34669
|
+
filters2.push(this.parseIncludeFilter());
|
|
34670
34670
|
}
|
|
34671
34671
|
var path12 = this.expect("path");
|
|
34672
34672
|
node.file.path = path12.val.trim();
|
|
34673
34673
|
node.file.line = path12.loc.start.line;
|
|
34674
34674
|
node.file.column = path12.loc.start.column;
|
|
34675
|
-
if ((/\.jade$/.test(node.file.path) || /\.pug$/.test(node.file.path)) && !
|
|
34675
|
+
if ((/\.jade$/.test(node.file.path) || /\.pug$/.test(node.file.path)) && !filters2.length) {
|
|
34676
34676
|
node.block = "indent" == this.peek().type ? this.block() : this.emptyBlock(tok.loc.start.line);
|
|
34677
34677
|
if (/\.jade$/.test(node.file.path)) {
|
|
34678
34678
|
console.warn(
|
|
@@ -34681,7 +34681,7 @@ var require_pug_parser = __commonJS({
|
|
|
34681
34681
|
}
|
|
34682
34682
|
} else {
|
|
34683
34683
|
node.type = "RawInclude";
|
|
34684
|
-
node.filters =
|
|
34684
|
+
node.filters = filters2;
|
|
34685
34685
|
if (this.peek().type === "indent") {
|
|
34686
34686
|
this.error(
|
|
34687
34687
|
"RAW_INCLUDE_BLOCK",
|
|
@@ -65893,14 +65893,14 @@ var require_handle_filters = __commonJS({
|
|
|
65893
65893
|
var error = require_lib5();
|
|
65894
65894
|
var runFilter = require_run_filter();
|
|
65895
65895
|
module2.exports = handleFilters;
|
|
65896
|
-
function handleFilters(ast,
|
|
65896
|
+
function handleFilters(ast, filters2, options2, filterAliases) {
|
|
65897
65897
|
options2 = options2 || {};
|
|
65898
65898
|
walk(
|
|
65899
65899
|
ast,
|
|
65900
65900
|
function(node) {
|
|
65901
65901
|
var dir = node.filename ? dirname(node.filename) : null;
|
|
65902
65902
|
if (node.type === "Filter") {
|
|
65903
|
-
handleNestedFilters(node,
|
|
65903
|
+
handleNestedFilters(node, filters2, options2, filterAliases);
|
|
65904
65904
|
var text = getBodyAsText(node);
|
|
65905
65905
|
var attrs = getAttributes(node, options2);
|
|
65906
65906
|
attrs.filename = node.filename;
|
|
@@ -65928,8 +65928,8 @@ var require_handle_filters = __commonJS({
|
|
|
65928
65928
|
function filterWithFallback(filter2, text2, attrs2, funcName) {
|
|
65929
65929
|
try {
|
|
65930
65930
|
var filterName = getFilterName(filter2);
|
|
65931
|
-
if (
|
|
65932
|
-
return
|
|
65931
|
+
if (filters2 && filters2[filterName]) {
|
|
65932
|
+
return filters2[filterName](text2, attrs2);
|
|
65933
65933
|
} else {
|
|
65934
65934
|
return runFilter(filterName, text2, attrs2, dir, funcName);
|
|
65935
65935
|
}
|
|
@@ -65942,11 +65942,11 @@ var require_handle_filters = __commonJS({
|
|
|
65942
65942
|
}
|
|
65943
65943
|
function filterFileWithFallback(filter2, filename2, file, attrs2) {
|
|
65944
65944
|
var filterName = getFilterName(filter2);
|
|
65945
|
-
if (
|
|
65946
|
-
if (
|
|
65947
|
-
return
|
|
65945
|
+
if (filters2 && filters2[filterName]) {
|
|
65946
|
+
if (filters2[filterName].renderBuffer) {
|
|
65947
|
+
return filters2[filterName].renderBuffer(file.raw, attrs2);
|
|
65948
65948
|
} else {
|
|
65949
|
-
return
|
|
65949
|
+
return filters2[filterName](file.str, attrs2);
|
|
65950
65950
|
}
|
|
65951
65951
|
} else {
|
|
65952
65952
|
return filterWithFallback(filter2, filename2, attrs2, "renderFile");
|
|
@@ -65971,11 +65971,11 @@ var require_handle_filters = __commonJS({
|
|
|
65971
65971
|
}
|
|
65972
65972
|
return ast;
|
|
65973
65973
|
}
|
|
65974
|
-
function handleNestedFilters(node,
|
|
65974
|
+
function handleNestedFilters(node, filters2, options2, filterAliases) {
|
|
65975
65975
|
if (node.block.nodes[0] && node.block.nodes[0].type === "Filter") {
|
|
65976
65976
|
node.block.nodes[0] = handleFilters(
|
|
65977
65977
|
node.block,
|
|
65978
|
-
|
|
65978
|
+
filters2,
|
|
65979
65979
|
options2,
|
|
65980
65980
|
filterAliases
|
|
65981
65981
|
).nodes[0];
|
|
@@ -68089,7 +68089,7 @@ var require_lib14 = __commonJS({
|
|
|
68089
68089
|
var stripComments = require_pug_strip_comments();
|
|
68090
68090
|
var parse = require_pug_parser();
|
|
68091
68091
|
var load = require_pug_load();
|
|
68092
|
-
var
|
|
68092
|
+
var filters2 = require_pug_filters();
|
|
68093
68093
|
var link = require_pug_linker();
|
|
68094
68094
|
var generateCode = require_pug_code_gen();
|
|
68095
68095
|
var runtime = require_pug_runtime();
|
|
@@ -68210,7 +68210,7 @@ var require_lib14 = __commonJS({
|
|
|
68210
68210
|
filtersSet[key] = options2.filters[key];
|
|
68211
68211
|
});
|
|
68212
68212
|
}
|
|
68213
|
-
ast =
|
|
68213
|
+
ast = filters2.handleFilters(
|
|
68214
68214
|
ast,
|
|
68215
68215
|
filtersSet,
|
|
68216
68216
|
options2.filterOptions,
|
|
@@ -69132,6 +69132,11 @@ var load_less_default = plugin;
|
|
|
69132
69132
|
var import_pug = __toESM(require_lib14());
|
|
69133
69133
|
var import_fs4 = __toESM(require("fs"));
|
|
69134
69134
|
var import_path5 = __toESM(require("path"));
|
|
69135
|
+
var filters = {
|
|
69136
|
+
escape: (str) => {
|
|
69137
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
69138
|
+
}
|
|
69139
|
+
};
|
|
69135
69140
|
function pugTransformer(test, onFound) {
|
|
69136
69141
|
return {
|
|
69137
69142
|
preCodeGen(ast) {
|
|
@@ -69168,7 +69173,8 @@ async function loadAsJS2(filepath, options2) {
|
|
|
69168
69173
|
const contents = "export default " + import_pug.default.compileClient(fileData, {
|
|
69169
69174
|
name: "render",
|
|
69170
69175
|
filename: filepath,
|
|
69171
|
-
basedir: options2.outbase
|
|
69176
|
+
basedir: options2.outbase,
|
|
69177
|
+
filters
|
|
69172
69178
|
});
|
|
69173
69179
|
return {
|
|
69174
69180
|
contents,
|
|
@@ -69185,7 +69191,8 @@ async function loadAsHtml(filepath, options2) {
|
|
|
69185
69191
|
pugTransformer(isScriptNodeWithSrcAttr, (nodes) => {
|
|
69186
69192
|
nodes;
|
|
69187
69193
|
})
|
|
69188
|
-
]
|
|
69194
|
+
],
|
|
69195
|
+
filters
|
|
69189
69196
|
});
|
|
69190
69197
|
return {
|
|
69191
69198
|
contents,
|
|
@@ -69202,7 +69209,8 @@ async function loadAsEntrypoint(filepath, options2) {
|
|
|
69202
69209
|
pugTransformer(isScriptNodeWithSrcAttr, (nodes) => {
|
|
69203
69210
|
nodes;
|
|
69204
69211
|
})
|
|
69205
|
-
]
|
|
69212
|
+
],
|
|
69213
|
+
filters
|
|
69206
69214
|
});
|
|
69207
69215
|
return {
|
|
69208
69216
|
contents,
|
|
@@ -69214,7 +69222,8 @@ async function loadAsFile(filepath, options2) {
|
|
|
69214
69222
|
const contents = import_pug.default.render(fileData, {
|
|
69215
69223
|
name: "render",
|
|
69216
69224
|
filename: filepath,
|
|
69217
|
-
basedir: options2.outbase
|
|
69225
|
+
basedir: options2.outbase,
|
|
69226
|
+
filters
|
|
69218
69227
|
});
|
|
69219
69228
|
return {
|
|
69220
69229
|
contents,
|
|
@@ -69390,6 +69399,10 @@ var esbuilder = {
|
|
|
69390
69399
|
if (jsTypeFile.test(ext)) {
|
|
69391
69400
|
return jsOutExt;
|
|
69392
69401
|
}
|
|
69402
|
+
switch (ext) {
|
|
69403
|
+
case "less":
|
|
69404
|
+
return "css";
|
|
69405
|
+
}
|
|
69393
69406
|
return ext;
|
|
69394
69407
|
};
|
|
69395
69408
|
const exampleFile = build2[0];
|