-
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.
Merge pull request #6249 from alibaba/release/next
* fix: import store source before swc compiler (#6248) * Feat/support sourcemap (#6158) * feat: add generateSourceMap * feat: generate souce map * chore: add changeset * feat: add data-sourcemap * feat: add with-entry-type example * feat: add sourcemap info * fix: modify toJson to toString * chore: rename generate sourcemap * feat: modify line of child map * feat: add base line * chore: modify BASE_COLUMN * chore: modify pnpm lock * feat: data-sourcemap should be delete * chore: update lock * chore: add changeset * chore: modify lock * chore: remove app worker and data loader * chore: if sourceMapFileList is empty, return empty string * feat: support sourcemap meta * feat: dealwith style * feat: add prependCode * chore: modify package * chore: modify if * fix: use api history to navigate (#6251) * fix: use api history to navigate * fix: params * feat: support api of addEntryImportAhead (#6256) * feat: support api of addEntryImportAhead * fix: ts type * fix: jsx comment (#6239) * fix: jsx comment * chore: add changelog * fix: set source with jsx comment to classic mode * fix: jsx pragma * fix: compatible with hmr when data get undefined (#6259) * fix: use data (#6254) * fix: use data * fix: test * chore: changeset * fix: test * chore: update lock * chore: update versions (#6250) * chore: update versions * Update CHANGELOG.md --------- Co-authored-by: 染陌同学 <[email protected]> Co-authored-by: 水澜 <[email protected]>
- Loading branch information
Showing
47 changed files
with
500 additions
and
59 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 |
---|---|---|
@@ -1,4 +1,3 @@ | ||
/* @jsx createElement */ | ||
import { Meta, Title, Links, Main, Scripts } from 'ice'; | ||
|
||
function 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 @@ | ||
chrome 55 |
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,18 @@ | ||
import { defineConfig } from '@ice/app'; | ||
|
||
export default defineConfig({ | ||
plugins: [], | ||
server: { | ||
onDemand: true, | ||
format: 'esm', | ||
}, | ||
output: { | ||
distType: 'javascript' | ||
}, | ||
sourceMap: true, | ||
routes: { | ||
defineRoutes: (route) => { | ||
route('/custom', 'Custom/index.tsx'); | ||
}, | ||
}, | ||
}); |
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,24 @@ | ||
{ | ||
"name": "@examples/with-entry-type", | ||
"private": true, | ||
"version": "1.0.0", | ||
"scripts": { | ||
"start": "ice start", | ||
"build": "ice build" | ||
}, | ||
"description": "", | ||
"author": "", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@ice/app": "workspace:*", | ||
"@ice/runtime": "workspace:*", | ||
"react": "^18.0.0", | ||
"react-dom": "^18.0.0" | ||
}, | ||
"devDependencies": { | ||
"fs-extra": "^10.0.0", | ||
"@types/react": "^18.0.0", | ||
"@types/react-dom": "^18.0.2", | ||
"webpack": "^5.73.0" | ||
} | ||
} |
Binary file not shown.
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 @@ | ||
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,42 @@ | ||
import path from 'path'; | ||
import { fileURLToPath } from 'url'; | ||
import { Meta, Title, Links, Main, Scripts } from 'ice'; | ||
import fse from 'fs-extra'; | ||
|
||
let dirname; | ||
if (typeof __dirname === 'string') { | ||
dirname = __dirname; | ||
} else { | ||
dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
} | ||
|
||
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 ScriptElement={(props) => { | ||
if (props.src && !props.src.startsWith('http')) { | ||
const filePath = path.join(dirname, `..${props.src}`); | ||
const sourceMapFilePath = path.join(dirname, `..${props.src}.map`); | ||
const res = fse.readFileSync(filePath, 'utf-8'); | ||
return <script data-sourcemap={sourceMapFilePath} dangerouslySetInnerHTML={{ __html: res }} {...props} />; | ||
} else { | ||
return <script {...props} />; | ||
} | ||
}} | ||
/> | ||
</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,19 @@ | ||
import { Link, useData } from 'ice'; | ||
|
||
export default function Custom() { | ||
const data = useData(); | ||
|
||
return ( | ||
<> | ||
<h2>Custom Page</h2> | ||
<Link to="/home">home</Link> | ||
{data} | ||
</> | ||
); | ||
} | ||
|
||
export function pageConfig() { | ||
return { | ||
title: 'Custom', | ||
}; | ||
} |
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,30 @@ | ||
import { Link } from 'ice'; | ||
|
||
export default function About() { | ||
return ( | ||
<> | ||
<h2>About Page</h2> | ||
<Link to="/">home</Link> | ||
<span className="mark">new</span> | ||
</> | ||
); | ||
} | ||
|
||
export function pageConfig() { | ||
return { | ||
title: 'About', | ||
meta: [ | ||
{ | ||
name: 'theme-color', | ||
content: '#eee', | ||
}, | ||
], | ||
links: [{ | ||
href: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css', | ||
rel: 'stylesheet', | ||
}], | ||
scripts: [{ | ||
src: 'https://cdn.jsdelivr.net/npm/[email protected]/dist/lodash.min.js', | ||
}], | ||
}; | ||
} |
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,21 @@ | ||
import { Link, useData, useConfig } from 'ice'; | ||
|
||
export default function Blog() { | ||
const data = useData(); | ||
const config = useConfig(); | ||
|
||
console.log('render Blog', 'data', data, 'config', config); | ||
|
||
return ( | ||
<> | ||
<h2>Blog Page</h2> | ||
<Link to="/home">home</Link> | ||
</> | ||
); | ||
} | ||
|
||
export function pageConfig() { | ||
return { | ||
title: 'Blog', | ||
}; | ||
} |
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,20 @@ | ||
import { definePageConfig } from 'ice'; | ||
|
||
export default function Home() { | ||
return ( | ||
<> | ||
<h2>Home Page</h2> | ||
</> | ||
); | ||
} | ||
|
||
export const pageConfig = definePageConfig(() => { | ||
return { | ||
queryParamsPassKeys: [ | ||
'questionId', | ||
'source', | ||
'disableNav', | ||
], | ||
title: 'Home', | ||
}; | ||
}); |
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,25 @@ | ||
.title { | ||
color: red; | ||
margin-left: 10rpx; | ||
} | ||
|
||
.data { | ||
margin-top: 10px; | ||
} | ||
|
||
.homeContainer { | ||
align-items: center; | ||
margin-top: 200rpx; | ||
} | ||
|
||
.homeTitle { | ||
font-size: 45rpx; | ||
font-weight: bold; | ||
margin: 20rpx 0; | ||
} | ||
|
||
.homeInfo { | ||
font-size: 36rpx; | ||
margin: 8rpx 0; | ||
color: #555; | ||
} |
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 { Outlet } from 'ice'; | ||
|
||
export default () => { | ||
return ( | ||
<div> | ||
<h1>ICE 3.0 Layout</h1> | ||
<Outlet /> | ||
</div> | ||
); | ||
}; | ||
|
||
export function pageConfig() { | ||
return { | ||
title: 'Layout', | ||
meta: [ | ||
{ | ||
name: 'layout-color', | ||
content: '#f00', | ||
}, | ||
], | ||
}; | ||
} |
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 @@ | ||
/// <reference types="@ice/app/types" /> |
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
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
Oops, something went wrong.