-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
1,197 additions
and
379 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { defineConfig } from '@ice/app'; | ||
import runtimeNext from '@ice/plugin-runtime-next'; | ||
|
||
export default defineConfig(() => ({ | ||
ssg: false, | ||
plugins: [ | ||
runtimeNext(), | ||
], | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "runtime-next-project", | ||
"private": true, | ||
"version": "1.0.0", | ||
"description": "Example for @ice/runtime-next usage", | ||
"scripts": { | ||
"start": "ice start", | ||
"build": "ice build" | ||
}, | ||
"dependencies": { | ||
"@ice/runtime": "workspace:*", | ||
"@ice/runtime-next": "workspace:*", | ||
"react": "^19.0.0", | ||
"react-dom": "^19.0.0" | ||
}, | ||
"devDependencies": { | ||
"@ice/app": "workspace:*", | ||
"@ice/plugin-runtime-next": "workspace:*", | ||
"@types/react": "^19.0.0", | ||
"@types/react-dom": "^19.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { defineAppConfig } from 'ice'; | ||
|
||
export default defineAppConfig(() => ({ | ||
|
||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Meta, Title, Links, Main, Scripts } from 'ice'; | ||
|
||
function Document() { | ||
return ( | ||
<html> | ||
<head> | ||
<meta charSet="utf-8" /> | ||
<meta name="description" content="ICE Demo" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<Meta /> | ||
<Title /> | ||
<Links /> | ||
</head> | ||
<body> | ||
<Main /> | ||
<Scripts /> | ||
</body> | ||
</html> | ||
); | ||
} | ||
|
||
export default Document; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Home() { | ||
return <div>Home</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export default function Index() { | ||
return <div>Index</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"compileOnSave": false, | ||
"buildOnSave": false, | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"outDir": "build", | ||
"module": "esnext", | ||
"target": "es6", | ||
"jsx": "react-jsx", | ||
"moduleResolution": "node", | ||
"allowSyntheticDefaultImports": true, | ||
"lib": ["es6", "dom"], | ||
"sourceMap": true, | ||
"allowJs": true, | ||
"rootDir": "./", | ||
"forceConsistentCasingInFileNames": true, | ||
"noImplicitReturns": true, | ||
"noImplicitThis": true, | ||
"noImplicitAny": false, | ||
"importHelpers": true, | ||
"strictNullChecks": true, | ||
"suppressImplicitAnyIndexErrors": true, | ||
"noUnusedLocals": true, | ||
"skipLibCheck": true, | ||
"paths": { | ||
"@/*": ["./src/*"], | ||
"ice": [".ice"] | ||
} | ||
}, | ||
"include": ["src", ".ice", "ice.config.*"], | ||
"exclude": ["build", "public"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
const createRouteConfig = (routeImports: string[], routeDefinition: string) => { | ||
return ` | ||
import { createRouteLoader, WrapRouteComponent, RouteErrorComponent } from '@ice/runtime'; | ||
import type { CreateRoutes } from '@ice/runtime'; | ||
${routeImports.length ? `${routeImports.join('\n')}\n\n` : ''} | ||
const createRoutes: CreateRoutes = ({ | ||
requestContext, | ||
renderMode, | ||
}) => ([ | ||
${routeDefinition} | ||
]); | ||
export default createRoutes; | ||
`; | ||
}; | ||
|
||
export default createRouteConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1 @@ | ||
import { createRouteLoader, WrapRouteComponent, RouteErrorComponent } from '@ice/runtime'; | ||
import type { CreateRoutes } from '@ice/runtime'; | ||
<%- routeImports.length ? routeImports.join('\n') + '\n\n' : ''; -%> | ||
const createRoutes: CreateRoutes = ({ | ||
requestContext, | ||
renderMode, | ||
}) => ([ | ||
<%- routeDefinition %> | ||
]); | ||
export default createRoutes; | ||
<%- routeDefinition -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "@ice/plugin-runtime-next", | ||
"version": "1.0.0", | ||
"description": "runtime next plugin for ice.js.", | ||
"files": [ | ||
"esm", | ||
"!esm/**/*.map", | ||
"*.d.ts", | ||
"templates" | ||
], | ||
"type": "module", | ||
"main": "esm/index.js", | ||
"module": "esm/index.js", | ||
"types": "esm/index.d.ts", | ||
"exports": { | ||
".": "./esm/index.js" | ||
}, | ||
"sideEffects": false, | ||
"scripts": { | ||
"watch": "tsc -w --sourceMap", | ||
"build": "tsc" | ||
}, | ||
"dependencies": { | ||
"@tanstack/router-generator": "^1.106.0" | ||
}, | ||
"devDependencies": { | ||
"@ice/app": "workspace:*", | ||
"@types/react": "^19.0.0", | ||
"@types/react-dom": "^19.0.0" | ||
}, | ||
"repository": { | ||
"type": "http", | ||
"url": "https://github.com/alibaba/ice/tree/master/packages/plugin-runtime-next" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import type { Plugin } from '@ice/app/types'; | ||
|
||
const plugin: Plugin = () => ({ | ||
name: 'plugin-runtime-next', | ||
setup: ({ onGetConfig }) => { | ||
console.log('plugin-runtime-next'); | ||
// Customize the runtime | ||
onGetConfig((config) => { | ||
config.swcOptions.compilationConfig = { | ||
jsc: { | ||
transform: { | ||
react: { | ||
// TODO: suport custom jsx runtime in react 19. | ||
importSource: 'react', | ||
}, | ||
}, | ||
}, | ||
}; | ||
// Override the runtime config | ||
config.runtime = { | ||
exports: [ | ||
{ | ||
specifier: ['Meta', 'Title', 'Links', 'Main', 'Scripts'], | ||
source: '@ice/runtime-next/document', | ||
}, | ||
{ | ||
specifier: ['defineAppConfig'], | ||
source: '@ice/runtime-next', | ||
}, | ||
], | ||
server: '@ice/runtime-next/server', | ||
source: '@ice/runtime-next', | ||
router: { | ||
routesDefinition: (args) => { | ||
console.log('args', args); | ||
return 'export default function createRoutes() { return []; }'; | ||
}, | ||
source: './routes.tsx', | ||
template: 'core/routes.tsx.ejs', | ||
}, | ||
}; | ||
}); | ||
}, | ||
}); | ||
|
||
export default plugin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"baseUrl": "./", | ||
"rootDir": "src", | ||
"outDir": "esm", | ||
"module": "ES2020", | ||
"moduleResolution": "NodeNext", | ||
}, | ||
"include": ["src"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './esm/document'; |
2 changes: 1 addition & 1 deletion
2
packages/runtime/src/AppContext.tsx → packages/runtime-kit/src/AppContext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.