@cilix/lightjs 0.0.19 → 0.0.21
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/cli.js +6 -4
- package/core.js +9 -8
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -154,21 +154,23 @@ for (let i = 0; i < process.argv.length; i++) {
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
const PORT = process.env.PORT || config.port || 4477;
|
|
158
|
+
|
|
157
159
|
if (config.serve) {
|
|
158
160
|
http.createServer(light.router({
|
|
159
161
|
publicDir: config.publicDir || '.',
|
|
160
162
|
minify: true,
|
|
161
163
|
cache: true,
|
|
162
164
|
routes: config.routes
|
|
163
|
-
})).listen(
|
|
164
|
-
console.log(
|
|
165
|
+
})).listen(PORT, () => {
|
|
166
|
+
console.log(`Listening on port ${PORT}`);
|
|
165
167
|
});
|
|
166
168
|
} else if (config.dev) {
|
|
167
169
|
http.createServer(light.router({
|
|
168
170
|
publicDir: config.publicDir || '.',
|
|
169
171
|
routes: config.routes
|
|
170
|
-
})).listen(
|
|
171
|
-
console.log(
|
|
172
|
+
})).listen(PORT, () => {
|
|
173
|
+
console.log(`Listening on port ${PORT}`);
|
|
172
174
|
});
|
|
173
175
|
} else if (config.create) {
|
|
174
176
|
const p = path.resolve(dir, config.create);
|
package/core.js
CHANGED
|
@@ -439,7 +439,12 @@ module.exports = (config, fs, path) => {
|
|
|
439
439
|
let in_expr = false;
|
|
440
440
|
let pos = cursor;
|
|
441
441
|
while (i < max) {
|
|
442
|
-
if (text[i] === "{" && text[i+1] === "{" && in_expr === false
|
|
442
|
+
if (text[i] === "{" && text[i+1] === "{" && in_expr === false) {
|
|
443
|
+
if (text[i-1] === '\\') {
|
|
444
|
+
chunk = chunk.slice(0, -1);
|
|
445
|
+
chunk += text[i++];
|
|
446
|
+
continue;
|
|
447
|
+
}
|
|
443
448
|
in_expr = true;
|
|
444
449
|
chunks.push({ type: "chunk", data: chunk, pos: pos, file: file });
|
|
445
450
|
chunk = "{{";
|
|
@@ -635,13 +640,9 @@ module.exports = (config, fs, path) => {
|
|
|
635
640
|
* bad (incorrect token position) due to newline magic above */
|
|
636
641
|
tokens.push({ type: 'string', pos: offs + cursor, file: file });
|
|
637
642
|
let chunks = break_into_chunks(text, cursor);
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
});
|
|
642
|
-
} else {
|
|
643
|
-
tokens.push({ type: 'chunk', data: text, pos: offs + cursor, file: file })
|
|
644
|
-
}
|
|
643
|
+
chunks.forEach(function(c) {
|
|
644
|
+
tokens.push(c);
|
|
645
|
+
});
|
|
645
646
|
/*
|
|
646
647
|
tokens.push({ type: 'string', pos: offs + cursor, file: file });
|
|
647
648
|
tokens.push({ type: 'chunk', data: text, pos: offs + cursor, file: file })
|