Commit Graph

62 Commits

Author SHA1 Message Date
ClarkXia b8e974393f
feat: support routes config (#5968)
* feat: support routes config

* fix: compatible with win32

* feat: add test case

* fix: optimize code

* fix: compatible with path

* Update routes.ts

* Update routes.ts
2023-02-28 10:00:43 +08:00
ClarkXia 1b6c57832a
feat: on-demand compilation for server (#5824)
* feat: node runner

* feat: node transform

* fix: unexpected modification

* fix: node runner

* test: test case

* test: test case

* test: test case

* fix: add dependencies

* fix: optimize code

* feat: server runner

* feat: optimize code

* fix: test case

* fix: test case

* feat: support on demand pre bundle

* chore: lint warning

* fix: optimize code

* fix: compile options

* fix: optimize code

* fix: add file

* fix: optimize code

* fix: test case

* fix: optimize code

* fix: test

* fix: compile target

* fix: optimize code

* fix: lint

* fix: optimize code
2023-02-22 12:17:31 +08:00
ClarkXia c893a64a1c
chore: changeset config (#5909)
* chore: reset version

* fix: changeset

* chore: publish beta

* chore: update pre

* chore: custom version

* chore: remove test

* fix: version

* chore: test case

* chore: version

* fix: reset changelog

* fix: update lock

* fix: changelog

* chore: release beta version

* chore: add changeset

* chore: release beta version

* chore: update @ice/app version

* chore: update version and lock

---------

Co-authored-by: luhc228 <luhengchang228@126.com>
2023-02-16 16:11:49 +08:00
ZeroLing 7c07f1654a
fix: data-loader using serverCompiler with renderer client (#5856)
* fix: data-loader using serverCompiler with renderer client

* fix: renderer
2023-02-02 20:07:49 +08:00
水澜 d2f0b7e5c7
feat: suspense ssr (#5584)
* feat: suspense ssr demo

* chore: rename global variable

* chore: update lock

* feat: suspense demo

* chore: delete dead code

* refactor: rename to data context

* fix: error triggered in steam, should not downgrade

* feat: suspense ssr

* fix: should async script when suspense

* feat: support suspense for common components

* feat: support suspense for common components

* fix: style type lint

* fix: typings

* feat: remove server data loader for suspense component

* feat: disable dataLoader for suspense

* chore: add style

* chore: add changelog

* chore: add changelog

* chore: add comments

* refactor: check suspense data

* fix: type

* test: suspnese

* fix: compat with ssg

* feat: fallback for suspense

* feat: suspense fallback

* refactor: pass id as props

* refactor: pass fallback as element

* fix: type

* docs: suspense

* docs: suspense

* refactor: support suspense in components

* fix: changelog

* fix: lint

* fix: should not replace env to string

* chore: add changelog

* chore: remove dead code

* revert: dataloader for ssr

* fix: lint

* refactor: rename

* docs: hide suspense ssr

* refactor: remove internal error boundary

* refactor: merge if condition

* fix: type

* refactor: suspense api

---------

Co-authored-by: ClarkXia <xiawenwu41@gmail.com>
2023-02-02 16:00:04 +08:00
ZeroLing f46241fe75
Fix/compat rax element (#5847)
* fix: dynamic import works in app.tsx

* fix: test case

* chore: update depenedency version of @ice/webpack-config

* refactor: rax-compat jsx-runtime

* chore: add CHANGELOG and update version of rax-compat

* chore: pnpm lock up-to-date

* fix: puppteer update
2023-02-01 23:12:21 -08:00
ZeroLing acfc88427e
fix: dynamic import works in app.tsx (#5840)
* fix: dynamic import works in app.tsx

* fix: test case

* chore: update depenedency version of @ice/webpack-config

* chore: pnpm lock up-to-date
2023-02-02 14:22:35 +08:00
ClarkXia 66cd9df104
feat: enhance memory router (#5800)
* feat: enhance memory router

* fix: optimize code

* fix: error syntax

* fix: remove unused statement
2023-01-11 17:36:28 +08:00
ZeroLing f46d0e7204
feat: support target and renderer (#5700)
* feat: support target and renderMode

* fix: test case and renderer

* Update build.ts

* refactor: constant

* fix: eslint

* fix: remove empty line

* fix: remove useless code

* feat: add import.meta.env

* fix: type webpack

* fix: server compiler defines
2023-01-06 15:07:39 +08:00
水澜 f62ec86c50
fix: rerender ssg after hydrate (#5755)
* feat: update ssg data after hydrate

* v1.0.4

* test: ssg

* test: ssg

* chore: changelog

* revert: no optional

* fix: update app context

* refactor: call data loader in useEffect
2022-12-27 14:33:03 +08:00
ClarkXia 05aeb94f6b
feat: plugin for icestark (#5695)
* feat: plugin icestark arch

* feat: icestark child app

* chore: update type

* fix: icestark child

* feat: icestark layout

* feat: icestark framework

* feat: test case for icestark

* chore: changelog

* fix: optimize code

* fix: optimize code
2022-12-15 14:35:07 +08:00
ClarkXia 497b1f333f
fix: config polyfill of usage (#5663)
* fix: config polyfill of usage

* test: add test case

* fix: compatible with win32

* test: test case
2022-12-08 10:21:01 +08:00
ClarkXia 5f2433abd3
fix: pass a timeout value for long-running test (#5604)
* fix: pass a timeout value for long-running test

* fix: configure testTimeout
2022-11-22 16:43:03 +08:00
水澜 52eadfb309
feat: redirect imports (#5590)
* feat: redirect imports

* test: data loader size

* chore: change log

* chore: change log
2022-11-21 17:58:15 +08:00
ClarkXia e21fb48509 fix: release 3.0 2022-11-15 10:37:30 +08:00
染陌同学 36475937e8 Feat/define data loader (#643)
* feat: modify dataLoader

* feat: add type

* feat: add DataLoaderConfig

* feat: modify getData to defineDataLoader

* chore: remove defineDataLoader

* fix: fetcher shoule return promise

* fix: loader may be undefined

* fix: err loader config

* chore: modify example of pha

* feat: modify getData

* chore: modify type and mofiy options of init

* feat: modify fetcher to dataLoaderFetcher and add dataLoaderImport to entry

* chore: modify defaultDataLoaderFetcher

* chore: load data by route id

* feat: modify serverDataLoader and staticDataLoader

* feat: add fetcher when route change

* fix: deal with window undefined

* chore: modify type

* feat: try get data from cache

* feat: support useData

* feat: add defineStaticDataLoader and defineServerDataLoader

* chore: modify getData of example

* fix: should load data

* fix: fix ssg err

* fix: fix dataloader for ssg

* test: modify env of test

* fix: shoule clear cache when route changed

* fix: fix renderMode and add defult remder mode

* fix: add window

* test: add jsdom

* test: modify getData to dataLoader

* test: modify test of clientApp

* test: clear window after each test

* test: remove only

* test: remove only

* chore: modify appear

* fix: Try get data from cache when CSR

* chore: update lock

* chore: remove unused

* refactor: data loader (#685)

* refactor: set global fetcher

* refactor: set global fetcher

* fix: should not build react in data loader

* fix: test

* test: modify test

Co-authored-by: 水澜 <shuilan.cj@taobao.com>
Co-authored-by: ZeroLing <i@zeroling.com>
2022-11-15 10:33:11 +08:00
luhc228 e88c291ad1 fix: useAuth error (#661)
* chore: example

* chore: with-auth example

* docs: update auth

* test: add with-auth test

* chore: format

* fix: lock
2022-11-15 10:33:11 +08:00
ClarkXia 9f57caffb4 fix: duplicate assets in document output (#646)
* fix: duplicate assets in document output

* fix: add test case

* chore: typo
2022-11-15 10:33:11 +08:00
luhc228 7fe93e3503 feat: ClientOnly component (#542)
* feat: BrowserOnly Component

* docs: BrowserOnly component docs

* docs: optimize

* feat: export useIsBrowser Hook

* feat: useIsBrowser example

* docs: useIsBrowser

* docs: typo

* chore: clientOnly

* feat: ClientOnly and useMounted

* feat: add ClientOnly test

* docs: update docs

* feat: use hooks instead of Context

* chore: import name
2022-11-15 10:32:48 +08:00
luhc228 3f54369bff feat: store initialStates (#435)
* feat: store initialStates

* chore: update README

* chore: add file comment

* chore: rename type

* fix: peer dependencies

* fix: defineStoreConfig not found

* feat: support get the appData

* fix: test case

* fix: lock
2022-11-15 10:32:48 +08:00
ClarkXia 16b82337b2 fix: ignore with non-absoulte path (#566) 2022-11-15 10:32:43 +08:00
水澜 114373633f feat: build routes config for document render (#552)
* feat: render document by routes config

* test: downgrade to csr

* chore: rename

* refactor: load route modules after only in ssr

* fix: pha test

* fix: compat with no routes config

* fix: ensure routes config before build

* fix: test case

* fix: test timeout

* fix: cache in test case

* refactor: check routes config before server compiler

* refactor: allways generate routes config

* chore: remove dead code

* fix: reset status when init config
2022-11-15 10:32:43 +08:00
水澜 99d7f37fc5 refactor: generate data-loader only by getData (#514)
* refactor: generate data-loader only by getData

* feat: support config dataloader

* test: disable data-loader

* chore: rename

* docs: data loader

* chore: update lock
2022-11-15 10:32:43 +08:00
luhc228 c8b4db3cd4 test: fix routes-generate unit test timeout (#531)
* test: fix routes-generate timeout

* refactor: optimize page.push()
2022-11-15 10:31:55 +08:00
水澜 990f7aa552 feat: support inline style for ssr (#518)
* feat: inline style for less

* feat: classname to style

* feat: esbuild inline style

* feat: transform styles

* fix: compat for less module

* fix: less rule

* feat: ignore

* docs: ignore

* refactor: to ts

* test: inline-style

* chore: update lock

* fix: deps

* refactor: enable esbuild inline style loader only in ssr

* fix: validate for ignore plugins

* refactor: to pure functions

* feat: sync syntaxFeatures

* fix: lint

* Update rax-inline-style.test.ts
2022-11-15 10:31:35 +08:00
ClarkXia ad531405a8 test: improve test case (#497)
* test: improve test case

* test: compat win32

* test: test case

* test: add test case

* test: add test case

* test: test case for rax-compat

* test: test case for routes

* fix: types error

* fix: to strict equal

* chore: remove unused props

* fix: types

* test: test case for run client app

* chore: remove empty router

* test: test case of run server app

* chore: remove log

* chore: do not remove file by test case

* fix: remove document dependency when run client app

* chore: lint

* chore: remove config

* fix: lint

* chore: lint warning

* fix: test case

* chore: update unplugin
2022-11-15 10:30:52 +08:00
luhc228 41aee63512 feat: add splitChunks to userConfig (#454)
* feat: add splitChunks to userConfig

* docs: splitChunks

* test: splitChunks test case

* fix: splitChunk test case
2022-11-15 10:27:46 +08:00
水澜 f384a2043d fix: remove component in csr (#486)
* fix: remove component in csr

* fix: keep export default for app

* fix: should load route modules first to get config
2022-11-15 10:27:46 +08:00
luhc228 47738dca66 fix: rax project ssr failed (#467)
* fix: prebundle alias

* fix: rax multiple version

* fix: test case

* chore: rename param
2022-11-15 10:27:46 +08:00
ClarkXia 11a58ed9ae fix: compatible with win32 system (#477)
* fix: compatible with win32

* fix: lint

* chore: optimize code

* fix: test case

* fix: build-scripts version

* chore: update version

* chore: update lock file

* feat: add test case of win

* fix: node matrix

* fix: format path

* fix: win32 compatible

* fix: format path
2022-11-15 10:27:42 +08:00
ClarkXia aa248063ef feat: support optimize router (#456)
* feat: support optimize router

* feat: export useNavigate

* chore: remove useless code
2022-11-15 10:27:18 +08:00
luhc228 2ca66f5857 feat: store plugin (#431)
* feat: app store

* chore: store example

* chore: lock

* feat: init page store

* feat: update page store

* fix: disable reset page state

* feat: createModel

* test: with-store test

* fix: comment

* chore: lock
2022-11-15 10:23:01 +08:00
luhc228 be13ee9dd8 fix: hash router preview (#393)
* feat: init example

* fix: can not render component

* chore: lock

* feat: test case

* fix: comment

* fix: test error

* fix: test case

* fix: not use the correct location in hash router

* chore: remove appConfig param

* chore: remove AppConfig type
2022-11-15 10:20:02 +08:00
ClarkXia b19b5c586f Feat: remove data loader (#379)
* feat: regenerate config file

* feat: add data loader plugin

* feat: compile data loader

* feat: remove data-loader

* chore: remove useless file

* fix: remove useless code

* fix: remove minify

* fix: watch app.ts

* chore: remove log
2022-11-15 10:15:15 +08:00
水澜 1d1bb89778 refactor: swc plugin (#346)
* fix: basename in faas

* fix: if basename not exist

* refactor: swc plugin

* fix: deps

* fix: plugin path

* fix: swc plugin path

* fix: lock file

* fix: conflict

* fix: transform jsx by default

* feat: const modules

* fix: lock file

* feat: keep platform

* fix: uppercase first letter

* chore: comment for swc config

* revert: prebunlde

* revert: regenerator config

* chore: map from swc is string

* fix: beta version

* test: keep platform
2022-11-15 10:13:53 +08:00
ClarkXia 48603cdf8f feat: support swc options for plugin-rax-compat and onappear on rax-compat (#349)
* feat: support swc options for plugin-rax-compat

* chore: example

* test: fix test case

* test: fix test case

* test: fix test case

* fix: outputdir

* fix: onappear for no ref cases

* fix: merge options

* fix: appear polyfill

* chore: remove appear polyfill dependency

* fix: add swc helpers

* fix: onappear on rax-compat

* refactor: format code and not to use react.frowardRef

Co-authored-by: ZeroLing <zhuoling.lcl@alibaba-inc.com>
2022-11-14 19:55:00 +08:00
水澜 0152f33742 feat: get server data (#288)
* fix: lint

* feat: getStatiData getServerData

* refactor: distinguish static env

* test: get static data

* fix: ssr runtime env

* fix: ssr runtime env

* fix: fliter ssr runtime env

* fix: routes data may be null

* fix: return empty object if getStaticData not exists

* fix: throw error when generate html

* fix: env order

* refactor: env name

* refactor: ssg option

* refactor: get hydrate info by userConfig

* fix: lint

* fix: lint

* fix: lint

* refactor: static generation to render mode

* refactor: reset ssr env in runtime

* refactor: isCSR to csr

* fix: type
2022-11-14 19:48:13 +08:00
水澜 2eac971c1b feat: data loader shaking (#246)
* fix: lint

* feat: apply swc transform to esbuild

* chore: updata lock file

* refactor: rename params

* fix: types

* fix: add data loader to entry

* fix: add data loader after runtime

* feat: support config exports for ssr

* fix: conflict

* chore: remove debug info

* fix: transform page entry only

* fix: file extension

* fix: file extension

* revert: document

* fix: side effects

* feat: filter pages without getData

* feat: bundle optimization in dev mod

* refactor: side effects is not needed

* refactor: pass swc options to server compiler

* chore: comment

* refactor: runtime chunk is no more needed

* refactor: render data loader according to manifest

* test: data-loader

* chore: rename

* refactor: jsxTransform

* chore: update swc plugin version

* chore: update lock file

* fix: add jsx dev runtime

* chore: update swc plugin version

Co-authored-by: ZeroLing <zhuoling.lcl@alibaba-inc.com>
2022-11-14 19:22:57 +08:00
ClarkXia 070e707944 feat: serve static assets (#164)
* feat: server static assets

* chore: update lock

* fix: dev server

* chore: remove log

* fix: middleware order

* chore: lock file

* chore: types

* chore: types
2022-11-14 19:17:25 +08:00
luhc228 19b00c1276 feat: mock (#161)
* feat: support get mock data

* feat: middleware

* feat: support watch mock dir file change

* chore: lock

* fix: mock

* chore: lint

* feat: put mock middleware to first

* feat: support mock exclude

* fix: app.addProvider not be added (#190)

* feat: app.addProvider not be executed

* fix: still excute when error

* chore: skip test
2022-11-14 19:17:25 +08:00
大果 69c7ecb251 feat: support tree-shaking react-router deps when only one route (#86)
* feat: support tree-shaking react-router deps when only one route

* chore: optimize history API

* fix: typo error

* chore: make esbuild compile @ice/runtime add inject env vars

* chore: make esbuild compile @ice/runtime add inject env vars

* chore: resolve conflict

* feat: mock react-router api when disable router

* feat: env

* fix: test

* feat: support dotenv

* chore: add stringify

* chore: lock build-scripts

* feat: add removeHistoryDeadCode userConfig

* fix: duplicate register of routes

* fix: default value of define

* chore: optimize code

* fix: typo

* chore: upgrade react

* fix: code

* chore: optimize matchRoutes

Co-authored-by: ClarkXia <xiawenwu41@gmail.com>
2022-11-14 19:17:06 +08:00
ClarkXia 8f4f79dae5 feat: minify and dropLogLevel (#119)
* feat: minify and dropLogLevel

* fix: test case
2022-11-14 19:16:17 +08:00
水澜 99e586bf7c Feat nested routing (#112)
* feat: nested routing

* fix: update page config after navigate

* fix: initial value

* refactor: fn name

* feat: avoid load data for old route

* refactor: decoupling the dependency to page

* refactor: types for getConfig

* refactor: use prmomise

* chore: rename

* test: filter matched route

* chore: optimize types

* feat: support useAppData

* chore: just play

* chore: remove log

* chore: resolve conflict

* refactor: pages to routes

* fix: page to route

* refactor: merge value

Co-authored-by: liuxiong.lx <liuxiong.lx@alibaba-inc.com>
2022-11-14 19:16:12 +08:00
ClarkXia adc076edc2 feat: compile dependencies (#117)
* feat: compile dependencies

* fix: optimize code

* fix: remove console

* chore: optimize code

* chore: test

* fix: test case
2022-11-14 19:15:57 +08:00
luhc228 7bbe0e9780 Fix: can not open browser in dev (#100)
* fix: can not open browser in dev

* chore: disableOpen

* fix: can not get disableOpen arg

* feat: change disable-open to open
2022-11-14 19:15:57 +08:00
ClarkXia b50d478103 feat: optimize output folder (#115)
* feat: optimize folder

* fix: assets transform

* fix: optimze code

* fix: optimize code
2022-11-14 19:15:57 +08:00
luhc228 54163342ef Feat: define routes and ignore route files (#69)
* feat: support define routes

* fix: test

* fix: test

* chore: undefined type

* fix: conflict

* chore: remove pages str from route id

* fix: watch route change

* fix: warn

* fix: test

* fix: test

* chore: example

* chore: add route-gen example

* feat: add integration test

* chore: test

* chore: update config file

* chore: remove pnpm cache

* chore: test

* chore: remove test:ci from ci workflow

* chore: update build-scripts version

* chore: build fixture

* chore: remove devServer test

* chore: buildFixture

* feat: add vitest

* chore: add ts-ignore

* chore: node ci version

* chore: comment bundle analyzer

* chore: add test timeout

* fix: lint

* chore: remove threads

* chore: set maxThreads and minThreads

* chore: add maxConcurrency

* chore: remove coverage

* chore: threads

* chore: set threads to false

* fix: conflict

* fix: comment
2022-11-14 19:15:57 +08:00
水澜 525142f9d4 refactor: hydrate document (#74)
* feat: update page config after link

* Rename Document.tsx to document.tsx

* chore: add comment

* test: routing

* fix: test utils of puppeteer page

* test: update pageconfig after route

* chore: add origin source

* fix: meta tag

* fix: add s

* feat: reuse the links already loaded

* refactor: hydrate document

* refactor: pass data by app context

* refactor: get assets in document

* refactor: pass app as children

* refactor: use app context

* revert: document

* refactor: pass document by app context

* Rename document.tsx to Document.tsx

* fix: hydrate error

* chore: add comment

* feat: toggle for ssr

* refactor: entry options

* refactor: merge simple functions

* feat: downgrade to csr

* refactor: ssr entry

* fix: file name

* fix: remove deadcode

* Rename generateHtml.ts to generateHTML.ts

* fix: remove deadcode

* fix: remove deadcode

* refactor: remove block scripts

* feat: pass ssr flag to csr

* fix: remove ssg flag

* fix: spelling

* refactor: pass ssr flag to hydrate

* chore: add todo for runtime

* fix: typo

* chore: add todo for load links

* chore: send html for send html

* refactor: remove config for custom rootId

* feat: load page assets

* feat: ssr config

* refactor: disable csr hydrate warning

* chore: add issue link

Co-authored-by: ClarkXia <xiawenwu41@gmail.com>
2022-11-14 19:15:29 +08:00
luhc228 ab9c50913b test: use vitest instead of jest (#75)
* test: use vitest

* chore: update test script in ci.yml

* chore: remove coverage

* chore: remove max-old-space-size

* chore: not use threads

* chore: add maxThreads

* chore: set maxThreads to 2

* chore: set to node 16

* chore: set threads to false

* chore: add coverage

* chore: max-old-space-size
2022-11-14 19:15:00 +08:00
ClarkXia 748adfb2c4 refactor: create @ice/app for framework (#67)
* fix: package name

* refactor: main package for ice

* fix: test case

* test: test case

* test: run context without built-in plugin

* test: add console level

* test: test case

* fix: remove built-in plugin

* test: use json file

* Revert "test: use json file"

This reverts commit be309d7df5a00fcc14fdc54fe2a63c9bce54221c.

* fix: update build-scripts

* fix: optimize code

* fix: exports field

* chore: use consola instead of console

* fix: optimize code
2022-11-14 19:14:32 +08:00