Skip to content

Commit

Permalink
Merge pull request #6666 from alibaba/release/next
Browse files Browse the repository at this point in the history
Release 3.3.9
  • Loading branch information
ClarkXia authored Nov 30, 2023
2 parents 636ea8f + 951ca6c commit 4e5de5f
Show file tree
Hide file tree
Showing 34 changed files with 1,434 additions and 146 deletions.
3 changes: 0 additions & 3 deletions examples/with-first-chunk-cache-ssr/src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@ export default defineAppConfig({
app: {
rootId: 'app',
},
cache: {
firstChunk: true,
},
});
3 changes: 2 additions & 1 deletion examples/with-first-chunk-cache-ssr/src/document.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, Title, Links, Main, Scripts } from 'ice';
import { Meta, Title, Links, Main, Scripts, FirstChunkCache } from 'ice';

function Document() {
return (
Expand All @@ -13,6 +13,7 @@ function Document() {
</head>
<body>
<Main />
<FirstChunkCache />
<Scripts async />
</body>
</html>
Expand Down
8 changes: 8 additions & 0 deletions examples/with-unocss/ice.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from '@ice/app';
import Unocss from '@ice/plugin-unocss';

export default defineConfig(() => ({
plugins: [
Unocss(),
]
}));
20 changes: 20 additions & 0 deletions examples/with-unocss/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@examples/with-unocss",
"private": true,
"version": "1.0.0",
"scripts": {
"start": "ice start",
"build": "ice build"
},
"dependencies": {
"@ice/runtime": "workspace:*",
"react": "^18.0.0",
"react-dom": "^18.0.0"
},
"devDependencies": {
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@ice/app": "workspace:*",
"@ice/plugin-unocss": "workspace:*"
}
}
3 changes: 3 additions & 0 deletions examples/with-unocss/src/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { defineAppConfig } from 'ice';

export default defineAppConfig(() => ({}));
22 changes: 22 additions & 0 deletions examples/with-unocss/src/document.tsx
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="with-web-worker" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<Meta />
<Title />
<Links />
</head>
<body>
<Main />
<Scripts />
</body>
</html>
);
}

export default Document;
7 changes: 7 additions & 0 deletions examples/with-unocss/src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function Home() {
return (
<h1 className="text-3xl font-bold underline w-6em h-6em">
Hello world!
</h1>
);
}
2 changes: 1 addition & 1 deletion packages/bundles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"ansi-html-community": "^0.0.8",
"html-entities": "^2.3.2",
"core-js": "3.32.0",
"caniuse-lite": "^1.0.30001431",
"caniuse-lite": "^1.0.30001561",
"chokidar": "3.5.3",
"esbuild": "^0.17.16",
"events": "3.3.0",
Expand Down
10 changes: 10 additions & 0 deletions packages/ice/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 3.3.9

### Patch Changes

- 72fc36c8: chore: remove `./types` export in `typesVersions` field to be compatible with `/// <reference types="@ice/app/types" />` in scaffolds
- ddff5558: chore: better error handling for build script
- Updated dependencies [b8a6f9b8]
- Updated dependencies [5d854188]
- @ice/runtime@1.3.3

## 3.3.8

### Patch Changes
Expand Down
6 changes: 5 additions & 1 deletion packages/ice/bin/ice-cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
...parseUnknownOptions(ctx.args),
...commandArgs,
} });
service.run();
service.run().catch((error) => {
console.log(chalk.red('Build Error'), error);
// Set exit code to 1 to exit process with failure code, otherwise CI may regard build as success.
process.exit(1);
});
});

