@modern-js/devtools-client 2.35.1 → 2.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/html/main/index.html +3 -3
- package/dist/modern.config.json +16 -39
- package/dist/nestedRoutes.json +1 -1
- package/dist/routes-manifest.json +52 -120
- package/dist/static/css/512.b9f8e3c6.css +1 -0
- package/dist/static/css/async/497.0f10bc81.css +1 -0
- package/dist/static/css/async/context/builder/page.0f10bc81.css +1 -0
- package/dist/static/css/async/context/framework/page.0f10bc81.css +1 -0
- package/dist/static/css/async/overview/page.c064ca71.css +1 -0
- package/dist/static/css/async/pages/layout.7c206560.css +1 -0
- package/dist/static/css/async/pages/page.1d9b1e12.css +1 -0
- package/dist/static/css/main.a46280e5.css +1 -0
- package/dist/static/js/512.bbec4a7b.js +1 -0
- package/dist/static/js/512.bbec4a7b.js.LICENSE.txt +24 -0
- package/dist/static/js/512.bbec4a7b.js.map +1 -0
- package/dist/static/js/async/497.2b3067fc.js +1 -0
- package/dist/static/js/async/497.2b3067fc.js.map +1 -0
- package/dist/static/js/async/config/layout.7fccb2d6.js +1 -0
- package/dist/static/js/async/config/layout.7fccb2d6.js.map +1 -0
- package/dist/static/js/async/context/builder/page.47957cf6.js +1 -0
- package/dist/static/js/async/context/builder/page.47957cf6.js.map +1 -0
- package/dist/static/js/async/context/framework/page.e71519b0.js +1 -0
- package/dist/static/js/async/context/framework/page.e71519b0.js.map +1 -0
- package/dist/static/js/async/context/layout.52908030.js +1 -0
- package/dist/static/js/async/context/layout.52908030.js.map +1 -0
- package/dist/static/js/async/overview/page.efe9805b.js +1 -0
- package/dist/static/js/async/overview/page.efe9805b.js.map +1 -0
- package/dist/static/js/async/pages/layout.1abd9f26.js +1 -0
- package/dist/static/js/async/pages/layout.1abd9f26.js.map +1 -0
- package/dist/static/js/async/pages/page.98c88553.js +1 -0
- package/dist/static/js/async/pages/page.98c88553.js.map +1 -0
- package/dist/static/js/lib-polyfill.4cf65392.js +1 -0
- package/dist/static/js/lib-polyfill.4cf65392.js.map +1 -0
- package/dist/static/js/lib-react.e131c6da.js +1 -0
- package/dist/static/js/{lib-react.e7e80806.js.LICENSE.txt → lib-react.e131c6da.js.LICENSE.txt} +3 -3
- package/dist/static/js/{lib-react.e7e80806.js.map → lib-react.e131c6da.js.map} +1 -1
- package/dist/static/js/lib-router.34126dbe.js +1 -0
- package/dist/static/js/{lib-router.ee136613.js.LICENSE.txt → lib-router.34126dbe.js.LICENSE.txt} +2 -2
- package/dist/static/js/{lib-router.ee136613.js.map → lib-router.34126dbe.js.map} +1 -1
- package/dist/static/js/main.2a36389e.js +1 -0
- package/dist/static/js/main.2a36389e.js.map +1 -0
- package/package.json +30 -29
- package/.browserslistrc +0 -5
- package/.eslintrc.js +0 -4
- package/.turbo/turbo-build.log +0 -142
- package/CHANGELOG.md +0 -69
- package/build.sh +0 -5
- package/dist/static/css/198.76c8c1d9.css +0 -51
- package/dist/static/css/main.9bc38ddc.css +0 -1
- package/dist/static/js/198.9a4a2f6b.js +0 -1
- package/dist/static/js/198.9a4a2f6b.js.LICENSE.txt +0 -39
- package/dist/static/js/198.9a4a2f6b.js.map +0 -1
- package/dist/static/js/async/config/builder/resolved/page.83919c8c.js +0 -1
- package/dist/static/js/async/config/builder/resolved/page.83919c8c.js.map +0 -1
- package/dist/static/js/async/config/builder/transformed/page.cdfad512.js +0 -1
- package/dist/static/js/async/config/builder/transformed/page.cdfad512.js.map +0 -1
- package/dist/static/js/async/config/bundler/resolved/page.c2911ed1.js +0 -1
- package/dist/static/js/async/config/bundler/resolved/page.c2911ed1.js.map +0 -1
- package/dist/static/js/async/config/bundler/transformed/page.268e1037.js +0 -1
- package/dist/static/js/async/config/bundler/transformed/page.268e1037.js.map +0 -1
- package/dist/static/js/async/config/framework/resolved/page.d5729166.js +0 -1
- package/dist/static/js/async/config/framework/resolved/page.d5729166.js.map +0 -1
- package/dist/static/js/async/config/framework/transformed/page.240ab8d3.js +0 -1
- package/dist/static/js/async/config/framework/transformed/page.240ab8d3.js.map +0 -1
- package/dist/static/js/async/config/layout.272e8d6b.js +0 -1
- package/dist/static/js/async/config/layout.272e8d6b.js.map +0 -1
- package/dist/static/js/async/context/builder/page.62f2bc66.js +0 -1
- package/dist/static/js/async/context/builder/page.62f2bc66.js.map +0 -1
- package/dist/static/js/async/context/framework/page.052a6c77.js +0 -1
- package/dist/static/js/async/context/framework/page.052a6c77.js.map +0 -1
- package/dist/static/js/async/context/layout.06edb4f8.js +0 -1
- package/dist/static/js/async/context/layout.06edb4f8.js.map +0 -1
- package/dist/static/js/async/overview/page.1d1e2eae.js +0 -1
- package/dist/static/js/async/overview/page.1d1e2eae.js.map +0 -1
- package/dist/static/js/async/pages/layout.27df0fc6.js +0 -1
- package/dist/static/js/async/pages/layout.27df0fc6.js.map +0 -1
- package/dist/static/js/async/pages/page.d8425bcf.js +0 -1
- package/dist/static/js/async/pages/page.d8425bcf.js.map +0 -1
- package/dist/static/js/lib-polyfill.6e913595.js +0 -1
- package/dist/static/js/lib-polyfill.6e913595.js.map +0 -1
- package/dist/static/js/lib-react.e7e80806.js +0 -1
- package/dist/static/js/lib-router.ee136613.js +0 -1
- package/dist/static/js/main.7e1a3442.js +0 -1
- package/dist/static/js/main.7e1a3442.js.map +0 -1
- package/modern.config.ts +0 -69
- package/scripts/build-redirects.js +0 -32
- package/scripts/deploy-netlify.js +0 -0
- package/src/.eslintrc.js +0 -13
- package/src/components/Breadcrumbs.tsx +0 -43
- package/src/components/ObjectInspector.tsx +0 -37
- package/src/constants.tsx +0 -34
- package/src/modern-app-env.d.ts +0 -3
- package/src/routes/RootTabs.tsx +0 -148
- package/src/routes/config/builder/resolved/page.tsx +0 -17
- package/src/routes/config/builder/transformed/page.tsx +0 -17
- package/src/routes/config/bundler/resolved/page.tsx +0 -17
- package/src/routes/config/bundler/transformed/page.tsx +0 -17
- package/src/routes/config/framework/resolved/page.tsx +0 -17
- package/src/routes/config/framework/transformed/page.tsx +0 -17
- package/src/routes/config/layout.tsx +0 -68
- package/src/routes/config/page.loader.ts +0 -7
- package/src/routes/config/page.tsx +0 -1
- package/src/routes/context/builder/page.tsx +0 -12
- package/src/routes/context/framework/page.tsx +0 -14
- package/src/routes/context/layout.tsx +0 -38
- package/src/routes/context/page.loader.ts +0 -7
- package/src/routes/context/page.tsx +0 -1
- package/src/routes/layout.css +0 -3
- package/src/routes/layout.tsx +0 -25
- package/src/routes/overview/heading.svg +0 -12
- package/src/routes/overview/page.tsx +0 -122
- package/src/routes/page.loader.ts +0 -7
- package/src/routes/page.tsx +0 -1
- package/src/routes/pages/BaseRoute.tsx +0 -87
- package/src/routes/pages/EntryRoute/ClientRouteStats/ClientRouteStats.tsx +0 -42
- package/src/routes/pages/EntryRoute/ClientRouteStats/LegacyRouteStats.tsx +0 -6
- package/src/routes/pages/EntryRoute/ClientRouteStats/RemixRoute.tsx +0 -85
- package/src/routes/pages/EntryRoute/ClientRouteStats/RemixRouteStats.tsx +0 -44
- package/src/routes/pages/EntryRoute/ClientRouteStats/index.ts +0 -1
- package/src/routes/pages/EntryRoute/EntryRoute.tsx +0 -25
- package/src/routes/pages/EntryRoute/EntryStats.tsx +0 -44
- package/src/routes/pages/EntryRoute/MatchRemixRouteContext.ts +0 -6
- package/src/routes/pages/EntryRoute/index.ts +0 -1
- package/src/routes/pages/MatchUrl.tsx +0 -3
- package/src/routes/pages/ServerRoute.tsx +0 -21
- package/src/routes/pages/UnknownRoute.tsx +0 -20
- package/src/routes/pages/layout.tsx +0 -13
- package/src/routes/pages/page.tsx +0 -54
- package/src/rpc/index.ts +0 -36
- package/src/stores/index.tsx +0 -141
- package/src/types/index.ts +0 -62
- package/src/utils/context.tsx +0 -22
- package/src/utils/hooks.ts +0 -23
- package/src/utils/index.ts +0 -1
- package/tsconfig.json +0 -13
package/src/stores/index.tsx
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import { FC, ReactElement, createContext, useContext, useMemo } from 'react';
|
|
3
|
-
import { useAsync } from 'react-use';
|
|
4
|
-
import createDeferPromise from 'p-defer';
|
|
5
|
-
import { getQuery } from 'ufo';
|
|
6
|
-
import {
|
|
7
|
-
AppContext,
|
|
8
|
-
BuilderContext,
|
|
9
|
-
TransformedFrameworkConfig,
|
|
10
|
-
FrameworkConfig,
|
|
11
|
-
BuilderConfig,
|
|
12
|
-
NormalizedBuilderConfig,
|
|
13
|
-
BundlerConfig,
|
|
14
|
-
ClientDefinition,
|
|
15
|
-
} from '@modern-js/devtools-kit';
|
|
16
|
-
import { ref, useSnapshot } from 'valtio';
|
|
17
|
-
import { setupServerConnection } from '@/rpc';
|
|
18
|
-
import { useProxyFrom } from '@/utils/hooks';
|
|
19
|
-
import { StoreContextValue } from '@/types';
|
|
20
|
-
import { getDefaultTabs } from '@/constants';
|
|
21
|
-
|
|
22
|
-
const StoreContext = createContext<unknown>(null);
|
|
23
|
-
|
|
24
|
-
const getDataSource = () => {
|
|
25
|
-
const src =
|
|
26
|
-
getQuery(location.href).src ||
|
|
27
|
-
sessionStorage.getItem('devtools-data-source');
|
|
28
|
-
if (!_.isString(src)) {
|
|
29
|
-
throw new TypeError(`Can't connection to data source: ${src || '<EMPTY>'}`);
|
|
30
|
-
}
|
|
31
|
-
sessionStorage.setItem('devtools-data-source', src);
|
|
32
|
-
return src;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const createDeferredTasks = () => ({
|
|
36
|
-
framework: {
|
|
37
|
-
context: createDeferPromise<AppContext>(),
|
|
38
|
-
config: {
|
|
39
|
-
resolved: createDeferPromise<FrameworkConfig>(),
|
|
40
|
-
transformed: createDeferPromise<TransformedFrameworkConfig>(),
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
builder: {
|
|
44
|
-
context: createDeferPromise<BuilderContext>(),
|
|
45
|
-
config: {
|
|
46
|
-
resolved: createDeferPromise<BuilderConfig>(),
|
|
47
|
-
transformed: createDeferPromise<NormalizedBuilderConfig>(),
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
bundler: {
|
|
51
|
-
config: {
|
|
52
|
-
resolved: createDeferPromise<BundlerConfig[]>(),
|
|
53
|
-
transformed: createDeferPromise<BundlerConfig[]>(),
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
dependencies: createDeferPromise<Record<string, string>>(),
|
|
57
|
-
compileTimeCost: createDeferPromise<number>(),
|
|
58
|
-
clientDefinition: createDeferPromise<ClientDefinition>(),
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
export const StoreContextProvider: FC<{ children: ReactElement }> = ({
|
|
62
|
-
children,
|
|
63
|
-
}) => {
|
|
64
|
-
const dataSource = useMemo(getDataSource, []);
|
|
65
|
-
const deferred = useMemo(createDeferredTasks, []);
|
|
66
|
-
|
|
67
|
-
const $store = useProxyFrom<StoreContextValue>(() => ({
|
|
68
|
-
dataSource,
|
|
69
|
-
location: '/',
|
|
70
|
-
framework: {
|
|
71
|
-
context: deferred.framework.context.promise,
|
|
72
|
-
fileSystemRoutes: {},
|
|
73
|
-
config: {
|
|
74
|
-
resolved: deferred.framework.config.resolved.promise,
|
|
75
|
-
transformed: deferred.framework.config.transformed.promise,
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
builder: {
|
|
79
|
-
context: deferred.builder.context.promise,
|
|
80
|
-
config: {
|
|
81
|
-
resolved: deferred.builder.config.resolved.promise,
|
|
82
|
-
transformed: deferred.builder.config.transformed.promise,
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
bundler: {
|
|
86
|
-
config: {
|
|
87
|
-
resolved: deferred.bundler.config.resolved.promise,
|
|
88
|
-
transformed: deferred.bundler.config.transformed.promise,
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
tabs: getDefaultTabs().map(tab => ref(tab)),
|
|
92
|
-
version: process.env.PKG_VERSION!,
|
|
93
|
-
dependencies: deferred.dependencies.promise,
|
|
94
|
-
compileTimeCost: deferred.compileTimeCost.promise,
|
|
95
|
-
name: deferred.clientDefinition.promise.then(def => def.name),
|
|
96
|
-
packages: deferred.clientDefinition.promise.then(def => def.packages),
|
|
97
|
-
assets: deferred.clientDefinition.promise.then(def => def.assets),
|
|
98
|
-
}));
|
|
99
|
-
|
|
100
|
-
useAsync(async () => {
|
|
101
|
-
const { server } = await setupServerConnection({ url: dataSource, $store });
|
|
102
|
-
|
|
103
|
-
deferred.framework.context.resolve(server.getAppContext());
|
|
104
|
-
deferred.framework.config.resolved.resolve(server.getFrameworkConfig());
|
|
105
|
-
deferred.framework.config.transformed.resolve(
|
|
106
|
-
server.getTransformedFrameworkConfig(),
|
|
107
|
-
);
|
|
108
|
-
deferred.builder.context.resolve(server.getBuilderContext());
|
|
109
|
-
deferred.builder.config.resolved.resolve(server.getBuilderConfig());
|
|
110
|
-
deferred.builder.config.transformed.resolve(
|
|
111
|
-
server.getTransformedBuilderConfig(),
|
|
112
|
-
);
|
|
113
|
-
deferred.bundler.config.resolved.resolve(server.getBundlerConfigs());
|
|
114
|
-
deferred.bundler.config.transformed.resolve(
|
|
115
|
-
server.getTransformedBundlerConfigs(),
|
|
116
|
-
);
|
|
117
|
-
deferred.dependencies.resolve(server.getDependencies());
|
|
118
|
-
deferred.compileTimeCost.resolve(server.getCompileTimeCost());
|
|
119
|
-
deferred.clientDefinition.resolve(server.getClientDefinition());
|
|
120
|
-
|
|
121
|
-
const ctx = await $store.framework.context;
|
|
122
|
-
for (const { entryName } of ctx.entrypoints) {
|
|
123
|
-
$store.framework.fileSystemRoutes[entryName] =
|
|
124
|
-
server.getFileSystemRoutes(entryName);
|
|
125
|
-
}
|
|
126
|
-
}, [dataSource, deferred]);
|
|
127
|
-
|
|
128
|
-
return (
|
|
129
|
-
<StoreContext.Provider value={$store}>{children}</StoreContext.Provider>
|
|
130
|
-
);
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
export const useStore = () => {
|
|
134
|
-
const ctx = useContext(StoreContext);
|
|
135
|
-
if (!ctx) {
|
|
136
|
-
throw new Error("Can't resolve the context of global store.");
|
|
137
|
-
}
|
|
138
|
-
return ctx as StoreContextValue;
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
export const useStoreSnapshot = () => useSnapshot(useStore());
|
package/src/types/index.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
AppContext,
|
|
3
|
-
AssetDefinition,
|
|
4
|
-
BuilderConfig,
|
|
5
|
-
BuilderContext,
|
|
6
|
-
BundlerConfig,
|
|
7
|
-
CustomTabView,
|
|
8
|
-
FileSystemRoutes,
|
|
9
|
-
NameDefinition,
|
|
10
|
-
NormalizedBuilderConfig,
|
|
11
|
-
PackageDefinition,
|
|
12
|
-
TransformedFrameworkConfig,
|
|
13
|
-
} from '@modern-js/devtools-kit';
|
|
14
|
-
import { FrameworkConfig } from '@modern-js/devtools-kit';
|
|
15
|
-
import { ReactElement } from 'react';
|
|
16
|
-
import { Promisable } from 'type-fest';
|
|
17
|
-
|
|
18
|
-
export interface StoreContextValue {
|
|
19
|
-
dataSource: string;
|
|
20
|
-
framework: {
|
|
21
|
-
context: Promise<AppContext>;
|
|
22
|
-
fileSystemRoutes: Record<string, Promisable<FileSystemRoutes>>;
|
|
23
|
-
config: {
|
|
24
|
-
resolved: Promise<FrameworkConfig>;
|
|
25
|
-
transformed: Promise<TransformedFrameworkConfig>;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
builder: {
|
|
29
|
-
context: Promise<BuilderContext>;
|
|
30
|
-
config: {
|
|
31
|
-
resolved: Promise<BuilderConfig>;
|
|
32
|
-
transformed: Promise<NormalizedBuilderConfig>;
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
bundler: {
|
|
36
|
-
config: {
|
|
37
|
-
resolved: Promise<BundlerConfig[]>;
|
|
38
|
-
transformed: Promise<BundlerConfig[]>;
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
tabs: InternalTab[];
|
|
42
|
-
version: string;
|
|
43
|
-
dependencies: Promise<Record<string, string>>;
|
|
44
|
-
compileTimeCost: Promise<number>;
|
|
45
|
-
name: Promise<NameDefinition>;
|
|
46
|
-
packages: Promise<PackageDefinition>;
|
|
47
|
-
assets: Promise<AssetDefinition>;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface BuiltinTabView {
|
|
51
|
-
type: 'builtin';
|
|
52
|
-
url: string;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export type InternalTabView = CustomTabView | BuiltinTabView;
|
|
56
|
-
|
|
57
|
-
export interface InternalTab {
|
|
58
|
-
name: string;
|
|
59
|
-
title: string;
|
|
60
|
-
view: InternalTabView;
|
|
61
|
-
icon?: ReactElement;
|
|
62
|
-
}
|
package/src/utils/context.tsx
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { createContext, FC, useContext, useMemo } from 'react';
|
|
2
|
-
import { proxy } from 'valtio';
|
|
3
|
-
import { Promisable } from 'type-fest';
|
|
4
|
-
|
|
5
|
-
export function createStoreContext<T extends object>(
|
|
6
|
-
initializer: () => Promisable<T>,
|
|
7
|
-
) {
|
|
8
|
-
const InnerContext = createContext<unknown>(null);
|
|
9
|
-
const Provider: FC<{ children: React.ReactElement }> = ({ children }) => {
|
|
10
|
-
const _value = useMemo(() => initializer(), []);
|
|
11
|
-
return (
|
|
12
|
-
<InnerContext.Provider value={proxy(_value)}>
|
|
13
|
-
{children}
|
|
14
|
-
</InnerContext.Provider>
|
|
15
|
-
);
|
|
16
|
-
};
|
|
17
|
-
const _use = () => useContext(InnerContext) as T;
|
|
18
|
-
return {
|
|
19
|
-
Provider,
|
|
20
|
-
use: _use,
|
|
21
|
-
};
|
|
22
|
-
}
|
package/src/utils/hooks.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import React, { useMemo } from 'react';
|
|
3
|
-
import { proxy, useSnapshot } from 'valtio';
|
|
4
|
-
|
|
5
|
-
export const useProxyFrom = <T extends object>(initializer: () => T) => {
|
|
6
|
-
return useMemo(() => proxy(initializer()), []);
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const useStoreMap = <T extends object, P extends keyof T>(
|
|
10
|
-
arr: T[],
|
|
11
|
-
keyProp?: P,
|
|
12
|
-
): [React.Key, T][] => {
|
|
13
|
-
const prop = keyProp ?? 'key';
|
|
14
|
-
const pairs = useSnapshot(arr).map(i => {
|
|
15
|
-
const key = (i as any)[prop];
|
|
16
|
-
if (_.isString(key) || _.isNumber(key)) {
|
|
17
|
-
return [key, proxy(i)] as [React.Key, T];
|
|
18
|
-
} else {
|
|
19
|
-
throw new TypeError(`Can't found correct key field.`);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
return pairs;
|
|
23
|
-
};
|
package/src/utils/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './context';
|
package/tsconfig.json
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@modern-js/tsconfig/base",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"declaration": false,
|
|
5
|
-
"jsx": "preserve",
|
|
6
|
-
"baseUrl": "./",
|
|
7
|
-
"paths": {
|
|
8
|
-
"@/*": ["./src/*"],
|
|
9
|
-
"@shared/*": ["./shared/*"]
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
"include": ["src", "shared", "config", "modern.config.ts"]
|
|
13
|
-
}
|