@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.cjs
CHANGED
|
@@ -1662,7 +1662,13 @@ function getSemanticExports(config) {
|
|
|
1662
1662
|
|
|
1663
1663
|
// src/generator.ts
|
|
1664
1664
|
function stripTypes(code) {
|
|
1665
|
-
return code.replace(/\s+as\s+\w
|
|
1665
|
+
return code.replace(/\s+as\s+\w+<[^>]*(?:<[^>]*>[^>]*)*>/g, "").replace(/\s+as\s+\w+(?:\[\])?/g, "").replace(/:\s*\w+<[^>]*(?:<[^>]*>[^>]*)*>(?=\s*[=;,)\]])/g, "").replace(
|
|
1666
|
+
/:\s*(?:string|number|boolean|any|unknown|void|never|null|undefined|object|symbol|bigint)(?=\s*[=;,)\]])/g,
|
|
1667
|
+
""
|
|
1668
|
+
).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(
|
|
1669
|
+
/:\s*(?:TransitionEvent|MouseEvent|KeyboardEvent|Event|Element|HTMLElement|Node)(?=\s*[=;,)\]])/g,
|
|
1670
|
+
""
|
|
1671
|
+
);
|
|
1666
1672
|
}
|
|
1667
1673
|
var COMMAND_IMPLEMENTATIONS = {};
|
|
1668
1674
|
var BLOCK_IMPLEMENTATIONS = {};
|
|
@@ -1691,7 +1697,7 @@ function generateBundleCode(config) {
|
|
|
1691
1697
|
const commandCases = commands.filter((cmd) => COMMAND_IMPLEMENTATIONS[cmd]).map((cmd) => COMMAND_IMPLEMENTATIONS[cmd]).join("\n");
|
|
1692
1698
|
const blockCases = blocks.filter((block) => BLOCK_IMPLEMENTATIONS[block]).map((block) => BLOCK_IMPLEMENTATIONS[block]).join("\n");
|
|
1693
1699
|
return `/**
|
|
1694
|
-
*
|
|
1700
|
+
* LokaScript ${name} Bundle (Auto-Generated)
|
|
1695
1701
|
*
|
|
1696
1702
|
* Generated by: @lokascript/vite-plugin
|
|
1697
1703
|
* Commands: ${commands.join(", ")}${blocks.length > 0 ? `
|
|
@@ -2004,7 +2010,7 @@ function processElement(el) {
|
|
|
2004
2010
|
const ast = parser.parse();
|
|
2005
2011
|
executeAST(ast, el);
|
|
2006
2012
|
} catch (err) {
|
|
2007
|
-
console.error('
|
|
2013
|
+
console.error('LokaScript ${name} error:', err, 'Code:', code);
|
|
2008
2014
|
}
|
|
2009
2015
|
}
|
|
2010
2016
|
|
|
@@ -2165,7 +2171,7 @@ ${additionalApiProps}`
|
|
|
2165
2171
|
generateEmptyBundle(options) {
|
|
2166
2172
|
const globalName = options.globalName ?? "hyperfixi";
|
|
2167
2173
|
return `/**
|
|
2168
|
-
*
|
|
2174
|
+
* LokaScript Empty Bundle (Auto-Generated)
|
|
2169
2175
|
*
|
|
2170
2176
|
* No hyperscript usage detected. This bundle provides a minimal API.
|
|
2171
2177
|
* Add hyperscript attributes (_="...") to your HTML to enable features.
|
|
@@ -2179,12 +2185,12 @@ const api = {
|
|
|
2179
2185
|
parserName: 'none',
|
|
2180
2186
|
|
|
2181
2187
|
parse() {
|
|
2182
|
-
console.warn('
|
|
2188
|
+
console.warn('LokaScript: No parser loaded. Add hyperscript to your HTML to enable parsing.');
|
|
2183
2189
|
return { type: 'empty' };
|
|
2184
2190
|
},
|
|
2185
2191
|
|
|
2186
2192
|
async execute(code, element) {
|
|
2187
|
-
console.warn('
|
|
2193
|
+
console.warn('LokaScript: No commands loaded. Detected commands will be automatically included.');
|
|
2188
2194
|
return null;
|
|
2189
2195
|
},
|
|
2190
2196
|
|
|
@@ -2210,7 +2216,7 @@ export { api };
|
|
|
2210
2216
|
generateDevFallback(fallback) {
|
|
2211
2217
|
const bundle = fallback === "full" ? "@lokascript/core/browser" : "@lokascript/core/browser/hybrid-complete";
|
|
2212
2218
|
return `/**
|
|
2213
|
-
*
|
|
2219
|
+
* LokaScript Dev Fallback Bundle
|
|
2214
2220
|
*
|
|
2215
2221
|
* Using pre-built ${fallback} bundle for faster development.
|
|
2216
2222
|
* Production builds will generate minimal bundles.
|