olum-compiler 0.2.3 → 0.2.7

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/bin/index.js CHANGED
@@ -18,7 +18,7 @@ process.on("unhandledRejection", err => {
18
18
  const requiredNodeMajorVer = +require("../package.json").engines.node.replace(/\<|\>|\=/gi,"").split(".")[0];
19
19
  const currentNodeMajorVer = +process.version.replace(/v/gi, "").split(".")[0];
20
20
  if (currentNodeMajorVer < requiredNodeMajorVer) {
21
- console.error(`\nYour node version is "${currentNodeMajorVer}" which is not compatible with 'olum-compiler', Please upgrade to "${requiredNodeMajorVer}"\n`);
21
+ console.error(`\nYour node version is "${currentNodeMajorVer}" which is not compatible with 'olum-compiler', Please upgrade to "${requiredNodeMajorVer}" or higher\n`);
22
22
  process.exit(1);
23
23
  }
24
24
 
package/compiler.js CHANGED
@@ -299,7 +299,15 @@ class Compiler {
299
299
  const template = isFullArr(tempArr) ? tempArr[0] : ""; // get 1st template tag as the order of component file
300
300
  const markup = template.replace(this.regex.template.tag, "");
301
301
  const cleanHTML = markup.replace(this.regex.template.comment, ""); // clean html from comments
302
- const html = "\n template() { \n return `" + cleanHTML + "`;\n}\n";
302
+ const html = `
303
+ template(arg) {
304
+ var olumTempOpeningTag = new RegExp("<[aA-zZ][\\\\s\\\\S]*?>");
305
+ var olumTempClosingTag = new RegExp("(</[aA-zZ]+>)$", "g");
306
+ var olumTemp = \`\n${cleanHTML}\n\`;
307
+ if (arg && arg === true) olumTemp = olumTemp.trim().replace(olumTempOpeningTag, '').replace(olumTempClosingTag, '');
308
+ return olumTemp;
309
+ }
310
+ `;
303
311
  resolve(html);
304
312
  });
305
313
  }
@@ -365,12 +373,12 @@ class Compiler {
365
373
  if (isFullArr(modulesNames) && isFullArr(componentsNames)) { // there are components
366
374
  debugLib("components exist");
367
375
  const finalNames = [];
368
- modulesNames.forEach(moduleName => componentsNames.forEach(compName => (moduleName !== "" && moduleName === compName) ? finalNames.push(moduleName) : null));
376
+ modulesNames.forEach(moduleName => componentsNames.forEach(compName => (moduleName !== "" && moduleName === compName) ? finalNames.push("{"+moduleName+"}") : null));
369
377
  dataMethod = `
370
378
  olumCompData() {
371
379
  return {
372
380
  name: "${className}",
373
- components: { ${finalNames.join(", ")} },
381
+ components: [ ${finalNames.join(", ")} ],
374
382
  template: this.template(),
375
383
  style: this.style(),
376
384
  render: this.render.bind(this),
@@ -383,7 +391,7 @@ class Compiler {
383
391
  olumCompData() {
384
392
  return {
385
393
  name: "${className}",
386
- components: {},
394
+ components: [],
387
395
  template: this.template(),
388
396
  style: this.style(),
389
397
  render: this.render.bind(this),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "olum-compiler",
3
- "version": "0.2.3",
3
+ "version": "0.2.7",
4
4
  "description": "A module for compiling/bundling olumjs projects",
5
5
  "main": "bin/index.js",
6
6
  "bin": {
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "homepage": "https://github.com/olumjs/olum-compiler#readme",
24
24
  "engines": {
25
- "node": ">=10"
25
+ "node": ">=14"
26
26
  },
27
27
  "dependencies": {
28
28
  "cross-spawn": "^7.0.3",
@@ -56,7 +56,8 @@
56
56
  "webpack-cli": "^4.5.0",
57
57
  "webpack-pwa-manifest": "^4.3.0",
58
58
  "workbox-webpack-plugin": "^6.1.5",
59
- "olum-devtool": "latest"
59
+ "olum-devtool": "latest",
60
+ "string-replace-loader": "^3.0.3"
60
61
  },
61
62
  "browserslist": [
62
63
  "last 2 version",