@lokascript/vite-plugin 1.1.0 → 1.1.2
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/index.cjs +13 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +13 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1618,7 +1618,13 @@ function getSemanticExports(config) {
|
|
|
1618
1618
|
|
|
1619
1619
|
// src/generator.ts
|
|
1620
1620
|
function stripTypes(code) {
|
|
1621
|
-
return code.replace(/\s+as\s+\w
|
|
1621
|
+
return code.replace(/\s+as\s+\w+<[^>]*(?:<[^>]*>[^>]*)*>/g, "").replace(/\s+as\s+\w+(?:\[\])?/g, "").replace(/:\s*\w+<[^>]*(?:<[^>]*>[^>]*)*>(?=\s*[=;,)\]])/g, "").replace(
|
|
1622
|
+
/:\s*(?:string|number|boolean|any|unknown|void|never|null|undefined|object|symbol|bigint)(?=\s*[=;,)\]])/g,
|
|
1623
|
+
""
|
|
1624
|
+
).replace(/:\s*[A-Z]\w*(?:\[\])?(?=\s*[=;,)\]])/g, "").replace(/\((\w+):\s*(?:\w+|unknown|any)\)/g, "($1)").replace(/Promise<[^>]+>/g, "Promise").replace(/Array<[^>]+>/g, "Array").replace(/\):\s*\w+(?:<[^>]*>)?(?:\[\])?\s*(?=[{=])/g, ") ").replace(/\):\s*\w+(?:<[^>]*>)?\s*=>/g, ") =>").replace(
|
|
1625
|
+
/:\s*(?:TransitionEvent|MouseEvent|KeyboardEvent|Event|Element|HTMLElement|Node)(?=\s*[=;,)\]])/g,
|
|
1626
|
+
""
|
|
1627
|
+
);
|
|
1622
1628
|
}
|
|
1623
1629
|
var COMMAND_IMPLEMENTATIONS = {};
|
|
1624
1630
|
var BLOCK_IMPLEMENTATIONS = {};
|
|
@@ -1647,7 +1653,7 @@ function generateBundleCode(config) {
|
|
|
1647
1653
|
const commandCases = commands.filter((cmd) => COMMAND_IMPLEMENTATIONS[cmd]).map((cmd) => COMMAND_IMPLEMENTATIONS[cmd]).join("\n");
|
|
1648
1654
|
const blockCases = blocks.filter((block) => BLOCK_IMPLEMENTATIONS[block]).map((block) => BLOCK_IMPLEMENTATIONS[block]).join("\n");
|
|
1649
1655
|
return `/**
|
|
1650
|
-
*
|
|
1656
|
+
* LokaScript ${name} Bundle (Auto-Generated)
|
|
1651
1657
|
*
|
|
1652
1658
|
* Generated by: @lokascript/vite-plugin
|
|
1653
1659
|
* Commands: ${commands.join(", ")}${blocks.length > 0 ? `
|
|
@@ -1960,7 +1966,7 @@ function processElement(el) {
|
|
|
1960
1966
|
const ast = parser.parse();
|
|
1961
1967
|
executeAST(ast, el);
|
|
1962
1968
|
} catch (err) {
|
|
1963
|
-
console.error('
|
|
1969
|
+
console.error('LokaScript ${name} error:', err, 'Code:', code);
|
|
1964
1970
|
}
|
|
1965
1971
|
}
|
|
1966
1972
|
|
|
@@ -2121,7 +2127,7 @@ ${additionalApiProps}`
|
|
|
2121
2127
|
generateEmptyBundle(options) {
|
|
2122
2128
|
const globalName = options.globalName ?? "hyperfixi";
|
|
2123
2129
|
return `/**
|
|
2124
|
-
*
|
|
2130
|
+
* LokaScript Empty Bundle (Auto-Generated)
|
|
2125
2131
|
*
|
|
2126
2132
|
* No hyperscript usage detected. This bundle provides a minimal API.
|
|
2127
2133
|
* Add hyperscript attributes (_="...") to your HTML to enable features.
|
|
@@ -2135,12 +2141,12 @@ const api = {
|
|
|
2135
2141
|
parserName: 'none',
|
|
2136
2142
|
|
|
2137
2143
|
parse() {
|
|
2138
|
-
console.warn('
|
|
2144
|
+
console.warn('LokaScript: No parser loaded. Add hyperscript to your HTML to enable parsing.');
|
|
2139
2145
|
return { type: 'empty' };
|
|
2140
2146
|
},
|
|
2141
2147
|
|
|
2142
2148
|
async execute(code, element) {
|
|
2143
|
-
console.warn('
|
|
2149
|
+
console.warn('LokaScript: No commands loaded. Detected commands will be automatically included.');
|
|
2144
2150
|
return null;
|
|
2145
2151
|
},
|
|
2146
2152
|
|
|
@@ -2166,7 +2172,7 @@ export { api };
|
|
|
2166
2172
|
generateDevFallback(fallback) {
|
|
2167
2173
|
const bundle = fallback === "full" ? "@lokascript/core/browser" : "@lokascript/core/browser/hybrid-complete";
|
|
2168
2174
|
return `/**
|
|
2169
|
-
*
|
|
2175
|
+
* LokaScript Dev Fallback Bundle
|
|
2170
2176
|
*
|
|
2171
2177
|
* Using pre-built ${fallback} bundle for faster development.
|
|
2172
2178
|
* Production builds will generate minimal bundles.
|