program
Expand Down
7 changes: 2 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.3.8",
"version": "3.3.9",
"description": "provide scripts and configuration used by web framework ice",
"type": "module",
"main": "./esm/index.js",
Expand All @@ -12,9 +12,6 @@
},
"typesVersions": {
"*": {
"types": [
"./esm/types/index.d.ts"
],
"analyze": [
"./esm/service/analyze.d.ts"
],
Expand Down Expand Up @@ -52,7 +49,7 @@
"dependencies": {
"@ice/bundles": "0.1.17",
"@ice/route-manifest": "1.2.2",
"@ice/runtime": "^1.3.0",
"@ice/runtime": "^1.3.3",
"@ice/shared-config": "1.1.2",
"@ice/webpack-config": "1.1.6",
"@ice/rspack-config": "1.0.7",
Expand Down
2 changes: 2 additions & 0 deletions packages/ice/src/plugins/web/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const plugin: Plugin = () => ({
'Title',
'Links',
'Scripts',
'FirstChunkCache',
'Data',
'Main',
'usePageAssets',
Expand All @@ -24,6 +25,7 @@ const plugin: Plugin = () => ({
'TitleType',
'LinksType',
'ScriptsType',
'FirstChunkCacheType',
'DataType',
'MainType',
],
Expand Down
2 changes: 1 addition & 1 deletion packages/ice/templates/core/document.tsx.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Meta, Title, Links, Main, Scripts } from 'ice';
import { Meta, Title, Links, Main, Scripts } from '@ice/runtime';

function Document() {
return (
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-i18n/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
"webpack-dev-server": "^4.13.2"
},
"peerDependencies": {
"@ice/app": "^3.3.8",
"@ice/runtime": "^1.3.2"
"@ice/app": "^3.3.9",
"@ice/runtime": "^1.3.3"
},
"publishConfig": {
"access": "public"
Expand Down
76 changes: 76 additions & 0 deletions packages/plugin-unocss/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# @ice/plugin-unocss

A plugin for enable unocss in your app based on `@ice/app`.


## Usage

Install `@ice/plugin-unocss`:

```bash
$ npm install @ice/plugin-unocss --save-dev
```

Configure it in `ice.config.mts`:

```ts
import { defineConfig } from '@ice/app';
import Unocss from '@ice/plugin-unocss';

export default defineConfig(() => ({
plugins: [
Unocss(),
]
}));
```

## Plugin Options

Plugin options is as same as [UnoCSS ConfigFle](https://unocss.dev/guide/config-file).

Plugin has a default preset `@unocss/preset-uno` for UnoCSS. You can pass options of presets to override the default preset:

```ts
import { defineConfig } from '@ice/app';
import Unocss from '@ice/plugin-unocss';
import {
defineConfig,
presetAttributify,
presetIcons,
presetTypography,
presetUno,
presetWebFonts,
transformerDirectives,
transformerVariantGroup
} from 'unocss';

export default defineConfig(() => ({
plugins: [
Unocss({
shortcuts: [
// ...
],
theme: {
colors: {
// ...
}
},
presets: [
presetUno(),
presetAttributify(),
presetIcons(),
presetTypography(),
presetWebFonts({
fonts: {
// ...
},
}),
],
transformers: [
transformerDirectives(),
transformerVariantGroup(),
],
}),
],
}));
```
43 changes: 43 additions & 0 deletions packages/plugin-unocss/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "@ice/plugin-unocss",
"version": "1.0.0",
"description": "A plugin for enable unocss in your app based on `@ice/app`",
"license": "MIT",
"type": "module",
"exports": {
".": {
"types": "./esm/index.d.ts",
"import": "./esm/index.js",
"default": "./esm/index.js"
}
},
"main": "./esm/index.js",
"types": "./esm/index.d.ts",
"files": [
"esm",
"!esm/**/*.map",
"*.d.ts"
],
"dependencies": {
"@unocss/config": "^0.57.6",
"@unocss/core": "^0.57.6",
"@unocss/reset": "^0.57.6",
"@unocss/webpack": "^0.57.6",
"unocss": "^0.57.6"
},
"devDependencies": {
"@ice/app": "workspace:^",
"@nuxt/schema": "^3.8.1"
},
"repository": {
"type": "http",
"url": "https://github.com/alibaba/ice/tree/master/packages/plugin-unocss"
},
"scripts": {
"watch": "tsc -w --sourceMap",
"build": "tsc"
},
"publishConfig": {
"access": "public"
}
}
34 changes: 34 additions & 0 deletions packages/plugin-unocss/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import type { Plugin } from '@ice/app/types';
import UnocssWebpackPlugin from '@unocss/webpack';
import type { UserConfig } from '@unocss/core';
import { presetUno } from 'unocss';

const PLUGIN_NAME = '@ice/plugin-unocss';

const plugin: Plugin<UserConfig> = (options) => ({
name: PLUGIN_NAME,
setup: ({ generator, onGetConfig }) => {
// Import uno.css in entry, when uno mode is global or dist-chunk.
generator.addEntryImportAhead({
source: 'uno.css',
});

// Register webpack plugin of unocss.
const unoConfig: UserConfig = options || {
presets: [
// Add default preset if option is null.
presetUno(),
],
};
onGetConfig((config) => {
config.configureWebpack ??= [];
config.configureWebpack.push((webpackConfig) => {
// @ts-expect-error
webpackConfig.plugins.push(UnocssWebpackPlugin({}, unoConfig));
return webpackConfig;
});
});
},
});

export default plugin;
9 changes: 9 additions & 0 deletions packages/plugin-unocss/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"baseUrl": "./",
"rootDir": "src",
"outDir": "esm"
},
"include": ["src"]
}
6 changes: 6 additions & 0 deletions packages/rax-compat/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.2.9

### Patch Changes

- 85270268: default export support

## 0.2.8

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/rax-compat/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rax-compat",
"version": "0.2.8",
"version": "0.2.9",
"description": "Rax compatible mode, running rax project on the react runtime.",
"files": [
"esm",
Expand Down
Loading

0 comments on commit 4e5de5f

Please sign in to comment.