diff --git a/.changeset/README.md b/.changeset/README.md new file mode 100644 index 0000000000000000000000000000000000000000..e5b6d8d6a67ad0dca8f20117fbfc72e076882d00 --- /dev/null +++ b/.changeset/README.md @@ -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) diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 0000000000000000000000000000000000000000..4369ffef323e13cb53ec16a1b96aa8ff1d3f7eea --- /dev/null +++ b/.changeset/config.json @@ -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": ["create-inula", "openinula", "inula-cli", "inula-dev-tools", "inula-intl", "inula-request", "inula-router", "inula-vite-app", "inula-webpack-app"] +} diff --git a/.gitignore b/.gitignore index d8b9e23eb59a1349a4c98658f58b91aa57ac31f6..ba7855d8678d98ca671dfac9842c7a64f2300373 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ build /packages/inula-router/connectRouter /packages/inula-router/router dist +.history \ No newline at end of file diff --git a/demos/benchmark/index.html b/demos/benchmark/index.html new file mode 100644 index 0000000000000000000000000000000000000000..bfe601bdbdcc8ab8bce901edf343a5c3c133fb20 --- /dev/null +++ b/demos/benchmark/index.html @@ -0,0 +1,11 @@ + + + + + Inula-next + + +
+ + + diff --git a/demos/benchmark/package.json b/demos/benchmark/package.json new file mode 100644 index 0000000000000000000000000000000000000000..cfc37a65ce83f3e1a45fe7d7c05c319a97ccbf91 --- /dev/null +++ b/demos/benchmark/package.json @@ -0,0 +1,25 @@ +{ + "name": "dev", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "dependencies": { + "@babel/standalone": "^7.22.4", + "@openinula/next": "workspace:*", + "@iandx/easy-css": "^0.10.14", + "babel-preset-inula-next": "workspace:*" + }, + "devDependencies": { + "typescript": "^5.2.2", + "vite": "^4.4.9", + "vite-plugin-inula-next": "workspace:*" + }, + "keywords": [ + "dlight.js" + ] +} diff --git a/demos/benchmark/src/main.jsx b/demos/benchmark/src/main.jsx new file mode 100644 index 0000000000000000000000000000000000000000..033aa9fff18c4d519a6deaead081490e32c3cc8a --- /dev/null +++ b/demos/benchmark/src/main.jsx @@ -0,0 +1,93 @@ +import { render, View } from '@openinula/next'; + + +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']; +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; +} + +function buildData(count) { + const data = new Array(count); + for (let i = 0; i < count; i++) { + data[i] = { + id: idCounter++, + label: `${adjectives[_random(adjectives.length)]} ${colours[_random(colours.length)]} ${nouns[_random(nouns.length)]}` + }; + } + return data; +} + +function Button ({ id, text, fn }) { + return ( +
+ +
+ ); +} + +function App () { + let data = []; + let selected = null; + function run() { + data = buildData(1000); + } + function runLots() { + data = buildData(10000); + } + function add() { + data.push(...buildData(1000)); + } + function update() { + for (let i = 0; i < data.length; i += 10) { + data[i].label += ' !!!'; + } + } + function swapRows() { + if (data.length > 998) { + [data[1], data[998]] = [data[998], data[1]]; + } + } + function clear() { + data = []; + } + function remove(id) { + data = data.filter(d => d.id !== id); + } + function select(id) { + selected = id; + } + + return ( +
+
+

Inula-next Keyed

+
+
+
+ + + + + + + +
+ +
+
+ ); +} + +render('main', App); diff --git a/demos/benchmark/vite.config.js b/demos/benchmark/vite.config.js new file mode 100644 index 0000000000000000000000000000000000000000..0531be34916f2e9b8e105424e3dd8ec67bf41be3 --- /dev/null +++ b/demos/benchmark/vite.config.js @@ -0,0 +1,13 @@ +import { defineConfig } from 'vite'; +import inula from 'vite-plugin-inula-next'; + +export default defineConfig({ + server: { + port: 4320, + }, + base: '', + optimizeDeps: { + disabled: true, + }, + plugins: [inula({ files: '**/*.{tsx,jsx}' })], +}); diff --git a/demos/v2/CHANGELOG.md b/demos/v2/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..03fce1079109bf07a6a65863be6b3b825a492a87 --- /dev/null +++ b/demos/v2/CHANGELOG.md @@ -0,0 +1,8 @@ +# dev + +## 0.0.1 + +### Patch Changes + +- Updated dependencies [2f9d373] + - babel-preset-inula-next@0.0.2 diff --git a/demos/v2/index.html b/demos/v2/index.html index 28fb962225a72c15c12f79106aafcc0b943ade3a..31a50a25e1810564c33c818942e01c60dd0096bd 100644 --- a/demos/v2/index.html +++ b/demos/v2/index.html @@ -7,6 +7,6 @@
- + diff --git a/demos/v2/package.json b/demos/v2/package.json index 63425f3aae553346e2193128feab2a2447961bd7..49f310fd38f5ca0961d8190e56f14e90fd5fa914 100644 --- a/demos/v2/package.json +++ b/demos/v2/package.json @@ -1,7 +1,7 @@ { "name": "dev", "private": true, - "version": "0.0.0", + "version": "0.0.1", "type": "module", "scripts": { "dev": "vite", @@ -10,7 +10,7 @@ }, "dependencies": { "@babel/standalone": "^7.22.4", - "@inula/next": "workspace:*", + "@openinula/next": "workspace:*", "@iandx/easy-css": "^0.10.14", "babel-preset-inula-next": "workspace:*" }, diff --git a/demos/v2/src/App.tsx b/demos/v2/src/App.tsx new file mode 100644 index 0000000000000000000000000000000000000000..e59b48823daefb072f06f1e80bd501b4e4ad54ab --- /dev/null +++ b/demos/v2/src/App.tsx @@ -0,0 +1,17 @@ +import { View, render } from '@openinula/next'; + +function MyComp() { + let count = 0; + const db = count * 2; + + return ( + <> +

Hello dlight fn comp

+
+ count: {count}, double is: {db} + +
+ + ); +} +render('main', MyComp); diff --git a/demos/v2/src/App.view.tsx b/demos/v2/src/App.view.tsx index 0e47914bfb6967eb221c4079f5d4fa015a05fef0..0c5587bfa25a01ab8e03b03bad0c68912bb45fbe 100644 --- a/demos/v2/src/App.view.tsx +++ b/demos/v2/src/App.view.tsx @@ -13,7 +13,7 @@ import { insertChildren, use, render, -} from '@inula/next'; +} from '@openinula/next'; // @ts-ignore function Button({ children, onClick }) { @@ -35,7 +35,7 @@ function Button({ children, onClick }) { } function ArrayModification() { - let arr = []; + const arr = []; willMount(() => {}); return (
@@ -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 ( +
+ count: {count}, double is: {doubleCount} + +
+ ); +} + +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 ( +
+ count: {count}, double is: {doubleCount} + +
+ ); +} + + + function MyComp() { 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 ( <>

Hello dlight fn comp

diff --git a/demos/v2/vite.config.ts b/demos/v2/vite.config.ts index 7029d548076eb1d8b08c26dac68ad98c8b2f6a9e..b1f901d005e402ef74bdc17c30e74d48331e360d 100644 --- a/demos/v2/vite.config.ts +++ b/demos/v2/vite.config.ts @@ -9,5 +9,5 @@ export default defineConfig({ optimizeDeps: { disabled: true, }, - plugins: [inula({ files: '**/*.{view,model}.{ts,js,tsx,jsx}', enableDevTools: true })], + plugins: [inula({ files: '**/*.{ts,js,tsx,jsx}' })], }); diff --git a/package.json b/package.json index 4eaba18d1602f7250afebaf3f623e10280f15d9b..3d6b47e86715301906a6000915977c514f0f9cb2 100644 --- a/package.json +++ b/package.json @@ -81,5 +81,9 @@ "engines": { "node": ">=10.x", "npm": ">=7.x" + }, + "dependencies": { + "@changesets/cli": "^2.27.1", + "changeset": "^0.2.6" } } diff --git a/packages/inula-cli/README.md b/packages/inula-cli/README.md index e60a1cd2de427475b3a9087258c5b2e0c9d3475a..c119d32182c59c7584eff9e82a22ee8dac7ad942 100644 --- a/packages/inula-cli/README.md +++ b/packages/inula-cli/README.md @@ -178,10 +178,10 @@ inula-cli的所有功能都围绕插件展开,插件可以很方便地让用 inula-cli支持用户集成已发布在npm仓库的插件,用户可以按需安装并运行这些插件。 -安装可以通过npm安装,这里以插件@inula/add为例: +安装可以通过npm安装,这里以插件@openinula/add为例: ```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 { ... - plugins:["@inula/add"] + plugins:["@openinula/add"] } ``` diff --git a/packages/inula-next-store/package.json b/packages/inula-next-store/package.json index cf40cc8e9f8522b994d0163787b9a3e91df18ff7..880c3972c07abe55284268481049a57545e97d13 100644 --- a/packages/inula-next-store/package.json +++ b/packages/inula-next-store/package.json @@ -1,5 +1,5 @@ { - "name": "@inula/store", + "name": "@openinula/store", "version": "0.0.0", "description": "DLight shared store", "author": { diff --git a/packages/inula-next/package.json b/packages/inula-next/package.json index 9136e106e8ed4908902c1fba4448a1176d32d483..3d65fa54df1464564977d3865efe1d010a0e9ede 100644 --- a/packages/inula-next/package.json +++ b/packages/inula-next/package.json @@ -1,12 +1,12 @@ { - "name": "@inula/next", - "version": "1.0.0-next.9", + "name": "@openinula/next", + "version": "0.0.1", "author": { "name": "IanDx", "email": "iandxssxx@gmail.com" }, "keywords": [ - "dlight.js" + "inula" ], "license": "MIT", "files": [ @@ -22,7 +22,7 @@ }, "dependencies": { "csstype": "^3.1.3", - "@inula/store": "workspace:*" + "@openinula/store": "workspace:*" }, "devDependencies": { "tsup": "^6.5.0" diff --git a/packages/inula-next/src/store.js b/packages/inula-next/src/store.js index 76aead7b369d17ce706164d6abb50ee7d0b536f1..199a98990c64432e9a95bca5ed0839144557852c 100644 --- a/packages/inula-next/src/store.js +++ b/packages/inula-next/src/store.js @@ -1,4 +1,4 @@ -import { Store } from '@inula/store'; +import { Store } from '@openinula/store'; // ---- Using external Store to store global and document // Because Store is a singleton, it is safe to use it as a global variable diff --git a/packages/inula-router/src/configs/package.json b/packages/inula-router/src/configs/package.json index c0954f5d85c020364e060f08cc9c9130b880a268..22be92db403f432662bd6dfe8d6b0e6c95238b93 100644 --- a/packages/inula-router/src/configs/package.json +++ b/packages/inula-router/src/configs/package.json @@ -1,4 +1,5 @@ { + "name": "inula-router-config", "module": "./esm/connectRouter.js", "main": "./cjs/connectRouter.js", "types": "./@types/index.d.ts", diff --git a/packages/transpiler/README.md b/packages/transpiler/README.md index c47e708a7fbbba3ac0b113d304a449487905de95..a6dd36320a421c8ea84c7053bcd826189dffeedb 100644 --- a/packages/transpiler/README.md +++ b/packages/transpiler/README.md @@ -27,7 +27,16 @@ This is a experimental package to implement [API2.0](https://gitee.com/openInula - [x] fragment - [ ] ref (to validate) - [ ] snippet - - [ ] for + - [x] for + +# 4.8 TODO +@YH +* Benchmark(result + comparison) +* Playground(@HQ publish) deploy +* PPT +* DEMO +* api2.1 compiled code + # function component syntax diff --git a/packages/transpiler/babel-preset-inula-next/CHANGELOG.md b/packages/transpiler/babel-preset-inula-next/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..4ba791fd5bc03d848c2e76b4782549e4994c04f9 --- /dev/null +++ b/packages/transpiler/babel-preset-inula-next/CHANGELOG.md @@ -0,0 +1,7 @@ +# babel-preset-inula-next + +## 0.0.2 + +### Patch Changes + +- 2f9d373: feat: change babel import diff --git a/packages/transpiler/babel-preset-inula-next/package.json b/packages/transpiler/babel-preset-inula-next/package.json index c5e8a43400927475f94e3f28742067532b8831bd..91a14b050f331b1db5f83271c131d771f93ff424 100644 --- a/packages/transpiler/babel-preset-inula-next/package.json +++ b/packages/transpiler/babel-preset-inula-next/package.json @@ -1,6 +1,6 @@ { "name": "babel-preset-inula-next", - "version": "0.0.1", + "version": "0.0.2", "author": { "name": "IanDx", "email": "iandxssxx@gmail.com" @@ -32,10 +32,10 @@ "@babel/core": "^7.23.3", "@babel/plugin-syntax-jsx": "7.16.7", "@babel/plugin-syntax-typescript": "^7.23.3", - "@inula/reactivity-parser": "workspace:*", - "@inula/view-generator": "workspace:*", - "@inula/view-parser": "workspace:*", - "@inula/class-transformer": "workspace:*", + "@openinula/reactivity-parser": "workspace:*", + "@openinula/view-generator": "workspace:*", + "@openinula/view-parser": "workspace:*", + "@openinula/class-transformer": "workspace:*", "jsx-view-parser": "workspace:*", "minimatch": "^9.0.3", "vitest": "^1.4.0" diff --git a/packages/transpiler/babel-preset-inula-next/src/const.ts b/packages/transpiler/babel-preset-inula-next/src/const.ts index eeba48dfc235e49df4c0c7aeaf392751fc1f128a..461f7594d2b88d9dcbe6e008349b4189cd4626fe 100644 --- a/packages/transpiler/babel-preset-inula-next/src/const.ts +++ b/packages/transpiler/babel-preset-inula-next/src/const.ts @@ -227,7 +227,7 @@ export const defaultHTMLTags = [ ]; export const availableDecoNames = ['Static', 'Prop', 'Env', 'Content', 'Children']; -export const dlightDefaultPackageName = '@inula/next'; +export const dlightDefaultPackageName = '@openinula/next'; export const importMap = Object.fromEntries( [ diff --git a/packages/transpiler/babel-preset-inula-next/src/global.d.ts b/packages/transpiler/babel-preset-inula-next/src/global.d.ts index 505ace20e05955a53eb9894a99862afb453a2094..e01cb60d9cef4f4be6cace2054e2b68ed44a290c 100644 --- a/packages/transpiler/babel-preset-inula-next/src/global.d.ts +++ b/packages/transpiler/babel-preset-inula-next/src/global.d.ts @@ -1,2 +1,4 @@ declare module '@babel/plugin-syntax-do-expressions'; declare module '@babel/plugin-syntax-decorators'; +declare module '@babel/plugin-syntax-jsx'; +declare module '@babel/plugin-syntax-typescript'; \ No newline at end of file diff --git a/packages/transpiler/babel-preset-inula-next/src/index.ts b/packages/transpiler/babel-preset-inula-next/src/index.ts index 3308173b19c508d555c035bf02e6fe6bf96b4b58..6dc09dbe5ee226272cce25e39a3222bede886500 100644 --- a/packages/transpiler/babel-preset-inula-next/src/index.ts +++ b/packages/transpiler/babel-preset-inula-next/src/index.ts @@ -1,14 +1,16 @@ 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 { type DLightOption } from './types'; 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 { return { plugins: [ - ['@babel/plugin-syntax-jsx'], - ['@babel/plugin-syntax-typescript', { isTSX: true }], + syntaxJSX.default ?? syntaxJSX, + [syntaxTypescript.default ?? syntaxTypescript, { isTSX: true }], [syntaxDecorators.default ?? syntaxDecorators, { legacy: true }], fn2Class, [dlight, options], diff --git a/packages/transpiler/babel-preset-inula-next/src/pluginProvider.ts b/packages/transpiler/babel-preset-inula-next/src/pluginProvider.ts index 203b3ee6615ed04c4e55849a92e249dc0f0cbd34..386fec16173994fe0471cc5103aaa6d28e9e0778 100644 --- a/packages/transpiler/babel-preset-inula-next/src/pluginProvider.ts +++ b/packages/transpiler/babel-preset-inula-next/src/pluginProvider.ts @@ -2,10 +2,10 @@ import type babel from '@babel/core'; import { type types as t, type NodePath } from '@babel/core'; import { type PropertyContainer, type HTMLTags, type SnippetPropSubDepMap } from './types'; 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 { parseReactivity } from '@inula/reactivity-parser'; -import { generateSnippet, generateView } from '@inula/view-generator'; +import { parseReactivity } from '@openinula/reactivity-parser'; +import { generateSnippet, generateView } from '@openinula/view-generator'; import { alterAttributeMap, availableDecoNames, diff --git a/packages/transpiler/class-transformer/package.json b/packages/transpiler/class-transformer/package.json index 7d6c5690d83ee98db5e8bdbfea5b8a61b36758a6..bf0fb948c1de05da1e1b9182ffbdba96694d9ffa 100644 --- a/packages/transpiler/class-transformer/package.json +++ b/packages/transpiler/class-transformer/package.json @@ -1,6 +1,6 @@ { - "name": "@inula/class-transformer", - "version": "0.0.0", + "name": "@openinula/class-transformer", + "version": "0.0.1", "description": "Inula view generator", "keywords": [ "inula" diff --git a/packages/transpiler/class-transformer/src/thisPatcher.ts b/packages/transpiler/class-transformer/src/thisPatcher.ts index aa88c121c84cab079b781c871e2ce2b19c50b276..654d30d72c84596341cacf95666bf2c5e536f034 100644 --- a/packages/transpiler/class-transformer/src/thisPatcher.ts +++ b/packages/transpiler/class-transformer/src/thisPatcher.ts @@ -19,7 +19,7 @@ export class ThisPatcher { (def): def is Exclude => !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) { classPath.scope.traverse(memberOrMethod, { diff --git a/packages/transpiler/error-handler/package.json b/packages/transpiler/error-handler/package.json index 3e34848f918b130f07198980fa96bbefe6aba651..c0437f0fa7c2e6ba61000d442ba093b57ff8e5d6 100644 --- a/packages/transpiler/error-handler/package.json +++ b/packages/transpiler/error-handler/package.json @@ -1,6 +1,6 @@ { - "name": "@inula/error-handler", - "version": "1.0.0-alpha.0", + "name": "@openinula/error-handler", + "version": "0.0.1", "author": { "name": "IanDx", "email": "iandxssxx@gmail.com" diff --git a/packages/transpiler/jsx-parser/package.json b/packages/transpiler/jsx-parser/package.json index 5fb1ac1bbf189193f31210896aafd690546b93b6..b9c8f6882830ce69ad6e0753cace7ad8e051bc51 100644 --- a/packages/transpiler/jsx-parser/package.json +++ b/packages/transpiler/jsx-parser/package.json @@ -1,6 +1,6 @@ { "name": "jsx-view-parser", - "version": "0.0.0", + "version": "0.0.1", "description": "Inula jsx parser", "author": { "name": "IanDx", diff --git a/packages/transpiler/jsx-parser/src/parser.ts b/packages/transpiler/jsx-parser/src/parser.ts index 83f5c15806e37075148828bed2f5d9a2a8bc1674..14a49619ae84dfe14d4621a4440512b94a842ceb 100644 --- a/packages/transpiler/jsx-parser/src/parser.ts +++ b/packages/transpiler/jsx-parser/src/parser.ts @@ -536,6 +536,47 @@ export class ViewParser { } private pareFor(node: t.JSXElement) { - // TODO + // ---- Get array + const arrayContainer = this.findProp(node, 'array'); + 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'); + const array = arrayContainer.value.expression; + if (this.t.isJSXEmptyExpression(array)) throw new Error('Expected [array] expression not empty'); + + // ---- Get key + const keyProp = this.findProp(node, 'key'); + let key: t.Expression = this.t.nullLiteral(); + if (keyProp) { + if (!this.t.isJSXExpressionContainer(keyProp.value)) throw new Error('Expected expression container'); + if (this.t.isJSXEmptyExpression(keyProp.value.expression)) throw new Error('Expected expression not empty'); + key = keyProp.value.expression; + } + + // ---- Get Item + const itemProp = this.findProp(node, 'item'); + 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'); + const item = itemProp.value.expression; + if (this.t.isJSXEmptyExpression(item)) throw new Error('Expected [item] expression not empty'); + // ---- ObjectExpression to ObjectPattern / ArrayExpression to ArrayPattern + this.traverse(this.wrapWithFile(item), { + ObjectExpression: (path) => { + path.node.type = 'ObjectPattern' as any; + }, + ArrayExpression: (path) => { + path.node.type = 'ArrayPattern' as any; + } + }); + + // ---- Get children + const children = this.t.jsxFragment(this.t.jsxOpeningFragment(), this.t.jsxClosingFragment(), node.children); + + this.viewUnits.push({ + type: 'for', + key, + item: item as t.LVal, + array, + children: this.parseView(children) + }); } } diff --git a/packages/transpiler/jsx-parser/src/test/ElementUnit.test.ts b/packages/transpiler/jsx-parser/src/test/ElementUnit.test.ts index 1e015ffe38638cdc861fa5490fcbdcd55eaa28d2..09f082dbdaa1d20b27b716cc7c46c0cec4a264cd 100644 --- a/packages/transpiler/jsx-parser/src/test/ElementUnit.test.ts +++ b/packages/transpiler/jsx-parser/src/test/ElementUnit.test.ts @@ -186,13 +186,4 @@ describe('ElementUnit', () => { const htmlUnit = viewUnits[0] as HTMLUnit; expect(htmlUnit.children!.length).toBe(4); }); - - it('should correctly parse the children', () => { - const viewUnits = parse('
ok
'); - const htmlUnit = viewUnits[0] as HTMLUnit; - const firstChild = htmlUnit.children![0]; - expect(firstChild.type).toBe('html'); - expect(t.isStringLiteral((firstChild as HTMLUnit).tag, { value: 'div' })).toBeTruthy(); - expect((firstChild as HTMLUnit).children![0].type).toBe('text'); - }); }); diff --git a/packages/transpiler/jsx-parser/src/test/ForUnit.test.ts b/packages/transpiler/jsx-parser/src/test/ForUnit.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..3fea384ec86c909c8d830ed24f6d1931cf9b22b0 --- /dev/null +++ b/packages/transpiler/jsx-parser/src/test/ForUnit.test.ts @@ -0,0 +1,11 @@ +import { describe, expect, it } from 'vitest'; +import { parse } from './mock'; + + +describe('ForUnit', () => { + it('should identify for unit', () => { + const viewUnits = parse('
{item}
'); + expect(viewUnits.length).toBe(1); + expect(viewUnits[0].type).toBe('for'); + }); +}); \ No newline at end of file diff --git a/packages/transpiler/jsx-parser/src/test/TemplateUnit.test.ts b/packages/transpiler/jsx-parser/src/test/TemplateUnit.test.ts index 671def94a2c8bfbf8b9826738148ba093870b93d..ca8c79f0ad9cf2f452a061923bf52732445b028b 100644 --- a/packages/transpiler/jsx-parser/src/test/TemplateUnit.test.ts +++ b/packages/transpiler/jsx-parser/src/test/TemplateUnit.test.ts @@ -17,7 +17,7 @@ describe('TemplateUnit', () => { expect(viewUnits[0].type).toBe('template'); }); - it("should correctly parse a nested HTMLUnit's structure into a template", () => { + it('should correctly parse a nested HTMLUnit\'s structure into a template', () => { const viewUnits = parse('
'); const template = (viewUnits[0] as TemplateUnit).template; @@ -28,7 +28,7 @@ describe('TemplateUnit', () => { }); // ---- Props - it("should correctly parse the path of TemplateUnit's dynamic props in root element", () => { + it('should correctly parse the path of TemplateUnit\'s dynamic props in root element', () => { const viewUnits = parse('
'); const dynamicProps = (viewUnits[0] as TemplateUnit).props; @@ -37,7 +37,7 @@ describe('TemplateUnit', () => { expect(prop.path).toHaveLength(0); }); - it("should correctly parse the path of TemplateUnit's dynamic props in nested element", () => { + it('should correctly parse the path of TemplateUnit\'s dynamic props in nested element', () => { const viewUnits = parse('
'); const dynamicProps = (viewUnits[0] as TemplateUnit).props!; @@ -47,17 +47,17 @@ describe('TemplateUnit', () => { expect(prop.path[0]).toBe(0); }); - it("should correctly parse the path of TemplateUnit's dynamic props with mutable particles ahead", () => { + it('should correctly parse the path of TemplateUnit\'s dynamic props with mutable particles ahead', () => { const viewUnits = parse('
'); const dynamicProps = (viewUnits[0] as TemplateUnit).props!; expect(dynamicProps).toHaveLength(1); const prop = dynamicProps[0]!; expect(prop.path).toHaveLength(1); - expect(prop.path[0]).toBe(1); + expect(prop.path[0]).toBe(0); }); - it("should correctly parse the path of TemplateUnit's mutableUnits", () => { + it('should correctly parse the path of TemplateUnit\'s mutableUnits', () => { const viewUnits = parse('
'); const mutableParticles = (viewUnits[0] as TemplateUnit).mutableUnits!; @@ -67,7 +67,7 @@ describe('TemplateUnit', () => { expect(particle.path[0]).toBe(0); }); - it("should correctly parse the path of multiple TemplateUnit's mutableUnits", () => { + it('should correctly parse the path of multiple TemplateUnit\'s mutableUnits', () => { const viewUnits = parse('
'); const mutableParticles = (viewUnits[0] as TemplateUnit).mutableUnits!; @@ -77,6 +77,6 @@ describe('TemplateUnit', () => { expect(firstParticle.path[0]).toBe(0); const secondParticle = mutableParticles[1]!; expect(secondParticle.path).toHaveLength(1); - expect(secondParticle.path[0]).toBe(2); + expect(secondParticle.path[0]).toBe(-1); }); }); diff --git a/packages/transpiler/jsx-parser/src/types.ts b/packages/transpiler/jsx-parser/src/types.ts index e860ad9292787ac9e8a9215c3844795596fb74e9..238335ea397e6ec76f258334799adba02db8d51e 100644 --- a/packages/transpiler/jsx-parser/src/types.ts +++ b/packages/transpiler/jsx-parser/src/types.ts @@ -59,6 +59,7 @@ export interface IfUnit { export interface ExpUnit { type: 'exp'; content: UnitProp; + props: Record; } export interface EnvUnit { diff --git a/packages/transpiler/reactivity-parser/package.json b/packages/transpiler/reactivity-parser/package.json index 3fc66fa5236eba0e18ada616299c571a70d8ab34..568297d381db46d7257d35b4288898d04871f716 100644 --- a/packages/transpiler/reactivity-parser/package.json +++ b/packages/transpiler/reactivity-parser/package.json @@ -1,5 +1,5 @@ { - "name": "@inula/reactivity-parser", + "name": "@openinula/reactivity-parser", "version": "0.0.1", "author": { "name": "IanDx", @@ -29,8 +29,8 @@ "vitest": "^0.34.5" }, "dependencies": { - "@inula/error-handler": "workspace:*", - "@inula/view-parser": "workspace:*" + "@openinula/error-handler": "workspace:*", + "@openinula/view-parser": "workspace:*" }, "tsup": { "entry": [ diff --git a/packages/transpiler/reactivity-parser/src/error.ts b/packages/transpiler/reactivity-parser/src/error.ts index 987b7efda060a934b52a460e1e35b02a14ab16eb..8a5b5695392a99e1aa3a8d271681d51d403e945a 100644 --- a/packages/transpiler/reactivity-parser/src/error.ts +++ b/packages/transpiler/reactivity-parser/src/error.ts @@ -1,4 +1,4 @@ -import { createErrorHandler } from '@inula/error-handler'; +import { createErrorHandler } from '@openinula/error-handler'; export const DLError = createErrorHandler('ReactivityParser', { 1: 'Invalid ViewUnit type', diff --git a/packages/transpiler/reactivity-parser/src/index.ts b/packages/transpiler/reactivity-parser/src/index.ts index 20cddd44e3f4c231c066031cc953becf56d70877..06076d17af9d0c27bf5b81dc10ecc317bd7fc589 100644 --- a/packages/transpiler/reactivity-parser/src/index.ts +++ b/packages/transpiler/reactivity-parser/src/index.ts @@ -1,4 +1,4 @@ -import { type ViewUnit } from '@inula/view-parser'; +import { type ViewUnit } from '@openinula/view-parser'; import { ReactivityParser } from './parser'; import { type ViewParticle, type ReactivityParserConfig } from './types'; diff --git a/packages/transpiler/reactivity-parser/src/parser.ts b/packages/transpiler/reactivity-parser/src/parser.ts index 336f94542df14ba05b0904076af07a540126a12b..ce708123bc66217aa1c39c0b6530e833cd47c403 100644 --- a/packages/transpiler/reactivity-parser/src/parser.ts +++ b/packages/transpiler/reactivity-parser/src/parser.ts @@ -30,7 +30,7 @@ import { type SnippetUnit, SwitchUnit, TryUnit, -} from '@inula/view-parser'; +} from '@openinula/view-parser'; import { DLError } from './error'; export class ReactivityParser { diff --git a/packages/transpiler/reactivity-parser/src/test/mock.ts b/packages/transpiler/reactivity-parser/src/test/mock.ts index 73a54b24a9d25542c3f4bc967e1825325c1be45c..77e80c03fc76f55d9038a78cbbc449d43389c6fe 100644 --- a/packages/transpiler/reactivity-parser/src/test/mock.ts +++ b/packages/transpiler/reactivity-parser/src/test/mock.ts @@ -1,6 +1,6 @@ import babelApi, { parseSync, type types as t } from '@babel/core'; 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'; const htmlTags = [ diff --git a/packages/transpiler/view-generator/package.json b/packages/transpiler/view-generator/package.json index 66817afb147d56b5336d637f533095d894a94b57..45387188cd275fe625ac93a28823df57643dffdc 100644 --- a/packages/transpiler/view-generator/package.json +++ b/packages/transpiler/view-generator/package.json @@ -1,5 +1,5 @@ { - "name": "@inula/view-generator", + "name": "@openinula/view-generator", "version": "0.0.1", "author": { "name": "IanDx", @@ -25,10 +25,10 @@ "@types/node": "^20.10.5", "tsup": "^6.7.0", "typescript": "^5.3.2", - "@inula/reactivity-parser": "workspace:*" + "@openinula/reactivity-parser": "workspace:*" }, "dependencies": { - "@inula/error-handler": "workspace:*" + "@openinula/error-handler": "workspace:*" }, "tsup": { "entry": [ diff --git a/packages/transpiler/view-generator/src/HelperGenerators/BaseGenerator.ts b/packages/transpiler/view-generator/src/HelperGenerators/BaseGenerator.ts index f66c62d7baf7c21f95874a55303d6e4cd3848d51..05dbaf53bf7d587993fe011a974b82a5f576cde3 100644 --- a/packages/transpiler/view-generator/src/HelperGenerators/BaseGenerator.ts +++ b/packages/transpiler/view-generator/src/HelperGenerators/BaseGenerator.ts @@ -1,5 +1,5 @@ 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 ViewGenerator from '../ViewGenerator'; diff --git a/packages/transpiler/view-generator/src/HelperGenerators/PropViewGenerator.ts b/packages/transpiler/view-generator/src/HelperGenerators/PropViewGenerator.ts index 0e5d4627dd8c4f3b8cb2c3e1f524afdc3a9cbd66..394b5c0a5498480b60673b8b1d778a15ef214caf 100644 --- a/packages/transpiler/view-generator/src/HelperGenerators/PropViewGenerator.ts +++ b/packages/transpiler/view-generator/src/HelperGenerators/PropViewGenerator.ts @@ -1,5 +1,5 @@ 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'; export default class PropViewGenerator extends LifecycleGenerator { diff --git a/packages/transpiler/view-generator/src/MainViewGenerator.ts b/packages/transpiler/view-generator/src/MainViewGenerator.ts index 122b70fc9243e16662113d79b6ed3828ae12b26b..aae24879c9a5e14201ca7a4d6ed845573c2226ca 100644 --- a/packages/transpiler/view-generator/src/MainViewGenerator.ts +++ b/packages/transpiler/view-generator/src/MainViewGenerator.ts @@ -1,5 +1,5 @@ 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'; export default class MainViewGenerator extends ViewGenerator { diff --git a/packages/transpiler/view-generator/src/NodeGenerators/CompGenerator.ts b/packages/transpiler/view-generator/src/NodeGenerators/CompGenerator.ts index 012a97f57036b95ba173638893ced2a9d81efa22..5397c0fc7b9e150a70eec5e1cf870b2ee4fc94af 100644 --- a/packages/transpiler/view-generator/src/NodeGenerators/CompGenerator.ts +++ b/packages/transpiler/view-generator/src/NodeGenerators/CompGenerator.ts @@ -1,5 +1,5 @@ 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'; export default class CompGenerator extends ForwardPropGenerator { diff --git a/packages/transpiler/view-generator/src/NodeGenerators/EnvGenerator.ts b/packages/transpiler/view-generator/src/NodeGenerators/EnvGenerator.ts index ce2299ac6bfc740604fd45d2411daaf53a6ea977..66819be8d58861df26ba6aa5f669e3527a7b3dce 100644 --- a/packages/transpiler/view-generator/src/NodeGenerators/EnvGenerator.ts +++ b/packages/transpiler/view-generator/src/NodeGenerators/EnvGenerator.ts @@ -1,5 +1,5 @@ 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'; export default class EnvGenerator extends PropViewGenerator { diff --git a/packages/transpiler/view-generator/src/NodeGenerators/ExpGenerator.ts b/packages/transpiler/view-generator/src/NodeGenerators/ExpGenerator.ts index b9781b971b260ba4f84704fdbfe80ef1839ebf38..ece38f09d343cb4e7a1a55c9260ec589da6234a2 100644 --- a/packages/transpiler/view-generator/src/NodeGenerators/ExpGenerator.ts +++ b/packages/transpiler/view-generator/src/NodeGenerators/ExpGenerator.ts @@ -1,5 +1,5 @@ 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 { DLError } from '../error'; diff --git a/packages/transpiler/view-generator/src/NodeGenerators/ForGenerator.ts b/packages/transpiler/view-generator/src/NodeGenerators/ForGenerator.ts index 5daa289be745e627307efcc009969fb642c4e274..e172c7032dd252481464993f6d6e55f97b2eb677 100644 --- a/packages/transpiler/view-generator/src/NodeGenerators/ForGenerator.ts +++ b/packages/transpiler/view-generator/src/NodeGenerators/ForGenerator.ts @@ -1,6 +1,6 @@ import { type types as t } from '@babel/core'; 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 { run() { diff --git a/packages/transpiler/view-generator/src/NodeGenerators/HTMLGenerator.ts b/packages/transpiler/view-generator/src/NodeGenerators/HTMLGenerator.ts index ea8c4b990780812bd65496da992c4466d8319aa5..d6ff33e81ef5eafece67c50e496981a32b357192 100644 --- a/packages/transpiler/view-generator/src/NodeGenerators/HTMLGenerator.ts +++ b/packages/transpiler/view-generator/src/NodeGenerators/HTMLGenerator.ts @@ -1,5 +1,5 @@ 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'; export default class HTMLGenerator extends HTMLPropGenerator { diff --git a/packages/transpiler/view-generator/src/NodeGenerators/IfGenerator.ts b/packages/transpiler/view-generator/src/NodeGenerators/IfGenerator.ts index 000b4f16fe681f0f64823ea3f05d659bc21d4170..5ab4df356ec8c64ef2a93648f215d114a3df3579 100644 --- a/packages/transpiler/view-generator/src/NodeGenerators/IfGenerator.ts +++ b/packages/transpiler/view-generator/src/NodeGenerators/IfGenerator.ts @@ -1,5 +1,5 @@ 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'; export default class IfGenerator extends CondGenerator { diff --git a/packages/transpiler/view-generator/src/NodeGenerators/SnippetGenerator.ts b/packages/transpiler/view-generator/src/NodeGenerators/SnippetGenerator.ts index bc0242157aa2479773e022ed96d71714ba0945ce..bfde45b7b43d2150de6c86466a87616cd3dd21f6 100644 --- a/packages/transpiler/view-generator/src/NodeGenerators/SnippetGenerator.ts +++ b/packages/transpiler/view-generator/src/NodeGenerators/SnippetGenerator.ts @@ -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 PropViewGenerator from '../HelperGenerators/PropViewGenerator'; diff --git a/packages/transpiler/view-generator/src/NodeGenerators/SwitchGenerator.ts b/packages/transpiler/view-generator/src/NodeGenerators/SwitchGenerator.ts index 47d1d5494afdcb7e0ac932a03a052c3ce54f523b..e1d5dc016ba54ee4afad8e13cba07fb07372beb1 100644 --- a/packages/transpiler/view-generator/src/NodeGenerators/SwitchGenerator.ts +++ b/packages/transpiler/view-generator/src/NodeGenerators/SwitchGenerator.ts @@ -1,5 +1,5 @@ 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'; export default class SwitchGenerator extends CondGenerator { diff --git a/packages/transpiler/view-generator/src/NodeGenerators/TemplateGenerator.ts b/packages/transpiler/view-generator/src/NodeGenerators/TemplateGenerator.ts index fcad62070984105a56d4a2e066006479b24c0462..57096d475a934f96a95ff8256cf7c0907ca79f9a 100644 --- a/packages/transpiler/view-generator/src/NodeGenerators/TemplateGenerator.ts +++ b/packages/transpiler/view-generator/src/NodeGenerators/TemplateGenerator.ts @@ -1,5 +1,5 @@ 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'; export default class TemplateGenerator extends HTMLPropGenerator { diff --git a/packages/transpiler/view-generator/src/NodeGenerators/TextGenerator.ts b/packages/transpiler/view-generator/src/NodeGenerators/TextGenerator.ts index 1b3d6d5c4f0b7b5deb88be1bf400f112472ebfe0..b9fa1aa3eff732310d5cdd4da3d98ef1e154f545 100644 --- a/packages/transpiler/view-generator/src/NodeGenerators/TextGenerator.ts +++ b/packages/transpiler/view-generator/src/NodeGenerators/TextGenerator.ts @@ -1,5 +1,5 @@ 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'; export default class TextGenerator extends BaseGenerator { diff --git a/packages/transpiler/view-generator/src/NodeGenerators/TryGenerator.ts b/packages/transpiler/view-generator/src/NodeGenerators/TryGenerator.ts index 5d412e47430128027eb07c3e9cf3c882b0d7af1c..222bbda49e07bcad14e6775e7e6090d8691d674a 100644 --- a/packages/transpiler/view-generator/src/NodeGenerators/TryGenerator.ts +++ b/packages/transpiler/view-generator/src/NodeGenerators/TryGenerator.ts @@ -1,6 +1,6 @@ import { type types as t } from '@babel/core'; 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 { run() { diff --git a/packages/transpiler/view-generator/src/SnippetGenerator.ts b/packages/transpiler/view-generator/src/SnippetGenerator.ts index 708125d0db65cede1baf81a3ba0ad4ced9668fe7..cb38013ffe60e8a7277fb8085ca86404d7b37d97 100644 --- a/packages/transpiler/view-generator/src/SnippetGenerator.ts +++ b/packages/transpiler/view-generator/src/SnippetGenerator.ts @@ -1,5 +1,5 @@ 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'; export default class SnippetGenerator extends ViewGenerator { diff --git a/packages/transpiler/view-generator/src/ViewGenerator.ts b/packages/transpiler/view-generator/src/ViewGenerator.ts index 9276bd7ca145e1260a995782a6fdb4dde9a83dbb..0f4561482a35a28dd828a95c2fc506c5c17e5459 100644 --- a/packages/transpiler/view-generator/src/ViewGenerator.ts +++ b/packages/transpiler/view-generator/src/ViewGenerator.ts @@ -1,5 +1,5 @@ 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 BaseGenerator, { prefixMap } from './HelperGenerators/BaseGenerator'; import CompGenerator from './NodeGenerators/CompGenerator'; diff --git a/packages/transpiler/view-generator/src/error.ts b/packages/transpiler/view-generator/src/error.ts index 8c036f3e066204692603738e0e1ebef302f0b08e..e40b20a840c7df8a73245fe9df7aa96a680c1035 100644 --- a/packages/transpiler/view-generator/src/error.ts +++ b/packages/transpiler/view-generator/src/error.ts @@ -1,4 +1,4 @@ -import { createErrorHandler } from '@inula/error-handler'; +import { createErrorHandler } from '@openinula/error-handler'; export const DLError = createErrorHandler( 'ViewGenerator', diff --git a/packages/transpiler/view-generator/src/index.ts b/packages/transpiler/view-generator/src/index.ts index f1a52ed9a847dfa90f0b520890bfdd8ac34ff97e..10e12c4bffb0830bc965aadce7d6735eec190d8a 100644 --- a/packages/transpiler/view-generator/src/index.ts +++ b/packages/transpiler/view-generator/src/index.ts @@ -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 types as t } from '@babel/core'; import MainViewGenerator from './MainViewGenerator'; diff --git a/packages/transpiler/view-parser/package.json b/packages/transpiler/view-parser/package.json index d5617a596005b32ec735554b3f8b7eed4c112d15..720518dcbb72b954e63fc3fc8f8a1c8339ca4403 100644 --- a/packages/transpiler/view-parser/package.json +++ b/packages/transpiler/view-parser/package.json @@ -1,5 +1,5 @@ { - "name": "@inula/view-parser", + "name": "@openinula/view-parser", "version": "0.0.1", "author": { "name": "IanDx", @@ -29,7 +29,7 @@ "vitest": "^0.34.5" }, "dependencies": { - "@inula/error-handler": "workspace:*" + "@openinula/error-handler": "workspace:*" }, "tsup": { "entry": [ diff --git a/packages/transpiler/view-parser/src/error.ts b/packages/transpiler/view-parser/src/error.ts index 0e80994dd8eaa7318ae773a84167b899a7b78223..b6557776e23bfdac43847cf07ecf131a0abaa4e6 100644 --- a/packages/transpiler/view-parser/src/error.ts +++ b/packages/transpiler/view-parser/src/error.ts @@ -1,11 +1,11 @@ -import { createErrorHandler } from '@inula/error-handler'; +import { createErrorHandler } from '@openinula/error-handler'; export const DLError = createErrorHandler( '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', - 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()`', }, { diff --git a/packages/transpiler/vite-plugin-inula-next/CHANGELOG.md b/packages/transpiler/vite-plugin-inula-next/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..4571c28bc909b6ed472bd438ea158cf156ec990e --- /dev/null +++ b/packages/transpiler/vite-plugin-inula-next/CHANGELOG.md @@ -0,0 +1,8 @@ +# vite-plugin-inula-next + +## 0.0.2 + +### Patch Changes + +- Updated dependencies [2f9d373] + - babel-preset-inula-next@0.0.2 diff --git a/packages/transpiler/vite-plugin-inula-next/package.json b/packages/transpiler/vite-plugin-inula-next/package.json index b83d65bd8fba1ab4d24772269f2700c4ba6ba2bb..233837aa98825860ce6a920f59277d421036b1a3 100644 --- a/packages/transpiler/vite-plugin-inula-next/package.json +++ b/packages/transpiler/vite-plugin-inula-next/package.json @@ -1,6 +1,6 @@ { "name": "vite-plugin-inula-next", - "version": "0.0.1", + "version": "0.0.2", "author": { "name": "IanDx", "email": "iandxssxx@gmail.com" diff --git a/packages/transpiler/vite-plugin-inula-next/src/index.ts b/packages/transpiler/vite-plugin-inula-next/src/index.ts index 640428092d02033aab8b7836fe8a52e8b94aa3aa..cb299115bfc5f03382259fce9359d18be4be73e2 100644 --- a/packages/transpiler/vite-plugin-inula-next/src/index.ts +++ b/packages/transpiler/vite-plugin-inula-next/src/index.ts @@ -1,5 +1,5 @@ import { transform } from '@babel/core'; -import dlight, { type DLightOption } from '../../babel-preset-inula-next'; +import dlight, { type DLightOption } from 'babel-preset-inula-next'; import { minimatch } from 'minimatch'; import { Plugin, TransformResult } from 'vite'; export default function (options: DLightOption = {}): Plugin {