Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(runtime-utils): split parsed from browser #5006

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/afraid-peaches-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@modern-js/plugin-router-v5': patch
'@modern-js/runtime': patch
'@modern-js/runtime-utils': patch
---

feat(runtime-utils): split parsed from browser
feat(runtime-utils): 从 browser 中拆分 parsed 方法
2 changes: 1 addition & 1 deletion packages/runtime/plugin-router-v5/src/runtime/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import hoistNonReactStatics from 'hoist-non-react-statics';
import { RuntimeReactContext, isBrowser } from '@modern-js/runtime';
import type { Plugin } from '@modern-js/runtime';
import { parsedJSONFromElement } from '@modern-js/runtime-utils/browser';
import { parsedJSONFromElement } from '@modern-js/runtime-utils/parsed';
import { renderRoutes, getLocation, urlJoin } from './utils';
import { modifyRoutesHook } from './hooks';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
RouteObject,
} from '@modern-js/runtime-utils/router';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { parsedJSONFromElement } from '@modern-js/runtime-utils/browser';
import { parsedJSONFromElement } from '@modern-js/runtime-utils/parsed';
import type { RouterSubscriber } from '@modern-js/runtime-utils/remix-router';
import { Plugin, RuntimeReactContext } from '../../core';
import { modifyRoutes as modifyRoutesHook } from './hooks';
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/plugin-runtime/src/ssr/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { loadableReady } from '@loadable/component';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { parsedJSONFromElement } from '@modern-js/runtime-utils/browser';
import { parsedJSONFromElement } from '@modern-js/runtime-utils/parsed';
import type { Plugin } from '../core';
import {
RenderLevel,
Expand Down
13 changes: 13 additions & 0 deletions packages/toolkit/runtime-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@
"jsnext:source": "./src/time.ts",
"require": "./dist/cjs/time.js",
"default": "./dist/esm/time.js"
},
"./parsed": {
"jsnext:source": "./src/parsed.ts",
"require": "./dist/cjs/parsed.js",
"default": "./dist/esm/parsed.js"
}
},
"publishConfig": {
Expand Down Expand Up @@ -84,6 +89,11 @@
"types": "./dist/types/time.d.ts",
"require": "./dist/cjs/time.js",
"default": "./dist/esm/time.js"
},
"./parsed": {
"types": "./dist/types/parsed.d.ts",
"require": "./dist/cjs/parsed.js",
"default": "./dist/esm/parsed.js"
}
}
},
Expand All @@ -106,6 +116,9 @@
],
"time": [
"./dist/types/time.d.ts"
],
"parsed": [
"./dist/types/parsed.d.ts"
]
}
},
Expand Down
1 change: 0 additions & 1 deletion packages/toolkit/runtime-utils/src/browser/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './parsed';
export * from './nestedRoutes';
2 changes: 1 addition & 1 deletion packages/toolkit/runtime-utils/tests/brower/parse.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { parsedJSONFromElement } from '../../src/browser';
import { parsedJSONFromElement } from '../../src/parsed';

describe('parsed utils', () => {
it('should return null if no alias config', () => {
Expand Down