Skip to content

Commit

Permalink
Merge pull request #6308 from alibaba/release/next
Browse files Browse the repository at this point in the history
Release 3.2.6
  • Loading branch information
ClarkXia committed Jun 16, 2023
2 parents 234245e + 45fbf7d commit 170fe47
Show file tree
Hide file tree
Showing 82 changed files with 804 additions and 432 deletions.
2 changes: 1 addition & 1 deletion examples/app-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"speed-measure-webpack-plugin": "^1.5.0",
"webpack": "^5.80.0"
"webpack": "^5.86.0"
}
}
2 changes: 1 addition & 1 deletion examples/basic-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"speed-measure-webpack-plugin": "^1.5.0",
"webpack": "^5.80.0"
"webpack": "^5.86.0"
}
}
1 change: 1 addition & 0 deletions examples/basic-project/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const dataLoader = defineDataLoader(({ pathname, query }) => {
count: 100,
pathname,
query,
from: 'client',
});
}, 1 * 100);
});
Expand Down
2 changes: 1 addition & 1 deletion examples/csr-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"speed-measure-webpack-plugin": "^1.5.0",
"webpack": "^5.80.0"
"webpack": "^5.86.0"
}
}
2 changes: 1 addition & 1 deletion examples/disable-data-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"speed-measure-webpack-plugin": "^1.5.0",
"webpack": "^5.80.0"
"webpack": "^5.86.0"
}
}
2 changes: 1 addition & 1 deletion examples/miniapp-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
"@types/react-dom": "^18.0.2",
"browserslist": "^4.19.3",
"speed-measure-webpack-plugin": "^1.5.0",
"webpack": "^5.80.0"
"webpack": "^5.86.0"
}
}
2 changes: 1 addition & 1 deletion examples/rax-inline-style/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"webpack": "^5.80.0"
"webpack": "^5.86.0"
}
}
2 changes: 1 addition & 1 deletion examples/rax-project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"webpack": "^5.80.0"
"webpack": "^5.86.0"
}
}
1 change: 1 addition & 0 deletions examples/single-route/ice.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export default defineConfig(() => ({
optimization: {
router: false,
},
ssr: true,
}));
53 changes: 50 additions & 3 deletions examples/single-route/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,55 @@
import { Link } from 'ice';
import { Link, useData, defineDataLoader, useSuspenseData, withSuspense } from 'ice';

function Comments() {
const comments = useSuspenseData(getData);

console.log('Render: Comments');

return (
<div>
{comments.map((comment, i) => (
<p className="comment" key={i}>
{comment}
</p>
))}
</div>
);
}
const StreamingComments = withSuspense(Comments);
const fakeData = [
"Wait, it doesn't wait for React to load?",
'How does this even work?',
'I like marshmallows',
];

async function getData() {
await new Promise<any>((resolve) => {
setTimeout(() => resolve(null), 1000);
});
return fakeData;
}

console.log('process.env.ICE_CORE_ROUTER', process.env.ICE_CORE_ROUTER);
console.log('Link', Link);

export default function Home() {
return <div>home <h2>Home Page</h2></div>;
}
const data = useData();
console.log('render About', 'data', data);
return (
<div>
<h1>{data?.name}</h1>
<h2>Home Page</h2>
<StreamingComments id="comments" fallback={<div>loading</div>} />
</div>
);
}

export const dataLoader = defineDataLoader(() => {
return new Promise((resolve) => {
setTimeout(() => {
resolve({
name: 'home',
});
}, 1 * 100);
});
});
2 changes: 1 addition & 1 deletion examples/with-entry-type/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"fs-extra": "^10.0.0",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"webpack": "^5.73.0"
"webpack": "^5.86.0"
}
}
2 changes: 1 addition & 1 deletion examples/with-nested-routes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"speed-measure-webpack-plugin": "^1.5.0",
"webpack": "^5.80.0"
"webpack": "^5.86.0"
}
}
2 changes: 1 addition & 1 deletion examples/with-pha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.2",
"webpack": "^5.80.0"
"webpack": "^5.86.0"
}
}
7 changes: 7 additions & 0 deletions packages/bundles/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## 0.1.12

### Patch Changes

- f95bbc2e: chore: bump webpack version(5.86.0)
- c70c7737: fix: bump webpack(5.84.1) and webpack-dev-server(4.15.0)

## 0.1.11

### Patch Changes
Expand Down
6 changes: 3 additions & 3 deletions packages/bundles/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ice/bundles",
"version": "0.1.11",
"version": "0.1.12",
"license": "MIT",
"author": "ICE",
"description": "Basic dependencies for ice.",
Expand Down Expand Up @@ -65,9 +65,9 @@
"terser-webpack-plugin": "5.3.5",
"typescript": "^4.6.4",
"trusted-cert": "1.1.3",
"webpack": "5.80.0",
"webpack": "5.86.0",
"webpack-bundle-analyzer": "4.5.0",
"webpack-dev-server": "4.11.1",
"webpack-dev-server": "4.15.0",
"unplugin": "0.9.5",
"bonjour-service": "^1.0.13",
"colorette": "^2.0.10",
Expand Down
26 changes: 26 additions & 0 deletions packages/ice/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Changelog

## 3.2.6

### Patch Changes

- 94dac52e: chore: add return for default dataLoaderFetcher
- 474e1935: feat: support usePageAssets
feat: export useAppContext
- c70c7737: fix: refactor error handling
- abdd49de: fix: modified task alias not be used
- b10d9cb8: fix: support source map for stack traces in node
- c4f625a2: fix: optimize single router
- Updated dependencies [f839c67d]
- Updated dependencies [137d6b1c]
- Updated dependencies [f95bbc2e]
- Updated dependencies [474e1935]
- Updated dependencies [c68c5da3]
- Updated dependencies [f95bbc2e]
- Updated dependencies [c70c7737]
- Updated dependencies [c70c7737]
- Updated dependencies [1171475d]
- Updated dependencies [9eec33ad]
- Updated dependencies [c4f625a2]
- @ice/runtime@1.2.4
- @ice/bundles@0.1.12
- @ice/webpack-config@1.0.18

