@electrojs/codegen 1.0.1 → 1.0.3
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.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/package.json +8 -8
package/dist/index.d.mts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module types
|
|
9
9
|
*/
|
|
10
|
-
/** Complete result of scanning a project's source files for
|
|
10
|
+
/** Complete result of scanning a project's source files for ElectroJS decorators. */
|
|
11
11
|
interface ScanResult {
|
|
12
12
|
readonly modules: readonly ScannedModule[];
|
|
13
13
|
readonly windows: readonly ScannedWindow[];
|
|
@@ -171,7 +171,7 @@ interface CodegenDiagnostic {
|
|
|
171
171
|
//#endregion
|
|
172
172
|
//#region src/scanner/index.d.ts
|
|
173
173
|
/**
|
|
174
|
-
* Scan a project directory for
|
|
174
|
+
* Scan a project directory for ElectroJS decorators and return a normalized result.
|
|
175
175
|
*
|
|
176
176
|
* This is the main entry point for the codegen scanner.
|
|
177
177
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{readFileSync as e}from"node:fs";import{parseSync as t}from"oxc-parser";import{basename as n,dirname as r,isAbsolute as i,join as a,relative as o,resolve as s}from"node:path";function c(n){let r=t(n,e(n,`utf8`),{sourceType:`module`});for(let e of r.errors)console.warn(`[codegen] Parse error in ${n}: ${e.message}`);return{program:r.program,filePath:n}}function l(e){return e&&e.type===`Literal`&&typeof e.value==`string`?e.value:null}function u(e){if(!e||e.type!==`ArrayExpression`)return[];let t=[];for(let n of e.elements){let e=l(n);e!==null&&t.push(e)}return t}function d(e){if(!e||e.type!==`ArrayExpression`)return[];let t=[];for(let n of e.elements)n?.type===`Identifier`&&typeof n.name==`string`&&t.push(n.name);return t}function f(e){return e?e.type===`Identifier`&&typeof e.name==`string`?e.name:e.type===`Literal`&&typeof e.value==`string`?e.value:null:null}function p(e,t){let n=e.properties;if(!n)return null;for(let e of n)if(e.type===`Property`&&f(e.key)===t)return e.value;return null}function m(e){return e&&e.type===`Identifier`&&typeof e.name==`string`?e.name:null}function h(e){return(e.type===`ClassDeclaration`||e.type===`ClassExpression`)&&e.id?m(e.id):null}function g(e,t){let n=Array.isArray(t)?t:[t],r=e.decorators??[];for(let e of r){if(e.type!==`Decorator`)continue;let t=e.expression;if(t.type===`Identifier`&&n.includes(t.name))return t;if(t.type===`CallExpression`){let e=t.callee;if(e.type===`Identifier`&&n.includes(e.name))return t}}return null}function _(e,t){let n=g(e,t);if(!n||n.type!==`CallExpression`)return null;let r=n.arguments[0];return!r||r.type!==`ObjectExpression`?null:r}function v(e){let t=new Set,n=e.body;if(!n)return t;for(let e of n){if(e.type===`ExportNamedDeclaration`){let n=e.declaration;if(n?.type===`ClassDeclaration`||n?.type===`FunctionDeclaration`||n?.type===`TSInterfaceDeclaration`||n?.type===`TSTypeAliasDeclaration`){let e=m(n.id);e&&t.add(e);continue}if(n?.type===`VariableDeclaration`){for(let e of n.declarations){let n=m(e.id);n&&t.add(n)}continue}for(let n of e.specifiers??[]){if(n.type!==`ExportSpecifier`)continue;let e=m(n.local);e&&t.add(e)}continue}if(e.type===`ExportDefaultDeclaration`){let n=e.declaration,r=m(n)||m(n?.id??null);r&&t.add(r)}}return t}function y(e,t){let n=t?.trim();if(n&&n.length>0)return n;let r=e.endsWith(`Module`)?e.slice(0,-6):e,i=r.length>0?r:e;return i.charAt(0).toLowerCase()+i.slice(1)}function b(e,t){let n=t?.trim();return n&&n.length>0?n:e}function x(e,t){let n=e.trim();if(n.startsWith(`view:`)){let e=n.slice(5).trim();return e.length>0?e:null}let r=t?.trim();return r&&r.length>0?r:null}const S=new Set([`onInit`,`onReady`,`onShutdown`,`onDispose`]);function C(e){if(!e||e.type!==`CallExpression`)return!1;let t=e.callee;if(t?.type!==`Identifier`||t.name!==`inject`)return!1;let n=e.arguments??[];return n[0]?.type===`Identifier`&&n[0].name===`SignalBus`}function ee(e){let t=new Set,n=e.body?.body??[];for(let e of n){if(e.type!==`PropertyDefinition`||e.computed||!C(e.value))continue;let n=f(e.key);n&&t.add(n)}return t}function w(e){let t=e.value?.params??[],n=[];return t.forEach((e,t)=>{let r=m(e);r&&n.push({index:t,name:r})}),n}function T(e,t){let n=e.find(e=>e.name===t);return n?n.index:null}function te(e,t){if(!e)return{kind:`void`};if(e.type===`Identifier`){if(e.name===`undefined`)return{kind:`void`};let n=T(t,e.name);return n===null?{kind:`unknown`}:{kind:`method-parameter`,parameterIndex:n}}if(e.type!==`ObjectExpression`)return{kind:`unknown`};let n=null,r=[];for(let t of e.properties??[]){if(t.type!==`Property`||t.kind!==`init`||t.computed)return{kind:`unknown`};let e=f(t.key),i=t.value;if(!e||!i||i.type!==`MemberExpression`||i.computed)return{kind:`unknown`};let a=m(i.object),o=f(i.property);if(!a||!o||e!==o)return{kind:`unknown`};if(n===null)n=a;else if(n!==a)return{kind:`unknown`};r.push(e)}if(!n)return{kind:`unknown`};let i=T(t,n);return i===null?{kind:`unknown`}:{kind:`method-parameter-pick`,parameterIndex:i,keys:r}}function E(e,t){if(!e||e.type!==`MemberExpression`||e.computed)return!1;let n=f(e.property);return e.object?.type===`ThisExpression`&&!!n&&t.has(n)}function D(e,t){return E(e,t)||C(e)}function O(e,t){if(!(!e||typeof e!=`object`)){t(e);for(let n of Object.values(e)){if(Array.isArray(n)){for(let e of n)O(e,t);continue}O(n,t)}}}function k(e,t,n,r){let i=[],a=w(e);return O(e.value?.body,e=>{if(e.type!==`CallExpression`)return;let o=e.callee;if(!o||o.type!==`MemberExpression`||o.computed||!D(o.object,r))return;let s=f(o.property);if(s!==`publish`&&s!==`subscribe`)return;let c=e.arguments??[],u=l(c[0]);u&&i.push({id:u,methodName:n,ownerClassName:t,source:s,payload:s===`publish`?te(c[1],a):{kind:`unknown`}})}),i}function A(e,t){let n=[],r=[],i=[],a=ee(e),o=e.body?.body??[];for(let e of o){if(e.type!==`MethodDefinition`||e.kind!==`method`||e.computed||e.static||e.accessibility===`private`)continue;let o=f(e.key);if(!o||(r.push(...k(e,t,o,a)),S.has(o)))continue;let s=g(e,`command`),c=g(e,`query`),u=g(e,`signal`),d=g(e,`job`);if(s||c){let r=_(e,s?`command`:`query`),i=l(r?p(r,`id`):null);n.push({id:b(o,i),methodName:o,kind:s?`command`:`query`,ownerClassName:t})}if(u){let n=_(e,`signal`),i=l(n?p(n,`id`):null);r.push({id:b(o,i),methodName:o,ownerClassName:t,source:`decorator`,payload:{kind:`method-parameter`,parameterIndex:0}})}if(d){let n=_(e,`job`),r=l(n?p(n,`id`):null),a=l(n?p(n,`cron`):null);i.push({id:b(o,r),methodName:o,ownerClassName:t,cron:a})}}return{methods:n,signals:r,jobs:i}}function ne(e,t){let n=v(e),r=[],i=[],a=[],o=[],s=e.body;if(!s)return{modules:r,providers:i,windows:a,views:o};for(let e of s){let s=null;if(e.type===`ClassDeclaration`?s=e:(e.type===`ExportNamedDeclaration`&&e.declaration?.type===`ClassDeclaration`||e.type===`ExportDefaultDeclaration`&&e.declaration?.type===`ClassDeclaration`)&&(s=e.declaration),!s)continue;let c=h(s);if(!c)continue;let f=n.has(c);if(g(s,`Module`)){let e=_(s,`Module`),n=l(e?p(e,`id`):null),i=[...d(e?p(e,`imports`):null),...d(e?p(e,`dependsOn`):null)],a=[...d(e?p(e,`providers`):null),...d(e?p(e,`services`):null)],{methods:o,signals:u,jobs:m}=A(s,c);r.push({kind:`module`,id:y(c,n),className:c,filePath:t,exported:f,importClassNames:[...new Set(i)],providerClassNames:[...new Set(a)],methods:o,signals:u,jobs:m});continue}if(g(s,`Injectable`)){let{methods:e,signals:n,jobs:r}=A(s,c);i.push({kind:`injectable`,className:c,filePath:t,exported:f,methods:e,signals:n,jobs:r});continue}if(g(s,`Window`)){let{methods:e,signals:n,jobs:r}=A(s,c),o=_(s,`Window`),u=l(o?p(o,`id`):null);if(!u){console.warn(`[codegen] Skipping @Window() with non-literal id in ${t}`);continue}i.push({kind:`injectable`,className:c,filePath:t,exported:f,methods:e,signals:n,jobs:r}),a.push({id:u,className:c,filePath:t,exported:f});continue}if(g(s,`View`)){let{methods:e,signals:n,jobs:r}=A(s,c),a=_(s,`View`),d=l(a?p(a,`source`):null);if(!d){console.warn(`[codegen] Skipping @View() with non-literal source in ${t}`);continue}let m=x(d,l(a?p(a,`id`):null));if(!m){console.warn(`[codegen] Skipping @View() with non-literal id in ${t}`);continue}i.push({kind:`injectable`,className:c,filePath:t,exported:f,methods:e,signals:n,jobs:r}),o.push({id:m,className:c,filePath:t,exported:f,source:d,access:u(a?p(a,`access`):null),signals:u(a?p(a,`signals`):null)})}}return{modules:r,providers:i,windows:a,views:o}}const re=[/\.d\.ts$/,/\.test\.ts$/,/\.spec\.ts$/,/\.gen\.ts$/];function ie(e){return n(e).startsWith(`._`)||e.includes(`/__MACOSX/`)?!1:e.endsWith(`.ts`)&&!re.some(t=>t.test(e))}async function ae(e){let{glob:t}=await import(`tinyglobby`);return(await t([`**/*.ts`],{cwd:e,absolute:!0,ignore:[`node_modules/**`,`**/__MACOSX/**`,`**/.DS_Store`,`**/._*`]})).filter(ie).sort()}async function oe(e){let t=await ae(e),n=[],r=[],i=[],a=[];for(let e of t){let{program:t}=c(e),o=ne(t,e);n.push(...o.modules),r.push(...o.providers),i.push(...o.windows),a.push(...o.views)}let o=new Map(r.map(e=>[e.className,e])),s=new Map(n.map(e=>[e.className,e]));return{modules:n.map(e=>{let t=[];for(let n of e.providerClassNames){let r=o.get(n);if(!r){console.warn(`[codegen] Module "${e.id}" references unknown provider class "${n}" in ${e.filePath}`);continue}t.push({className:r.className,filePath:r.filePath,exported:r.exported,methods:[...r.methods],signals:[...r.signals],jobs:[...r.jobs]})}let n=[];for(let t of e.importClassNames){let r=s.get(t);if(!r){console.warn(`[codegen] Module "${e.id}" references unknown module class "${t}" in ${e.filePath}`);continue}n.push(r.id)}return{id:e.id,className:e.className,filePath:e.filePath,exported:e.exported,imports:[...new Set(n)],providers:t,methods:[...e.methods],signals:[...e.signals],jobs:[...e.jobs]}}),windows:i,views:a}}function j(e,t){let n=o(r(e),t).replaceAll(`\\`,`/`).replace(/\.(?:[cm]?tsx?|[cm]?jsx?)$/,``);return n.startsWith(`.`)?n:`./${n}`}function M(e,t){let n=o(r(e),t).replaceAll(`\\`,`/`);return n.startsWith(`.`)?n:`./${n}`}function N(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?e:JSON.stringify(e)}const P=`// Auto-generated by
|
|
1
|
+
import{readFileSync as e}from"node:fs";import{parseSync as t}from"oxc-parser";import{basename as n,dirname as r,isAbsolute as i,join as a,relative as o,resolve as s}from"node:path";function c(n){let r=t(n,e(n,`utf8`),{sourceType:`module`});for(let e of r.errors)console.warn(`[codegen] Parse error in ${n}: ${e.message}`);return{program:r.program,filePath:n}}function l(e){return e&&e.type===`Literal`&&typeof e.value==`string`?e.value:null}function u(e){if(!e||e.type!==`ArrayExpression`)return[];let t=[];for(let n of e.elements){let e=l(n);e!==null&&t.push(e)}return t}function d(e){if(!e||e.type!==`ArrayExpression`)return[];let t=[];for(let n of e.elements)n?.type===`Identifier`&&typeof n.name==`string`&&t.push(n.name);return t}function f(e){return e?e.type===`Identifier`&&typeof e.name==`string`?e.name:e.type===`Literal`&&typeof e.value==`string`?e.value:null:null}function p(e,t){let n=e.properties;if(!n)return null;for(let e of n)if(e.type===`Property`&&f(e.key)===t)return e.value;return null}function m(e){return e&&e.type===`Identifier`&&typeof e.name==`string`?e.name:null}function h(e){return(e.type===`ClassDeclaration`||e.type===`ClassExpression`)&&e.id?m(e.id):null}function g(e,t){let n=Array.isArray(t)?t:[t],r=e.decorators??[];for(let e of r){if(e.type!==`Decorator`)continue;let t=e.expression;if(t.type===`Identifier`&&n.includes(t.name))return t;if(t.type===`CallExpression`){let e=t.callee;if(e.type===`Identifier`&&n.includes(e.name))return t}}return null}function _(e,t){let n=g(e,t);if(!n||n.type!==`CallExpression`)return null;let r=n.arguments[0];return!r||r.type!==`ObjectExpression`?null:r}function v(e){let t=new Set,n=e.body;if(!n)return t;for(let e of n){if(e.type===`ExportNamedDeclaration`){let n=e.declaration;if(n?.type===`ClassDeclaration`||n?.type===`FunctionDeclaration`||n?.type===`TSInterfaceDeclaration`||n?.type===`TSTypeAliasDeclaration`){let e=m(n.id);e&&t.add(e);continue}if(n?.type===`VariableDeclaration`){for(let e of n.declarations){let n=m(e.id);n&&t.add(n)}continue}for(let n of e.specifiers??[]){if(n.type!==`ExportSpecifier`)continue;let e=m(n.local);e&&t.add(e)}continue}if(e.type===`ExportDefaultDeclaration`){let n=e.declaration,r=m(n)||m(n?.id??null);r&&t.add(r)}}return t}function y(e,t){let n=t?.trim();if(n&&n.length>0)return n;let r=e.endsWith(`Module`)?e.slice(0,-6):e,i=r.length>0?r:e;return i.charAt(0).toLowerCase()+i.slice(1)}function b(e,t){let n=t?.trim();return n&&n.length>0?n:e}function x(e,t){let n=e.trim();if(n.startsWith(`view:`)){let e=n.slice(5).trim();return e.length>0?e:null}let r=t?.trim();return r&&r.length>0?r:null}const S=new Set([`onInit`,`onReady`,`onShutdown`,`onDispose`]);function C(e){if(!e||e.type!==`CallExpression`)return!1;let t=e.callee;if(t?.type!==`Identifier`||t.name!==`inject`)return!1;let n=e.arguments??[];return n[0]?.type===`Identifier`&&n[0].name===`SignalBus`}function ee(e){let t=new Set,n=e.body?.body??[];for(let e of n){if(e.type!==`PropertyDefinition`||e.computed||!C(e.value))continue;let n=f(e.key);n&&t.add(n)}return t}function w(e){let t=e.value?.params??[],n=[];return t.forEach((e,t)=>{let r=m(e);r&&n.push({index:t,name:r})}),n}function T(e,t){let n=e.find(e=>e.name===t);return n?n.index:null}function te(e,t){if(!e)return{kind:`void`};if(e.type===`Identifier`){if(e.name===`undefined`)return{kind:`void`};let n=T(t,e.name);return n===null?{kind:`unknown`}:{kind:`method-parameter`,parameterIndex:n}}if(e.type!==`ObjectExpression`)return{kind:`unknown`};let n=null,r=[];for(let t of e.properties??[]){if(t.type!==`Property`||t.kind!==`init`||t.computed)return{kind:`unknown`};let e=f(t.key),i=t.value;if(!e||!i||i.type!==`MemberExpression`||i.computed)return{kind:`unknown`};let a=m(i.object),o=f(i.property);if(!a||!o||e!==o)return{kind:`unknown`};if(n===null)n=a;else if(n!==a)return{kind:`unknown`};r.push(e)}if(!n)return{kind:`unknown`};let i=T(t,n);return i===null?{kind:`unknown`}:{kind:`method-parameter-pick`,parameterIndex:i,keys:r}}function E(e,t){if(!e||e.type!==`MemberExpression`||e.computed)return!1;let n=f(e.property);return e.object?.type===`ThisExpression`&&!!n&&t.has(n)}function D(e,t){return E(e,t)||C(e)}function O(e,t){if(!(!e||typeof e!=`object`)){t(e);for(let n of Object.values(e)){if(Array.isArray(n)){for(let e of n)O(e,t);continue}O(n,t)}}}function k(e,t,n,r){let i=[],a=w(e);return O(e.value?.body,e=>{if(e.type!==`CallExpression`)return;let o=e.callee;if(!o||o.type!==`MemberExpression`||o.computed||!D(o.object,r))return;let s=f(o.property);if(s!==`publish`&&s!==`subscribe`)return;let c=e.arguments??[],u=l(c[0]);u&&i.push({id:u,methodName:n,ownerClassName:t,source:s,payload:s===`publish`?te(c[1],a):{kind:`unknown`}})}),i}function A(e,t){let n=[],r=[],i=[],a=ee(e),o=e.body?.body??[];for(let e of o){if(e.type!==`MethodDefinition`||e.kind!==`method`||e.computed||e.static||e.accessibility===`private`)continue;let o=f(e.key);if(!o||(r.push(...k(e,t,o,a)),S.has(o)))continue;let s=g(e,`command`),c=g(e,`query`),u=g(e,`signal`),d=g(e,`job`);if(s||c){let r=_(e,s?`command`:`query`),i=l(r?p(r,`id`):null);n.push({id:b(o,i),methodName:o,kind:s?`command`:`query`,ownerClassName:t})}if(u){let n=_(e,`signal`),i=l(n?p(n,`id`):null);r.push({id:b(o,i),methodName:o,ownerClassName:t,source:`decorator`,payload:{kind:`method-parameter`,parameterIndex:0}})}if(d){let n=_(e,`job`),r=l(n?p(n,`id`):null),a=l(n?p(n,`cron`):null);i.push({id:b(o,r),methodName:o,ownerClassName:t,cron:a})}}return{methods:n,signals:r,jobs:i}}function ne(e,t){let n=v(e),r=[],i=[],a=[],o=[],s=e.body;if(!s)return{modules:r,providers:i,windows:a,views:o};for(let e of s){let s=null;if(e.type===`ClassDeclaration`?s=e:(e.type===`ExportNamedDeclaration`&&e.declaration?.type===`ClassDeclaration`||e.type===`ExportDefaultDeclaration`&&e.declaration?.type===`ClassDeclaration`)&&(s=e.declaration),!s)continue;let c=h(s);if(!c)continue;let f=n.has(c);if(g(s,`Module`)){let e=_(s,`Module`),n=l(e?p(e,`id`):null),i=[...d(e?p(e,`imports`):null),...d(e?p(e,`dependsOn`):null)],a=[...d(e?p(e,`providers`):null),...d(e?p(e,`services`):null)],{methods:o,signals:u,jobs:m}=A(s,c);r.push({kind:`module`,id:y(c,n),className:c,filePath:t,exported:f,importClassNames:[...new Set(i)],providerClassNames:[...new Set(a)],methods:o,signals:u,jobs:m});continue}if(g(s,`Injectable`)){let{methods:e,signals:n,jobs:r}=A(s,c);i.push({kind:`injectable`,className:c,filePath:t,exported:f,methods:e,signals:n,jobs:r});continue}if(g(s,`Window`)){let{methods:e,signals:n,jobs:r}=A(s,c),o=_(s,`Window`),u=l(o?p(o,`id`):null);if(!u){console.warn(`[codegen] Skipping @Window() with non-literal id in ${t}`);continue}i.push({kind:`injectable`,className:c,filePath:t,exported:f,methods:e,signals:n,jobs:r}),a.push({id:u,className:c,filePath:t,exported:f});continue}if(g(s,`View`)){let{methods:e,signals:n,jobs:r}=A(s,c),a=_(s,`View`),d=l(a?p(a,`source`):null);if(!d){console.warn(`[codegen] Skipping @View() with non-literal source in ${t}`);continue}let m=x(d,l(a?p(a,`id`):null));if(!m){console.warn(`[codegen] Skipping @View() with non-literal id in ${t}`);continue}i.push({kind:`injectable`,className:c,filePath:t,exported:f,methods:e,signals:n,jobs:r}),o.push({id:m,className:c,filePath:t,exported:f,source:d,access:u(a?p(a,`access`):null),signals:u(a?p(a,`signals`):null)})}}return{modules:r,providers:i,windows:a,views:o}}const re=[/\.d\.ts$/,/\.test\.ts$/,/\.spec\.ts$/,/\.gen\.ts$/];function ie(e){return n(e).startsWith(`._`)||e.includes(`/__MACOSX/`)?!1:e.endsWith(`.ts`)&&!re.some(t=>t.test(e))}async function ae(e){let{glob:t}=await import(`tinyglobby`);return(await t([`**/*.ts`],{cwd:e,absolute:!0,ignore:[`node_modules/**`,`**/__MACOSX/**`,`**/.DS_Store`,`**/._*`]})).filter(ie).sort()}async function oe(e){let t=await ae(e),n=[],r=[],i=[],a=[];for(let e of t){let{program:t}=c(e),o=ne(t,e);n.push(...o.modules),r.push(...o.providers),i.push(...o.windows),a.push(...o.views)}let o=new Map(r.map(e=>[e.className,e])),s=new Map(n.map(e=>[e.className,e]));return{modules:n.map(e=>{let t=[];for(let n of e.providerClassNames){let r=o.get(n);if(!r){console.warn(`[codegen] Module "${e.id}" references unknown provider class "${n}" in ${e.filePath}`);continue}t.push({className:r.className,filePath:r.filePath,exported:r.exported,methods:[...r.methods],signals:[...r.signals],jobs:[...r.jobs]})}let n=[];for(let t of e.importClassNames){let r=s.get(t);if(!r){console.warn(`[codegen] Module "${e.id}" references unknown module class "${t}" in ${e.filePath}`);continue}n.push(r.id)}return{id:e.id,className:e.className,filePath:e.filePath,exported:e.exported,imports:[...new Set(n)],providers:t,methods:[...e.methods],signals:[...e.signals],jobs:[...e.jobs]}}),windows:i,views:a}}function j(e,t){let n=o(r(e),t).replaceAll(`\\`,`/`).replace(/\.(?:[cm]?tsx?|[cm]?jsx?)$/,``);return n.startsWith(`.`)?n:`./${n}`}function M(e,t){let n=o(r(e),t).replaceAll(`\\`,`/`);return n.startsWith(`.`)?n:`./${n}`}function N(e){return/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e)?e:JSON.stringify(e)}const P=`// Auto-generated by ElectroJS codegen. Do not edit.
|
|
2
2
|
`;function F(e){switch(e.source){case`decorator`:return 400;case`publish`:switch(e.payload.kind){case`method-parameter-pick`:return 350;case`method-parameter`:return 340;case`void`:return 330;case`unknown`:return 320}case`subscribe`:return 100}}function I(e,t){return F(t)>F(e)}function L(e){let t=new Map,n=(e,n)=>{let r=t.get(e.id);(!r||I(r.signal,e))&&t.set(e.id,{signal:e,filePath:n})};for(let t of e){for(let e of t.signals)n(e,t.filePath);for(let e of t.providers)for(let t of e.signals)n(t,e.filePath)}return t}const R=`${P}// @ts-nocheck
|
|
3
|
-
//
|
|
3
|
+
// ElectroJS runtime authoring contract types — provides IDE completions for modules, signals, jobs, windows, and runtime-declared views.
|
|
4
4
|
|
|
5
5
|
export {};
|
|
6
6
|
|
|
@@ -47,7 +47,7 @@ ${V(e.modules,n)}${H(e.modules,n)}${U(e.modules,n)}${W(e.modules)}${G(e.modules,
|
|
|
47
47
|
declare module "@electrojs/common" {
|
|
48
48
|
${se(e.modules)}${ce(e.modules)}${le(e.views)}
|
|
49
49
|
}${ue(e,n)}`}}const fe=`${P}// @ts-nocheck
|
|
50
|
-
//
|
|
50
|
+
// ElectroJS renderer bridge contract types — provides IDE completions for bridge access and forwarded signals.
|
|
51
51
|
|
|
52
52
|
export {};
|
|
53
53
|
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@electrojs/codegen",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Code generator for electro module runtime — scans modules/views and emits bridge and registry artifacts",
|
|
5
|
-
"homepage": "https://
|
|
5
|
+
"homepage": "https://electrojs.myraxbyte.dev/",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"tsdown": "^0.21.4",
|
|
33
33
|
"vitest": "^4.1.1",
|
|
34
|
-
"@electrojs/common": "1.0.
|
|
35
|
-
"@electrojs/
|
|
36
|
-
"@electrojs/
|
|
34
|
+
"@electrojs/common": "1.0.3",
|
|
35
|
+
"@electrojs/config": "1.0.3",
|
|
36
|
+
"@electrojs/runtime": "1.0.3"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"@electrojs/common": "1.0.
|
|
40
|
-
"@electrojs/config": "1.0.
|
|
41
|
-
"@electrojs/runtime": "1.0.
|
|
39
|
+
"@electrojs/common": "1.0.3",
|
|
40
|
+
"@electrojs/config": "1.0.3",
|
|
41
|
+
"@electrojs/runtime": "1.0.3",
|
|
42
42
|
"@types/node": "^25.5.0"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|