feat: add changeset and changed package name
This commit is contained in:
parent
ef4126b767
commit
2f9d3737db
|
@ -0,0 +1,8 @@
|
||||||
|
# Changesets
|
||||||
|
|
||||||
|
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
|
||||||
|
with multi-package repos, or single-package repos to help you version and publish your code. You can
|
||||||
|
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
|
||||||
|
|
||||||
|
We have a quick list of common questions to get you started engaging with this project in
|
||||||
|
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
|
||||||
|
"changelog": "@changesets/cli/changelog",
|
||||||
|
"commit": false,
|
||||||
|
"fixed": [],
|
||||||
|
"linked": [],
|
||||||
|
"access": "restricted",
|
||||||
|
"baseBranch": "master",
|
||||||
|
"updateInternalDependencies": "patch",
|
||||||
|
"ignore": []
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
"babel-preset-inula-next": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
feat: change babel import
|
|
@ -2,8 +2,7 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8"/>
|
<meta charset="UTF-8"/>
|
||||||
<title>Dlight.JS</title>
|
<title>Inula-next</title>
|
||||||
<link rel="stylesheet" href="/src/App.css"/>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="main"></div>
|
<div id="main"></div>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/standalone": "^7.22.4",
|
"@babel/standalone": "^7.22.4",
|
||||||
"@inula/next": "workspace:*",
|
"@openinula/next": "workspace:*",
|
||||||
"@iandx/easy-css": "^0.10.14",
|
"@iandx/easy-css": "^0.10.14",
|
||||||
"babel-preset-inula-next": "workspace:*"
|
"babel-preset-inula-next": "workspace:*"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,22 +1,22 @@
|
||||||
import { createSignal, createSelector, batch } from 'solid-js';
|
import { render, View } from '@openinula/next';
|
||||||
import { render } from 'solid-js/web';
|
|
||||||
|
|
||||||
let idCounter = 1;
|
let idCounter = 1;
|
||||||
const adjectives = ['pretty', 'large', 'big', 'small', 'tall', 'short', 'long', 'handsome', 'plain', 'quaint', 'clean', 'elegant', 'easy', 'angry', 'crazy', 'helpful', 'mushy', 'odd', 'unsightly', 'adorable', 'important', 'inexpensive', 'cheap', 'expensive', 'fancy'],
|
|
||||||
colours = ['red', 'yellow', 'blue', 'green', 'pink', 'brown', 'purple', 'brown', 'white', 'black', 'orange'],
|
|
||||||
nouns = ['table', 'chair', 'house', 'bbq', 'desk', 'car', 'pony', 'cookie', 'sandwich', 'burger', 'pizza', 'mouse', 'keyboard'];
|
|
||||||
|
|
||||||
function _random (max) {
|
const adjectives = ['pretty', 'large', 'big', 'small', 'tall', 'short', 'long', 'handsome', 'plain', 'quaint', 'clean', 'elegant', 'easy', 'angry', 'crazy', 'helpful', 'mushy', 'odd', 'unsightly', 'adorable', 'important', 'inexpensive', 'cheap', 'expensive', 'fancy'];
|
||||||
|
const colours = ['red', 'yellow', 'blue', 'green', 'pink', 'brown', 'purple', 'brown', 'white', 'black', 'orange'];
|
||||||
|
const nouns = ['table', 'chair', 'house', 'bbq', 'desk', 'car', 'pony', 'cookie', 'sandwich', 'burger', 'pizza', 'mouse', 'keyboard'];
|
||||||
|
|
||||||
|
function _random(max) {
|
||||||
return Math.round(Math.random() * 1000) % max;
|
return Math.round(Math.random() * 1000) % max;
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildData(count) {
|
function buildData(count) {
|
||||||
let data = new Array(count);
|
const data = new Array(count);
|
||||||
for (let i = 0; i < count; i++) {
|
for (let i = 0; i < count; i++) {
|
||||||
const [label, setLabel] = createSignal(`${adjectives[_random(adjectives.length)]} ${colours[_random(colours.length)]} ${nouns[_random(nouns.length)]}`);
|
|
||||||
data[i] = {
|
data[i] = {
|
||||||
id: idCounter++,
|
id: idCounter++,
|
||||||
label, setLabel
|
label: `${adjectives[_random(adjectives.length)]} ${colours[_random(colours.length)]} ${nouns[_random(nouns.length)]}`
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
|
@ -65,7 +65,7 @@ function App () {
|
||||||
return (
|
return (
|
||||||
<div class='container'>
|
<div class='container'>
|
||||||
<div class='jumbotron'><div class='row'>
|
<div class='jumbotron'><div class='row'>
|
||||||
<div class='col-md-6'><h1>SolidJS Keyed</h1></div>
|
<div class='col-md-6'><h1>Inula-next Keyed</h1></div>
|
||||||
<div class='col-md-6'><div class='row'>
|
<div class='col-md-6'><div class='row'>
|
||||||
<Button id='run' text='Create 1,000 rows' fn={ run } />
|
<Button id='run' text='Create 1,000 rows' fn={ run } />
|
||||||
<Button id='runlots' text='Create 10,000 rows' fn={ runLots } />
|
<Button id='runlots' text='Create 10,000 rows' fn={ runLots } />
|
||||||
|
@ -84,15 +84,6 @@ function App () {
|
||||||
<td class='col-md-6'/>
|
<td class='col-md-6'/>
|
||||||
</tr>
|
</tr>
|
||||||
</for>
|
</for>
|
||||||
{/*for const { id, label } of data*/}
|
|
||||||
<for array={ data } item={ { id, label } } key={ id }>
|
|
||||||
<tr class={ selected === id ? 'danger': '' }>
|
|
||||||
<td class='col-md-1' textContent={ id } />
|
|
||||||
<td class='col-md-4'><a onClick={select.bind(this, id)} textContent={ label } /></td>
|
|
||||||
<td class='col-md-1'><a onClick={remove.bind(this, id)}><span class='glyphicon glyphicon-remove' aria-hidden="true" /></a></td>
|
|
||||||
<td class='col-md-6'/>
|
|
||||||
</tr>
|
|
||||||
</for>
|
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
<span class='preloadicon glyphicon glyphicon-remove' aria-hidden="true" />
|
<span class='preloadicon glyphicon glyphicon-remove' aria-hidden="true" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/standalone": "^7.22.4",
|
"@babel/standalone": "^7.22.4",
|
||||||
"@inula/next": "workspace:*",
|
"@openinula/next": "workspace:*",
|
||||||
"@iandx/easy-css": "^0.10.14",
|
"@iandx/easy-css": "^0.10.14",
|
||||||
"babel-preset-inula-next": "workspace:*"
|
"babel-preset-inula-next": "workspace:*"
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
// @ts-nocheck
|
||||||
|
import {
|
||||||
|
Children,
|
||||||
|
Content,
|
||||||
|
Main,
|
||||||
|
Model,
|
||||||
|
Prop,
|
||||||
|
View,
|
||||||
|
Watch,
|
||||||
|
button,
|
||||||
|
div,
|
||||||
|
input,
|
||||||
|
insertChildren,
|
||||||
|
use,
|
||||||
|
render,
|
||||||
|
} from '@openinula/next';
|
||||||
|
|
||||||
|
|
||||||
|
function MyComp() {
|
||||||
|
let count = 0;
|
||||||
|
const db = count * 2;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<h1 className="123">Hello dlight fn comp</h1>
|
||||||
|
<section>
|
||||||
|
count: {count}, double is: {db}
|
||||||
|
<button onClick={() => (count += 1)}>Add</button>
|
||||||
|
</section>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
render('main', MyComp);
|
|
@ -13,7 +13,7 @@ import {
|
||||||
insertChildren,
|
insertChildren,
|
||||||
use,
|
use,
|
||||||
render,
|
render,
|
||||||
} from '@inula/next';
|
} from '@openinula/next';
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
function Button({ children, onClick }) {
|
function Button({ children, onClick }) {
|
||||||
|
@ -35,7 +35,7 @@ function Button({ children, onClick }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function ArrayModification() {
|
function ArrayModification() {
|
||||||
let arr = [];
|
const arr = [];
|
||||||
willMount(() => {});
|
willMount(() => {});
|
||||||
return (
|
return (
|
||||||
<section>
|
<section>
|
||||||
|
@ -46,9 +46,75 @@ function ArrayModification() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function Counter() {
|
||||||
|
let count = 0;
|
||||||
|
const doubleCount = count * 2; // 当count变化时,doubleCount自动更新
|
||||||
|
|
||||||
|
// 当count变化时,watch会自动执行
|
||||||
|
watch(() => {
|
||||||
|
uploadToServer(count);
|
||||||
|
console.log(`count has changed: ${count}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 只有在init的时候执行一次
|
||||||
|
console.log(`Counter willMount with count ${count}`);
|
||||||
|
// 在elements被挂载到DOM之后执行
|
||||||
|
didMount(() => {
|
||||||
|
console.log(`Counter didMount with count ${count}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section>
|
||||||
|
count: {count}, double is: {doubleCount}
|
||||||
|
<button onClick={() => (count ++)}>Add</button>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function Counter() {
|
||||||
|
let count = 0;
|
||||||
|
const doubleCount = count * 2; // 当count变化时,doubleCount自动更新
|
||||||
|
|
||||||
|
uploadToServer(count); // 当count变化时,uploadToServer会自动执行
|
||||||
|
console.log(`count has changed: ${count}`); // 当count变化时,console.log会自动执行
|
||||||
|
|
||||||
|
// 只有在init的时候执行一次
|
||||||
|
willMount(() => {
|
||||||
|
console.log(`Counter willMount with count ${count}`);
|
||||||
|
});
|
||||||
|
// 在elements被挂载到DOM之后执行
|
||||||
|
didMount(() => {
|
||||||
|
console.log(`Counter didMount with count ${count}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section>
|
||||||
|
count: {count}, double is: {doubleCount}
|
||||||
|
<button onClick={() => (count ++)}>Add</button>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function MyComp() {
|
function MyComp() {
|
||||||
let count = 0;
|
let count = 0;
|
||||||
let db = count * 2;
|
|
||||||
|
{
|
||||||
|
console.log(count);
|
||||||
|
const i = count * 2;
|
||||||
|
console.log(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(count);
|
||||||
|
const i = count * 2;
|
||||||
|
console.log(i);
|
||||||
|
|
||||||
|
const XX = () => {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h1 className="123">Hello dlight fn comp</h1>
|
<h1 className="123">Hello dlight fn comp</h1>
|
||||||
|
|
|
@ -81,5 +81,9 @@
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=10.x",
|
"node": ">=10.x",
|
||||||
"npm": ">=7.x"
|
"npm": ">=7.x"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@changesets/cli": "^2.27.1",
|
||||||
|
"changeset": "^0.2.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,10 +178,10 @@ inula-cli的所有功能都围绕插件展开,插件可以很方便地让用
|
||||||
|
|
||||||
inula-cli支持用户集成已发布在npm仓库的插件,用户可以按需安装并运行这些插件。
|
inula-cli支持用户集成已发布在npm仓库的插件,用户可以按需安装并运行这些插件。
|
||||||
|
|
||||||
安装可以通过npm安装,这里以插件@inula/add为例:
|
安装可以通过npm安装,这里以插件@openinula/add为例:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
npm i --save-dev @inula/add
|
npm i --save-dev @openinula/add
|
||||||
```
|
```
|
||||||
|
|
||||||
如果需要运行插件,需要在配置文件中配置对应的插件路径
|
如果需要运行插件,需要在配置文件中配置对应的插件路径
|
||||||
|
@ -191,7 +191,7 @@ npm i --save-dev @inula/add
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
...
|
...
|
||||||
plugins:["@inula/add"]
|
plugins:["@openinula/add"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "@inula/store",
|
"name": "@openinula/store",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"description": "DLight shared store",
|
"description": "DLight shared store",
|
||||||
"author": {
|
"author": {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@inula/next",
|
"name": "@openinula/next",
|
||||||
"version": "1.0.0-next.9",
|
"version": "0.0.1",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "IanDx",
|
"name": "IanDx",
|
||||||
"email": "iandxssxx@gmail.com"
|
"email": "iandxssxx@gmail.com"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"dlight.js"
|
"inula"
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"files": [
|
"files": [
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"csstype": "^3.1.3",
|
"csstype": "^3.1.3",
|
||||||
"@inula/store": "workspace:*"
|
"@openinula/store": "workspace:*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"tsup": "^6.5.0"
|
"tsup": "^6.5.0"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Store } from '@inula/store';
|
import { Store } from '@openinula/store';
|
||||||
|
|
||||||
// ---- Using external Store to store global and document
|
// ---- Using external Store to store global and document
|
||||||
// Because Store is a singleton, it is safe to use it as a global variable
|
// Because Store is a singleton, it is safe to use it as a global variable
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
"name": "inula-router-config",
|
||||||
"module": "./esm/connectRouter.js",
|
"module": "./esm/connectRouter.js",
|
||||||
"main": "./cjs/connectRouter.js",
|
"main": "./cjs/connectRouter.js",
|
||||||
"types": "./@types/index.d.ts",
|
"types": "./@types/index.d.ts",
|
||||||
|
|
|
@ -27,7 +27,16 @@ This is a experimental package to implement [API2.0](https://gitee.com/openInula
|
||||||
- [x] fragment
|
- [x] fragment
|
||||||
- [ ] ref (to validate)
|
- [ ] ref (to validate)
|
||||||
- [ ] snippet
|
- [ ] snippet
|
||||||
- [ ] for
|
- [x] for
|
||||||
|
|
||||||
|
# 4.8 TODO
|
||||||
|
@YH
|
||||||
|
* Benchmark(result + comparison)
|
||||||
|
* Playground(@HQ publish) deploy
|
||||||
|
* PPT
|
||||||
|
* DEMO
|
||||||
|
* api2.1 compiled code
|
||||||
|
|
||||||
|
|
||||||
# function component syntax
|
# function component syntax
|
||||||
|
|
||||||
|
|
|
@ -32,10 +32,10 @@
|
||||||
"@babel/core": "^7.23.3",
|
"@babel/core": "^7.23.3",
|
||||||
"@babel/plugin-syntax-jsx": "7.16.7",
|
"@babel/plugin-syntax-jsx": "7.16.7",
|
||||||
"@babel/plugin-syntax-typescript": "^7.23.3",
|
"@babel/plugin-syntax-typescript": "^7.23.3",
|
||||||
"@inula/reactivity-parser": "workspace:*",
|
"@openinula/reactivity-parser": "workspace:*",
|
||||||
"@inula/view-generator": "workspace:*",
|
"@openinula/view-generator": "workspace:*",
|
||||||
"@inula/view-parser": "workspace:*",
|
"@openinula/view-parser": "workspace:*",
|
||||||
"@inula/class-transformer": "workspace:*",
|
"@openinula/class-transformer": "workspace:*",
|
||||||
"jsx-view-parser": "workspace:*",
|
"jsx-view-parser": "workspace:*",
|
||||||
"minimatch": "^9.0.3",
|
"minimatch": "^9.0.3",
|
||||||
"vitest": "^1.4.0"
|
"vitest": "^1.4.0"
|
||||||
|
|
|
@ -227,7 +227,7 @@ export const defaultHTMLTags = [
|
||||||
];
|
];
|
||||||
|
|
||||||
export const availableDecoNames = ['Static', 'Prop', 'Env', 'Content', 'Children'];
|
export const availableDecoNames = ['Static', 'Prop', 'Env', 'Content', 'Children'];
|
||||||
export const dlightDefaultPackageName = '@inula/next';
|
export const dlightDefaultPackageName = '@openinula/next';
|
||||||
|
|
||||||
export const importMap = Object.fromEntries(
|
export const importMap = Object.fromEntries(
|
||||||
[
|
[
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
declare module '@babel/plugin-syntax-do-expressions';
|
declare module '@babel/plugin-syntax-do-expressions';
|
||||||
declare module '@babel/plugin-syntax-decorators';
|
declare module '@babel/plugin-syntax-decorators';
|
||||||
|
declare module '@babel/plugin-syntax-jsx';
|
||||||
|
declare module '@babel/plugin-syntax-typescript';
|
|
@ -1,14 +1,16 @@
|
||||||
import syntaxDecorators from '@babel/plugin-syntax-decorators';
|
import syntaxDecorators from '@babel/plugin-syntax-decorators';
|
||||||
|
import syntaxJSX from '@babel/plugin-syntax-jsx';
|
||||||
|
import syntaxTypescript from '@babel/plugin-syntax-typescript';
|
||||||
import dlight from './plugin';
|
import dlight from './plugin';
|
||||||
import { type DLightOption } from './types';
|
import { type DLightOption } from './types';
|
||||||
import { type ConfigAPI, type TransformOptions } from '@babel/core';
|
import { type ConfigAPI, type TransformOptions } from '@babel/core';
|
||||||
import { plugin as fn2Class } from '@inula/class-transformer';
|
import { plugin as fn2Class } from '@openinula/class-transformer';
|
||||||
|
|
||||||
export default function (_: ConfigAPI, options: DLightOption): TransformOptions {
|
export default function (_: ConfigAPI, options: DLightOption): TransformOptions {
|
||||||
return {
|
return {
|
||||||
plugins: [
|
plugins: [
|
||||||
['@babel/plugin-syntax-jsx'],
|
syntaxJSX.default ?? syntaxJSX,
|
||||||
['@babel/plugin-syntax-typescript', { isTSX: true }],
|
[syntaxTypescript.default ?? syntaxTypescript, { isTSX: true }],
|
||||||
[syntaxDecorators.default ?? syntaxDecorators, { legacy: true }],
|
[syntaxDecorators.default ?? syntaxDecorators, { legacy: true }],
|
||||||
fn2Class,
|
fn2Class,
|
||||||
[dlight, options],
|
[dlight, options],
|
||||||
|
|
|
@ -2,10 +2,10 @@ import type babel from '@babel/core';
|
||||||
import { type types as t, type NodePath } from '@babel/core';
|
import { type types as t, type NodePath } from '@babel/core';
|
||||||
import { type PropertyContainer, type HTMLTags, type SnippetPropSubDepMap } from './types';
|
import { type PropertyContainer, type HTMLTags, type SnippetPropSubDepMap } from './types';
|
||||||
import { minimatch } from 'minimatch';
|
import { minimatch } from 'minimatch';
|
||||||
import { parseView, ViewUnit } from '@inula/view-parser';
|
import { parseView, ViewUnit } from '@openinula/view-parser';
|
||||||
import { parseView as parseJSX } from 'jsx-view-parser';
|
import { parseView as parseJSX } from 'jsx-view-parser';
|
||||||
import { parseReactivity } from '@inula/reactivity-parser';
|
import { parseReactivity } from '@openinula/reactivity-parser';
|
||||||
import { generateSnippet, generateView } from '@inula/view-generator';
|
import { generateSnippet, generateView } from '@openinula/view-generator';
|
||||||
import {
|
import {
|
||||||
alterAttributeMap,
|
alterAttributeMap,
|
||||||
availableDecoNames,
|
availableDecoNames,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@inula/class-transformer",
|
"name": "@openinula/class-transformer",
|
||||||
"version": "0.0.0",
|
"version": "0.0.1",
|
||||||
"description": "Inula view generator",
|
"description": "Inula view generator",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"inula"
|
"inula"
|
||||||
|
|
|
@ -19,7 +19,7 @@ export class ThisPatcher {
|
||||||
(def): def is Exclude<t.ClassBody['body'][number], t.TSIndexSignature | t.StaticBlock> =>
|
(def): def is Exclude<t.ClassBody['body'][number], t.TSIndexSignature | t.StaticBlock> =>
|
||||||
!this.t.isTSIndexSignature(def) && !this.t.isStaticBlock(def)
|
!this.t.isTSIndexSignature(def) && !this.t.isStaticBlock(def)
|
||||||
)
|
)
|
||||||
.map(def => ('name' in def.key ? def.key.name : null));
|
.map(def => (def?.key?.name ? def.key.name : null));
|
||||||
|
|
||||||
for (const memberOrMethod of classBodyNode.body) {
|
for (const memberOrMethod of classBodyNode.body) {
|
||||||
classPath.scope.traverse(memberOrMethod, {
|
classPath.scope.traverse(memberOrMethod, {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@inula/error-handler",
|
"name": "@openinula/error-handler",
|
||||||
"version": "1.0.0-alpha.0",
|
"version": "0.0.1",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "IanDx",
|
"name": "IanDx",
|
||||||
"email": "iandxssxx@gmail.com"
|
"email": "iandxssxx@gmail.com"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "jsx-view-parser",
|
"name": "jsx-view-parser",
|
||||||
"version": "0.0.0",
|
"version": "0.0.1",
|
||||||
"description": "Inula jsx parser",
|
"description": "Inula jsx parser",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "IanDx",
|
"name": "IanDx",
|
||||||
|
|
|
@ -537,48 +537,46 @@ export class ViewParser {
|
||||||
|
|
||||||
private pareFor(node: t.JSXElement) {
|
private pareFor(node: t.JSXElement) {
|
||||||
// ---- Get array
|
// ---- Get array
|
||||||
const arrayContainer = this.findProp(node, "array")
|
const arrayContainer = this.findProp(node, 'array');
|
||||||
if (!arrayContainer) throw new Error("Missing [array] prop in for loop")
|
if (!arrayContainer) throw new Error('Missing [array] prop in for loop');
|
||||||
if (!this.t.isJSXExpressionContainer(arrayContainer.value)) throw new Error("Expected expression container for [array] prop")
|
if (!this.t.isJSXExpressionContainer(arrayContainer.value)) throw new Error('Expected expression container for [array] prop');
|
||||||
const array = arrayContainer.value.expression
|
const array = arrayContainer.value.expression;
|
||||||
if (this.t.isJSXEmptyExpression(array)) throw new Error("Expected [array] expression not empty")
|
if (this.t.isJSXEmptyExpression(array)) throw new Error('Expected [array] expression not empty');
|
||||||
|
|
||||||
// ---- Get key
|
// ---- Get key
|
||||||
const keyProp = this.findProp(node, "key")
|
const keyProp = this.findProp(node, 'key');
|
||||||
let key: t.Expression = this.t.nullLiteral()
|
let key: t.Expression = this.t.nullLiteral();
|
||||||
if (keyProp) {
|
if (keyProp) {
|
||||||
if (!(
|
if (!this.t.isJSXExpressionContainer(keyProp.value)) throw new Error('Expected expression container');
|
||||||
this.t.isJSXExpressionContainer(keyProp.value) &&
|
if (this.t.isJSXEmptyExpression(keyProp.value.expression)) throw new Error('Expected expression not empty');
|
||||||
this.t.isFunction(keyProp.value.expression)
|
key = keyProp.value.expression;
|
||||||
)) throw new Error("Expected expression container")
|
|
||||||
key = keyProp.value.expression
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Get Item
|
// ---- Get Item
|
||||||
const itemProp = this.findProp(node, "item")
|
const itemProp = this.findProp(node, 'item');
|
||||||
if (!itemProp) throw new Error("Missing [item] prop in for loop")
|
if (!itemProp) throw new Error('Missing [item] prop in for loop');
|
||||||
if (!this.t.isJSXExpressionContainer(itemProp.value)) throw new Error("Expected expression container for [item] prop")
|
if (!this.t.isJSXExpressionContainer(itemProp.value)) throw new Error('Expected expression container for [item] prop');
|
||||||
const item = itemProp.value.expression
|
const item = itemProp.value.expression;
|
||||||
if (this.t.isJSXEmptyExpression(item)) throw new Error("Expected [item] expression not empty")
|
if (this.t.isJSXEmptyExpression(item)) throw new Error('Expected [item] expression not empty');
|
||||||
// ---- ObjectExpression to ObjectPattern / ArrayExpression to ArrayPattern
|
// ---- ObjectExpression to ObjectPattern / ArrayExpression to ArrayPattern
|
||||||
this.traverse(this.wrapWithFile(item), {
|
this.traverse(this.wrapWithFile(item), {
|
||||||
ObjectExpression: (path) => {
|
ObjectExpression: (path) => {
|
||||||
path.type = "ObjectPattern" as any
|
path.node.type = 'ObjectPattern' as any;
|
||||||
},
|
},
|
||||||
ArrayExpression: (path) => {
|
ArrayExpression: (path) => {
|
||||||
path.type = "ArrayPattern" as any
|
path.node.type = 'ArrayPattern' as any;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
// ---- Get children
|
// ---- Get children
|
||||||
const children = this.t.jsxFragment(this.t.jsxOpeningFragment(), this.t.jsxClosingFragment(), node.children)
|
const children = this.t.jsxFragment(this.t.jsxOpeningFragment(), this.t.jsxClosingFragment(), node.children);
|
||||||
|
|
||||||
this.viewUnits.push({
|
this.viewUnits.push({
|
||||||
type: "for",
|
type: 'for',
|
||||||
key,
|
key,
|
||||||
item: item as t.LVal,
|
item: item as t.LVal,
|
||||||
array,
|
array,
|
||||||
children: this.parseView(children)
|
children: this.parseView(children)
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "@inula/reactivity-parser",
|
"name": "@openinula/reactivity-parser",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "IanDx",
|
"name": "IanDx",
|
||||||
|
@ -29,8 +29,8 @@
|
||||||
"vitest": "^0.34.5"
|
"vitest": "^0.34.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@inula/error-handler": "workspace:*",
|
"@openinula/error-handler": "workspace:*",
|
||||||
"@inula/view-parser": "workspace:*"
|
"@openinula/view-parser": "workspace:*"
|
||||||
},
|
},
|
||||||
"tsup": {
|
"tsup": {
|
||||||
"entry": [
|
"entry": [
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { createErrorHandler } from '@inula/error-handler';
|
import { createErrorHandler } from '@openinula/error-handler';
|
||||||
|
|
||||||
export const DLError = createErrorHandler('ReactivityParser', {
|
export const DLError = createErrorHandler('ReactivityParser', {
|
||||||
1: 'Invalid ViewUnit type',
|
1: 'Invalid ViewUnit type',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { type ViewUnit } from '@inula/view-parser';
|
import { type ViewUnit } from '@openinula/view-parser';
|
||||||
import { ReactivityParser } from './parser';
|
import { ReactivityParser } from './parser';
|
||||||
import { type ViewParticle, type ReactivityParserConfig } from './types';
|
import { type ViewParticle, type ReactivityParserConfig } from './types';
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ import {
|
||||||
type SnippetUnit,
|
type SnippetUnit,
|
||||||
SwitchUnit,
|
SwitchUnit,
|
||||||
TryUnit,
|
TryUnit,
|
||||||
} from '@inula/view-parser';
|
} from '@openinula/view-parser';
|
||||||
import { DLError } from './error';
|
import { DLError } from './error';
|
||||||
|
|
||||||
export class ReactivityParser {
|
export class ReactivityParser {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import babelApi, { parseSync, type types as t } from '@babel/core';
|
import babelApi, { parseSync, type types as t } from '@babel/core';
|
||||||
import { type ReactivityParserConfig } from '../types';
|
import { type ReactivityParserConfig } from '../types';
|
||||||
import { parseView as pV, type ViewParserConfig } from '@inula/view-parser';
|
import { parseView as pV, type ViewParserConfig } from '@openinula/view-parser';
|
||||||
import { parseReactivity as pR } from '../index';
|
import { parseReactivity as pR } from '../index';
|
||||||
|
|
||||||
const htmlTags = [
|
const htmlTags = [
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "@inula/view-generator",
|
"name": "@openinula/view-generator",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "IanDx",
|
"name": "IanDx",
|
||||||
|
@ -25,10 +25,10 @@
|
||||||
"@types/node": "^20.10.5",
|
"@types/node": "^20.10.5",
|
||||||
"tsup": "^6.7.0",
|
"tsup": "^6.7.0",
|
||||||
"typescript": "^5.3.2",
|
"typescript": "^5.3.2",
|
||||||
"@inula/reactivity-parser": "workspace:*"
|
"@openinula/reactivity-parser": "workspace:*"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@inula/error-handler": "workspace:*"
|
"@openinula/error-handler": "workspace:*"
|
||||||
},
|
},
|
||||||
"tsup": {
|
"tsup": {
|
||||||
"entry": [
|
"entry": [
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { type types as t, type traverse } from '@babel/core';
|
import { type types as t, type traverse } from '@babel/core';
|
||||||
import { type ViewParticle } from '@inula/reactivity-parser';
|
import { type ViewParticle } from '@openinula/reactivity-parser';
|
||||||
import { type SnippetPropMap, type ViewGeneratorConfig } from '../types';
|
import { type SnippetPropMap, type ViewGeneratorConfig } from '../types';
|
||||||
import ViewGenerator from '../ViewGenerator';
|
import ViewGenerator from '../ViewGenerator';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { type types as t } from '@babel/core';
|
import { type types as t } from '@babel/core';
|
||||||
import { type DependencyProp, type ViewParticle } from '@inula/reactivity-parser';
|
import { type DependencyProp, type ViewParticle } from '@openinula/reactivity-parser';
|
||||||
import LifecycleGenerator from './LifecycleGenerator';
|
import LifecycleGenerator from './LifecycleGenerator';
|
||||||
|
|
||||||
export default class PropViewGenerator extends LifecycleGenerator {
|
export default class PropViewGenerator extends LifecycleGenerator {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { type types as t } from '@babel/core';
|
import { type types as t } from '@babel/core';
|
||||||
import { type ViewParticle } from '@inula/reactivity-parser';
|
import { type ViewParticle } from '@openinula/reactivity-parser';
|
||||||
import ViewGenerator from './ViewGenerator';
|
import ViewGenerator from './ViewGenerator';
|
||||||
|
|
||||||
export default class MainViewGenerator extends ViewGenerator {
|
export default class MainViewGenerator extends ViewGenerator {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { type types as t } from '@babel/core';
|
import { type types as t } from '@babel/core';
|
||||||
import { type DependencyProp, type CompParticle, type ViewParticle } from '@inula/reactivity-parser';
|
import { type DependencyProp, type CompParticle, type ViewParticle } from '@openinula/reactivity-parser';
|
||||||
import ForwardPropGenerator from '../HelperGenerators/ForwardPropGenerator';
|
import ForwardPropGenerator from '../HelperGenerators/ForwardPropGenerator';
|
||||||
|
|
||||||
export default class CompGenerator extends ForwardPropGenerator {
|
export default class CompGenerator extends ForwardPropGenerator {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { type types as t } from '@babel/core';
|
import { type types as t } from '@babel/core';
|
||||||
import { type ViewParticle, type DependencyProp, type EnvParticle } from '@inula/reactivity-parser';
|
import { type ViewParticle, type DependencyProp, type EnvParticle } from '@openinula/reactivity-parser';
|
||||||
import PropViewGenerator from '../HelperGenerators/PropViewGenerator';
|
import PropViewGenerator from '../HelperGenerators/PropViewGenerator';
|
||||||
|
|
||||||
export default class EnvGenerator extends PropViewGenerator {
|
export default class EnvGenerator extends PropViewGenerator {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { type types as t } from '@babel/core';
|
import { type types as t } from '@babel/core';
|
||||||
import { type ExpParticle } from '@inula/reactivity-parser';
|
import { type ExpParticle } from '@openinula/reactivity-parser';
|
||||||
import ElementGenerator from '../HelperGenerators/ElementGenerator';
|
import ElementGenerator from '../HelperGenerators/ElementGenerator';
|
||||||
import { DLError } from '../error';
|
import { DLError } from '../error';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { type types as t } from '@babel/core';
|
import { type types as t } from '@babel/core';
|
||||||
import BaseGenerator from '../HelperGenerators/BaseGenerator';
|
import BaseGenerator from '../HelperGenerators/BaseGenerator';
|
||||||
import { type ForParticle, type ViewParticle } from '@inula/reactivity-parser';
|
import { type ForParticle, type ViewParticle } from '@openinula/reactivity-parser';
|
||||||
|
|
||||||
export default class ForGenerator extends BaseGenerator {
|
export default class ForGenerator extends BaseGenerator {
|
||||||
run() {
|
run() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { type types as t } from '@babel/core';
|
import { type types as t } from '@babel/core';
|
||||||
import { type HTMLParticle } from '@inula/reactivity-parser';
|
import { type HTMLParticle } from '@openinula/reactivity-parser';
|
||||||
import HTMLPropGenerator from '../HelperGenerators/HTMLPropGenerator';
|
import HTMLPropGenerator from '../HelperGenerators/HTMLPropGenerator';
|
||||||
|
|
||||||
export default class HTMLGenerator extends HTMLPropGenerator {
|
export default class HTMLGenerator extends HTMLPropGenerator {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { type types as t } from '@babel/core';
|
import { type types as t } from '@babel/core';
|
||||||
import { type IfParticle, type IfBranch } from '@inula/reactivity-parser';
|
import { type IfParticle, type IfBranch } from '@openinula/reactivity-parser';
|
||||||
import CondGenerator from '../HelperGenerators/CondGenerator';
|
import CondGenerator from '../HelperGenerators/CondGenerator';
|
||||||
|
|
||||||
export default class IfGenerator extends CondGenerator {
|
export default class IfGenerator extends CondGenerator {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { type DependencyProp, type SnippetParticle } from '@inula/reactivity-parser';
|
import { type DependencyProp, type SnippetParticle } from '@openinula/reactivity-parser';
|
||||||
import type { types as t } from '@babel/core';
|
import type { types as t } from '@babel/core';
|
||||||
import PropViewGenerator from '../HelperGenerators/PropViewGenerator';
|
import PropViewGenerator from '../HelperGenerators/PropViewGenerator';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { type types as t } from '@babel/core';
|
import { type types as t } from '@babel/core';
|
||||||
import { SwitchBranch, SwitchParticle } from '@inula/reactivity-parser';
|
import { SwitchBranch, SwitchParticle } from '@openinula/reactivity-parser';
|
||||||
import CondGenerator from '../HelperGenerators/CondGenerator';
|
import CondGenerator from '../HelperGenerators/CondGenerator';
|
||||||
|
|
||||||
export default class SwitchGenerator extends CondGenerator {
|
export default class SwitchGenerator extends CondGenerator {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { type types as t } from '@babel/core';
|
import { type types as t } from '@babel/core';
|
||||||
import { type HTMLParticle, type TemplateParticle } from '@inula/reactivity-parser';
|
import { type HTMLParticle, type TemplateParticle } from '@openinula/reactivity-parser';
|
||||||
import HTMLPropGenerator from '../HelperGenerators/HTMLPropGenerator';
|
import HTMLPropGenerator from '../HelperGenerators/HTMLPropGenerator';
|
||||||
|
|
||||||
export default class TemplateGenerator extends HTMLPropGenerator {
|
export default class TemplateGenerator extends HTMLPropGenerator {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { type types as t } from '@babel/core';
|
import { type types as t } from '@babel/core';
|
||||||
import { type TextParticle } from '@inula/reactivity-parser';
|
import { type TextParticle } from '@openinula/reactivity-parser';
|
||||||
import BaseGenerator from '../HelperGenerators/BaseGenerator';
|
import BaseGenerator from '../HelperGenerators/BaseGenerator';
|
||||||
|
|
||||||
export default class TextGenerator extends BaseGenerator {
|
export default class TextGenerator extends BaseGenerator {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { type types as t } from '@babel/core';
|
import { type types as t } from '@babel/core';
|
||||||
import BaseGenerator from '../HelperGenerators/BaseGenerator';
|
import BaseGenerator from '../HelperGenerators/BaseGenerator';
|
||||||
import { TryParticle, type ViewParticle } from '@inula/reactivity-parser';
|
import { TryParticle, type ViewParticle } from '@openinula/reactivity-parser';
|
||||||
|
|
||||||
export default class TryGenerator extends BaseGenerator {
|
export default class TryGenerator extends BaseGenerator {
|
||||||
run() {
|
run() {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { type types as t } from '@babel/core';
|
import { type types as t } from '@babel/core';
|
||||||
import { type ViewParticle } from '@inula/reactivity-parser';
|
import { type ViewParticle } from '@openinula/reactivity-parser';
|
||||||
import ViewGenerator from './ViewGenerator';
|
import ViewGenerator from './ViewGenerator';
|
||||||
|
|
||||||
export default class SnippetGenerator extends ViewGenerator {
|
export default class SnippetGenerator extends ViewGenerator {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { type types as t } from '@babel/core';
|
import { type types as t } from '@babel/core';
|
||||||
import { type ViewParticle } from '@inula/reactivity-parser';
|
import { type ViewParticle } from '@openinula/reactivity-parser';
|
||||||
import { type ViewGeneratorConfig } from './types';
|
import { type ViewGeneratorConfig } from './types';
|
||||||
import BaseGenerator, { prefixMap } from './HelperGenerators/BaseGenerator';
|
import BaseGenerator, { prefixMap } from './HelperGenerators/BaseGenerator';
|
||||||
import CompGenerator from './NodeGenerators/CompGenerator';
|
import CompGenerator from './NodeGenerators/CompGenerator';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { createErrorHandler } from '@inula/error-handler';
|
import { createErrorHandler } from '@openinula/error-handler';
|
||||||
|
|
||||||
export const DLError = createErrorHandler(
|
export const DLError = createErrorHandler(
|
||||||
'ViewGenerator',
|
'ViewGenerator',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { type ViewParticle } from '@inula/reactivity-parser';
|
import { type ViewParticle } from '@openinula/reactivity-parser';
|
||||||
import { type ViewGeneratorConfig } from './types';
|
import { type ViewGeneratorConfig } from './types';
|
||||||
import { type types as t } from '@babel/core';
|
import { type types as t } from '@babel/core';
|
||||||
import MainViewGenerator from './MainViewGenerator';
|
import MainViewGenerator from './MainViewGenerator';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "@inula/view-parser",
|
"name": "@openinula/view-parser",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "IanDx",
|
"name": "IanDx",
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
"vitest": "^0.34.5"
|
"vitest": "^0.34.5"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@inula/error-handler": "workspace:*"
|
"@openinula/error-handler": "workspace:*"
|
||||||
},
|
},
|
||||||
"tsup": {
|
"tsup": {
|
||||||
"entry": [
|
"entry": [
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { createErrorHandler } from '@inula/error-handler';
|
import { createErrorHandler } from '@openinula/error-handler';
|
||||||
|
|
||||||
export const DLError = createErrorHandler(
|
export const DLError = createErrorHandler(
|
||||||
'ViewParser',
|
'ViewParser',
|
||||||
{
|
{
|
||||||
1: "Invalid syntax in DLight's View, only accepts dot chain call expression",
|
1: 'Invalid syntax in DLight\'s View, only accepts dot chain call expression',
|
||||||
2: 'First argument of $0() must be an expression',
|
2: 'First argument of $0() must be an expression',
|
||||||
3: "Invalid syntax in DLight's View, only accepts expression as props",
|
3: 'Invalid syntax in DLight\'s View, only accepts expression as props',
|
||||||
4: 'Invalid Snippet calling, only accepts static snippet calling like `this.Snippet()`',
|
4: 'Invalid Snippet calling, only accepts static snippet calling like `this.Snippet()`',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue