@kosatyi/ejs 0.0.110 → 0.0.112
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/cjs/browser.js +297 -200
- package/dist/cjs/bundler.js +9 -1
- package/dist/cjs/element.js +1 -1
- package/dist/cjs/index.js +363 -277
- package/dist/cjs/worker.js +304 -224
- package/dist/esm/browser.js +78 -63
- package/dist/esm/bundler.js +9 -1
- package/dist/esm/index.js +196 -192
- package/dist/esm/worker.js +82 -84
- package/dist/umd/browser.js +834 -737
- package/dist/umd/browser.min.js +1 -1
- package/dist/umd/element.js +1 -1
- package/dist/umd/element.min.js +1 -1
- package/dist/umd/index.js +853 -767
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/worker.js +304 -224
- package/dist/umd/worker.min.js +1 -1
- package/package.json +4 -4
- package/types/context.d.ts +19 -4
- package/types/ejs.d.ts +4 -2
- package/types/error.d.ts +5 -2
- package/types/worker.d.ts +0 -6
- package/dist/kosatyi-ejs-0.0.109.tgz +0 -0
- package/dist/umd/browser.js.map +0 -7
- package/dist/umd/browser.min.js.map +0 -7
package/dist/cjs/bundler.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
var fs = require('node:fs/promises');
|
|
4
4
|
var globWatch = require('glob-watcher');
|
|
5
5
|
var node_path = require('node:path');
|
|
6
|
-
var index_js = require('./index.js');
|
|
7
6
|
var glob = require('glob');
|
|
7
|
+
var index_js = require('./index.js');
|
|
8
8
|
|
|
9
9
|
const symbolEntities = {
|
|
10
10
|
"'": "'",
|
|
@@ -51,6 +51,7 @@ class EjsBundler {
|
|
|
51
51
|
#ejsOptions
|
|
52
52
|
#buildInProgress
|
|
53
53
|
static exports = ['build', 'watch', 'concat', 'output']
|
|
54
|
+
|
|
54
55
|
constructor(bundlerOptions = {}, ejsOptions = {}) {
|
|
55
56
|
bindContext(this, this.constructor.exports);
|
|
56
57
|
const { compile, configure } = index_js.create(ejsOptions);
|
|
@@ -60,14 +61,17 @@ class EjsBundler {
|
|
|
60
61
|
this.#buildInProgress = false;
|
|
61
62
|
this.#templates = {};
|
|
62
63
|
}
|
|
64
|
+
|
|
63
65
|
async #stageRead(path) {
|
|
64
66
|
return fs
|
|
65
67
|
.readFile(node_path.join(this.#ejsOptions.path, path))
|
|
66
68
|
.then((response) => response.toString())
|
|
67
69
|
}
|
|
70
|
+
|
|
68
71
|
#stageCompile(content, name) {
|
|
69
72
|
return this.#compile(content, name).source
|
|
70
73
|
}
|
|
74
|
+
|
|
71
75
|
#getBundle() {
|
|
72
76
|
const umd = this.#bundlerOptions.umd;
|
|
73
77
|
const strict = this.#ejsOptions.strict;
|
|
@@ -102,6 +106,7 @@ class EjsBundler {
|
|
|
102
106
|
}
|
|
103
107
|
return out.join('\n')
|
|
104
108
|
}
|
|
109
|
+
|
|
105
110
|
async build() {
|
|
106
111
|
if (this.#buildInProgress === true) return false
|
|
107
112
|
this.#buildInProgress = true;
|
|
@@ -110,6 +115,7 @@ class EjsBundler {
|
|
|
110
115
|
console.log('✅', 'bundle complete:', this.#bundlerOptions.target);
|
|
111
116
|
this.#buildInProgress = false;
|
|
112
117
|
}
|
|
118
|
+
|
|
113
119
|
async watch() {
|
|
114
120
|
console.log('🔍', 'watch directory:', this.#ejsOptions.path);
|
|
115
121
|
const pattern = '**/*.'.concat(this.#ejsOptions.extension);
|
|
@@ -130,6 +136,7 @@ class EjsBundler {
|
|
|
130
136
|
});
|
|
131
137
|
});
|
|
132
138
|
}
|
|
139
|
+
|
|
133
140
|
async concat() {
|
|
134
141
|
const pattern = '**/*.'.concat(this.#ejsOptions.extension);
|
|
135
142
|
const list = await glob.glob(
|
|
@@ -144,6 +151,7 @@ class EjsBundler {
|
|
|
144
151
|
this.#templates[template] = content;
|
|
145
152
|
}
|
|
146
153
|
}
|
|
154
|
+
|
|
147
155
|
async output() {
|
|
148
156
|
const target = [].concat(this.#bundlerOptions.target);
|
|
149
157
|
const content = this.#getBundle();
|
package/dist/cjs/element.js
CHANGED
|
@@ -44,7 +44,7 @@ const eachAttribute = _ref => {
|
|
|
44
44
|
const element = (tag, attrs, content) => {
|
|
45
45
|
const result = [];
|
|
46
46
|
const hasClosedTag = selfClosed.indexOf(tag) === -1;
|
|
47
|
-
const attributes = Object.entries(attrs
|
|
47
|
+
const attributes = Object.entries(attrs !== null && attrs !== void 0 ? attrs : {}).map(eachAttribute).filter(e => e).join(space);
|
|
48
48
|
result.push([lt, tag, space, attributes, gt].join(''));
|
|
49
49
|
if (content && hasClosedTag) {
|
|
50
50
|
result.push(Array.isArray(content) ? content.join('') : content);
|