## 3.2.5

### Patch Changes
Expand Down
11 changes: 6 additions & 5 deletions packages/ice/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ice/app",
"version": "3.2.5",
"version": "3.2.6",
"description": "provide scripts and configuration used by web framework ice",
"type": "module",
"main": "./esm/index.js",
Expand Down Expand Up @@ -36,10 +36,10 @@
"bugs": "https://github.com/alibaba/ice/issues",
"homepage": "https://v3.ice.work",
"dependencies": {
"@ice/bundles": "0.1.11",
"@ice/bundles": "0.1.12",
"@ice/route-manifest": "1.2.0",
"@ice/runtime": "^1.2.3",
"@ice/webpack-config": "1.0.17",
"@ice/runtime": "^1.2.4",
"@ice/webpack-config": "1.0.18",
"@swc/helpers": "0.5.1",
"@types/express": "^4.17.14",
"address": "^1.1.2",
Expand All @@ -63,6 +63,7 @@
"regenerator-runtime": "^0.13.0",
"resolve.exports": "^1.1.0",
"semver": "^7.3.5",
"source-map-support": "^0.5.21",
"temp": "^0.9.4",
"yargs-parser": "^21.1.1"
},
Expand All @@ -82,7 +83,7 @@
"react-router": "6.11.2",
"sass": "^1.50.0",
"unplugin": "^0.9.0",
"webpack": "^5.80.0",
"webpack": "^5.86.0",
"webpack-dev-server": "^4.7.4"
},
"peerDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions packages/ice/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import { logger } from '../utils/logger.js';
import { getExpandedEnvs } from '../utils/runtimeEnv.js';
import type RouteManifest from '../utils/routeManifest.js';
import injectInitialEntry from '../utils/injectInitialEntry.js';
// Enable source map support when build.
import 'source-map-support/register.js';

const build = async (
context: Context<Config, ExtendsPluginAPI>,
Expand Down
4 changes: 4 additions & 0 deletions packages/ice/src/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,16 @@ export const RUNTIME_EXPORTS = [
'ClientOnly',
'withSuspense',
'useSuspenseData',
'usePublicAppContext',
'Await',
'defineDataLoader',
'defineServerDataLoader',
'defineStaticDataLoader',
'usePageLifecycle',
],
alias: {
usePublicAppContext: 'useAppContext',
},
source: '@ice/runtime',
},
];
21 changes: 13 additions & 8 deletions packages/ice/src/createService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { logger, createLogger } from './utils/logger.js';
import ServerRunner from './service/ServerRunner.js';
import RouteManifest from './utils/routeManifest.js';
import dynamicImport from './utils/dynamicImport.js';
import mergeTaskConfig from './utils/mergeTaskConfig.js';
import addPolyfills from './utils/runtimePolyfill.js';

const require = createRequire(import.meta.url);
Expand Down Expand Up @@ -144,9 +145,9 @@ async function createService({ rootDir, command, commandArgs }: CreateServiceOpt
delete require.cache[serverEntry];
return await dynamicImport(serverEntry, true);
}
} catch (err) {
} catch (error) {
// make error clearly, notice typeof err === 'string'
logger.error('Excute server entry error:', err);
logger.error('Execute server entry error:', error);
return;
}
}
Expand Down Expand Up @@ -232,14 +233,18 @@ async function createService({ rootDir, command, commandArgs }: CreateServiceOpt
const csr = !userConfig.ssr && !userConfig.ssg;

const disableRouter = userConfig?.optimization?.router && routesInfo.routesCount <= 1;
let taskAlias = {};
if (disableRouter) {
logger.info('`optimization.router` is enabled and only have one route, ice build will remove react-router and history which is unnecessary.');
taskAlias['@ice/runtime/router'] = path.join(require.resolve('@ice/runtime'), '../single-router.js');
taskConfigs = mergeTaskConfig(taskConfigs, {
alias: {
'@ice/runtime/router': '@ice/runtime/single-router',
},
});
} else {
// Only when router is enabled, we will add router polyfills.
addPolyfills(generatorAPI, userConfig.featurePolyfill, rootDir, command === 'start');
}

addPolyfills(generatorAPI, userConfig.featurePolyfill, rootDir, command === 'start');

// Get first task config as default platform config.
const platformTaskConfig = taskConfigs[0];

Expand Down Expand Up @@ -393,9 +398,9 @@ async function createService({ rootDir, command, commandArgs }: CreateServiceOpt
spinner: buildSpinner,
});
}
} catch (err) {
} catch (error) {
buildSpinner.stop();
throw err;
throw error;
}
},
};
Expand Down
6 changes: 4 additions & 2 deletions packages/ice/src/esbuild/scan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ const scanPlugin = (options: Options): Plugin => {
pkgNameCache.set(resolved, result);
return result;
} catch (err) {
logger.error(`cant resolve package of path: ${resolved}`, err);
logger.error(`Can't resolve package of path: ${resolved}`);
// Scan error doesn't affect the build process.
logger.error(err);
}
};

Expand Down Expand Up @@ -162,4 +164,4 @@ const scanPlugin = (options: Options): Plugin => {
};
};

export default scanPlugin;
export default scanPlugin;
Loading

0 comments on commit 170fe47

Please sign in to comment.