@sola-air-ui/compiler 1.0.4 → 1.0.5
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/package.json +3 -3
- package/src/cli.js +3 -1
- package/src/index.js +6 -1
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sola-air-ui/compiler",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Compiler for Sola single-file components (.sola) — transforms template + script + style to ES modules",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"sola": "
|
|
8
|
+
"sola": "src/cli.js"
|
|
9
9
|
},
|
|
10
10
|
"exports": {
|
|
11
11
|
".": "./src/index.js"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"homepage": "https://sola-air.dev",
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
28
|
-
"url": "https://github.com/rbm3267/sola-air"
|
|
28
|
+
"url": "git+https://github.com/rbm3267/sola-air.git"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"acorn": "^8.10.0",
|
package/src/cli.js
CHANGED
|
@@ -4,6 +4,8 @@ import fs from 'node:fs';
|
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import { compile } from './index.js';
|
|
6
6
|
|
|
7
|
+
const { version } = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
8
|
+
|
|
7
9
|
const args = process.argv.slice(2);
|
|
8
10
|
|
|
9
11
|
if (args.length === 0 || args.includes('-h') || args.includes('--help')) {
|
|
@@ -30,7 +32,7 @@ if (args.length === 0 || args.includes('-h') || args.includes('--help')) {
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
if (args.includes('-v') || args.includes('--version')) {
|
|
33
|
-
console.log(
|
|
35
|
+
console.log(`Sola Compiler v${version}`);
|
|
34
36
|
process.exit(0);
|
|
35
37
|
}
|
|
36
38
|
|
package/src/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import * as acorn from 'acorn';
|
|
2
2
|
import * as htmlparser2 from 'htmlparser2';
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
|
|
5
|
+
const { version: COMPILER_VERSION } = JSON.parse(
|
|
6
|
+
readFileSync(new URL('../package.json', import.meta.url), 'utf8')
|
|
7
|
+
);
|
|
3
8
|
|
|
4
9
|
const VOID_ELEMENTS = new Set([
|
|
5
10
|
'area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input',
|
|
@@ -617,7 +622,7 @@ export function compile(source, options = {}) {
|
|
|
617
622
|
// Assemble final output module
|
|
618
623
|
const CORE_EXPORTS = 'createSignal, createDerived, createEffect, createIntent, createData, onMount, onDestroy, pushContext, popContext, __flush_mounts, __flush_destroys';
|
|
619
624
|
let output = '';
|
|
620
|
-
output += `// Compiled by @sola-air-ui/compiler
|
|
625
|
+
output += `// Compiled by @sola-air-ui/compiler v${COMPILER_VERSION}\n`;
|
|
621
626
|
|
|
622
627
|
if (target === 'iife') {
|
|
623
628
|
// ServiceNow / no-bundler mode: pull from window.SolaCore global
|