Skip to content

Commit

Permalink
feat: match page paths (#6801)
Browse files Browse the repository at this point in the history
* feat: match page paths

* chore: update version
  • Loading branch information
luhc228 authored Feb 26, 2024
1 parent 467ca75 commit 2fa1363
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
6 changes: 3 additions & 3 deletions packages/icejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ice.js",
"version": "2.6.7",
"version": "2.6.8",
"description": "command line interface and builtin plugin for icejs",
"author": "[email protected]",
"homepage": "",
Expand Down Expand Up @@ -33,7 +33,7 @@
"build-plugin-ice-request": "2.0.1",
"build-plugin-ice-router": "2.1.3",
"build-plugin-ice-ssr": "3.1.4",
"build-plugin-ice-store": "2.0.9",
"build-plugin-ice-store": "2.0.10",
"build-plugin-react-app": "2.2.4",
"build-plugin-pwa": "1.1.1",
"build-plugin-speed": "1.0.1",
Expand All @@ -50,4 +50,4 @@
"npm": ">=3.0.0"
},
"gitHead": "cf40d079714b437417e77b444b078cf83286f2fc"
}
}
4 changes: 4 additions & 0 deletions packages/plugin-store/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.0.10

- [feat] match page names with `-`

## 2.0.9

- [fix] convert kebab-case to PascalCase for `Layout` name, such as `hello-wordLayout` to `HelloWorldLayout`
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-store/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "build-plugin-ice-store",
"version": "2.0.9",
"version": "2.0.10",
"description": "builtin `@ice/store` in icejs",
"author": "[email protected]",
"homepage": "https://github.com/alibaba/ice#readme",
Expand Down Expand Up @@ -38,4 +38,4 @@
"devDependencies": {
"vite": "^2.4.3"
}
}
}
14 changes: 7 additions & 7 deletions packages/plugin-store/src/babelPluginReplacePath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import * as path from 'path';

// match:
// eg: src/pages/home | src/pages/home/index | src/pages/home/index(.tsx|.jsx) | src/pages/index(.tsx|jsx)
const pagePathRegExp = /src\/pages\/\w+((.tsx|.jsx?)$|(\/index(.tsx|.jsx?)?)?$)/;
const pagePathRegExp = /src\/pages\/(?:[^/*"]+)*((.tsx|.jsx?)$|(\/index(.tsx|.jsx?)?)?$)/;
// eg:src/pages/home/Layout
const layoutPathRegExp = /src\/pages\/\w+\/Layout/;
const layoutPathRegExp = /src\/pages\/(?:[^/*"]+)*\/Layout/;

module.exports = ({ types: t }, { routesPaths, alias, tempDir, applyMethod, rootDir }) => {
return {
Expand Down Expand Up @@ -87,14 +87,14 @@ interface IGetConfigRoutePathParams {
// case2: { "@src": "./src", "@pages": "./src/pages" }
// case3: { "@": "./src", "@/pages": "./src/pages" }
function matchAliasPath(
{
alias,
{
alias,
value,
applyMethod,
rootDir,
}: {
}: {
alias: IAlias;
value: string;
value: string;
applyMethod: Function;
rootDir: string;
}): string {
Expand All @@ -121,7 +121,7 @@ function matchRelativePath(
value,
applyMethod,
rootDir,
}: {
}: {
routesPath: string;
value: string;
applyMethod: Function;
Expand Down

0 comments on commit 2fa1363

Please sign in to comment.