@qwik.dev/devtools 0.0.3 → 0.0.5
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/LICENSE +21 -0
- package/README.md +49 -30
- package/dist/component/_virtual/_commonjsHelpers.qwik.cjs +6 -0
- package/dist/component/_virtual/_commonjsHelpers.qwik.mjs +6 -0
- package/{lib → dist/component}/devtools.qwik.cjs +19 -20
- package/{lib → dist/component}/devtools.qwik.mjs +11 -12
- package/{lib → dist/component}/index.qwik.cjs +0 -2
- package/dist/component/index.qwik.mjs +4 -0
- package/{lib-types → dist/component/lib-types/devtools/src}/index.d.ts +0 -1
- package/dist/component/node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/hi.qwik.qwik.cjs +60 -0
- package/dist/component/node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/hi.qwik.qwik.mjs +60 -0
- package/dist/component/node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/lu.qwik.qwik.cjs +32 -0
- package/dist/component/node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/lu.qwik.qwik.mjs +32 -0
- package/dist/component/node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.qwik.cjs +54 -0
- package/dist/component/node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.qwik.mjs +54 -0
- package/dist/component/node_modules/.pnpm/birpc@0.2.19/node_modules/birpc/dist/index.qwik.cjs +128 -0
- package/dist/component/node_modules/.pnpm/birpc@0.2.19/node_modules/birpc/dist/index.qwik.mjs +128 -0
- package/dist/component/node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.qwik.cjs +149 -0
- package/dist/component/node_modules/.pnpm/brace-expansion@2.0.1/node_modules/brace-expansion/index.qwik.mjs +150 -0
- package/dist/component/node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.qwik.cjs +36 -0
- package/dist/component/node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.qwik.mjs +36 -0
- package/dist/component/node_modules/.pnpm/dree@5.1.5/node_modules/dree/bundled/lib/esm/index.esm.qwik.cjs +12 -0
- package/dist/component/node_modules/.pnpm/dree@5.1.5/node_modules/dree/bundled/lib/esm/index.esm.qwik.mjs +12 -0
- package/dist/component/node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.qwik.cjs +17 -0
- package/dist/component/node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.qwik.mjs +17 -0
- package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/assert-valid-pattern.qwik.cjs +12 -0
- package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/assert-valid-pattern.qwik.mjs +12 -0
- package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/ast.qwik.cjs +513 -0
- package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/ast.qwik.mjs +513 -0
- package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/brace-expressions.qwik.cjs +110 -0
- package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/brace-expressions.qwik.mjs +110 -0
- package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/escape.qwik.cjs +6 -0
- package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/escape.qwik.mjs +6 -0
- package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/index.qwik.cjs +738 -0
- package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/index.qwik.mjs +738 -0
- package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/unescape.qwik.cjs +6 -0
- package/dist/component/node_modules/.pnpm/minimatch@10.0.1/node_modules/minimatch/dist/esm/unescape.qwik.mjs +6 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/accessDeep.qwik.cjs +120 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/accessDeep.qwik.mjs +120 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/class-registry.qwik.cjs +23 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/class-registry.qwik.mjs +23 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/custom-transformer-registry.qwik.cjs +18 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/custom-transformer-registry.qwik.mjs +18 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/double-indexed-kv.qwik.cjs +23 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/double-indexed-kv.qwik.mjs +23 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.qwik.cjs +91 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.qwik.mjs +91 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/is.qwik.cjs +51 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/is.qwik.mjs +51 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.qwik.cjs +30 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.qwik.mjs +30 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/plainer.qwik.cjs +148 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/plainer.qwik.mjs +148 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/registry.qwik.cjs +28 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/registry.qwik.mjs +28 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/transformer.qwik.cjs +203 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/transformer.qwik.mjs +203 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/util.qwik.cjs +47 -0
- package/dist/component/node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/util.qwik.mjs +47 -0
- package/dist/component/node_modules/.pnpm/vite-hot-client@0.2.4_vite@5.4.10_@types_node@20.14.11_/node_modules/vite-hot-client/dist/index.qwik.cjs +35 -0
- package/dist/component/node_modules/.pnpm/vite-hot-client@0.2.4_vite@5.4.10_@types_node@20.14.11_/node_modules/vite-hot-client/dist/index.qwik.mjs +35 -0
- package/{lib/kit → dist/component/packages/kit/src}/client.qwik.cjs +5 -5
- package/{lib/kit → dist/component/packages/kit/src}/client.qwik.mjs +2 -2
- package/{lib/kit → dist/component/packages/kit/src}/context.qwik.cjs +0 -12
- package/{lib/kit → dist/component/packages/kit/src}/context.qwik.mjs +2 -14
- package/{lib/kit → dist/component/packages/kit/src}/globals.qwik.cjs +0 -4
- package/dist/component/packages/kit/src/globals.qwik.mjs +6 -0
- package/dist/plugin/index.cjs +10504 -0
- package/dist/plugin/index.mjs +10492 -0
- package/package.json +34 -41
- package/lib/index.qwik.mjs +0 -6
- package/lib/kit/globals.qwik.mjs +0 -10
- package/lib/kit/server.qwik.cjs +0 -18
- package/lib/kit/server.qwik.mjs +0 -18
- package/lib/plugin/assets/index.qwik.cjs +0 -67
- package/lib/plugin/assets/index.qwik.mjs +0 -67
- package/lib/plugin/index.qwik.cjs +0 -49
- package/lib/plugin/index.qwik.mjs +0 -49
- package/lib/plugin/npm/index.qwik.cjs +0 -19
- package/lib/plugin/npm/index.qwik.mjs +0 -19
- package/lib/plugin/routes/index.qwik.cjs +0 -17
- package/lib/plugin/routes/index.qwik.mjs +0 -17
- package/lib/plugin/rpc/index.qwik.cjs +0 -14
- package/lib/plugin/rpc/index.qwik.mjs +0 -14
- package/lib/utils/location.qwik.cjs +0 -9
- package/lib/utils/location.qwik.mjs +0 -9
- package/lib-types/plugin/assets/index.d.ts +0 -5
- package/lib-types/plugin/components/index.d.ts +0 -0
- package/lib-types/plugin/index.d.ts +0 -2
- package/lib-types/plugin/npm/index.d.ts +0 -5
- package/lib-types/plugin/routes/index.d.ts +0 -5
- package/lib-types/plugin/rpc/index.d.ts +0 -3
- package/lib-types/plugin/types/index.d.ts +0 -5
- package/src/devtools.css +0 -558
- package/src/devtools.tsx +0 -404
- package/src/entry.dev.tsx +0 -17
- package/src/entry.ssr.tsx +0 -25
- package/src/index.ts +0 -2
- package/src/kit/client.ts +0 -21
- package/src/kit/constants.ts +0 -1
- package/src/kit/context.ts +0 -42
- package/src/kit/globals.ts +0 -22
- package/src/kit/index.ts +0 -4
- package/src/kit/server.ts +0 -21
- package/src/kit/shared.ts +0 -11
- package/src/kit/types.ts +0 -48
- package/src/plugin/assets/index.ts +0 -126
- package/src/plugin/components/index.ts +0 -0
- package/src/plugin/index.ts +0 -50
- package/src/plugin/npm/index.ts +0 -24
- package/src/plugin/routes/index.ts +0 -16
- package/src/plugin/rpc/index.ts +0 -14
- package/src/plugin/types/index.ts +0 -6
- package/src/root.tsx +0 -15
- package/src/utils/location.ts +0 -9
- /package/{lib → dist/component}/devtools.css.qwik.cjs +0 -0
- /package/{lib → dist/component}/devtools.css.qwik.mjs +0 -0
- /package/{lib-types → dist/component/lib-types/devtools/src}/devtools.d.ts +0 -0
- /package/{lib-types → dist/component/lib-types/devtools/src}/entry.dev.d.ts +0 -0
- /package/{lib-types → dist/component/lib-types/devtools/src}/entry.ssr.d.ts +0 -0
- /package/{lib-types → dist/component/lib-types/devtools/src}/root.d.ts +0 -0
- /package/{lib-types → dist/component/lib-types/devtools/src}/utils/location.d.ts +0 -0
- /package/{lib-types/kit → dist/component/lib-types/kit/src}/client.d.ts +0 -0
- /package/{lib-types/kit → dist/component/lib-types/kit/src}/constants.d.ts +0 -0
- /package/{lib-types/kit → dist/component/lib-types/kit/src}/context.d.ts +0 -0
- /package/{lib-types/kit → dist/component/lib-types/kit/src}/globals.d.ts +0 -0
- /package/{lib-types/kit → dist/component/lib-types/kit/src}/index.d.ts +0 -0
- /package/{lib-types/kit → dist/component/lib-types/kit/src}/server.d.ts +0 -0
- /package/{lib-types/kit → dist/component/lib-types/kit/src}/shared.d.ts +0 -0
- /package/{lib-types/kit → dist/component/lib-types/kit/src}/types.d.ts +0 -0
- /package/{lib/kit → dist/component/packages/kit/src}/constants.qwik.cjs +0 -0
- /package/{lib/kit → dist/component/packages/kit/src}/constants.qwik.mjs +0 -0
- /package/{lib/kit → dist/component/packages/kit/src}/shared.qwik.cjs +0 -0
- /package/{lib/kit → dist/component/packages/kit/src}/shared.qwik.mjs +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 qwikdev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,47 +1,66 @@
|
|
|
1
|
-
# Qwik
|
|
1
|
+
# Qwik DevTools
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
- [Discord](https://qwik.dev/chat)
|
|
5
|
-
- [Qwik on GitHub](https://github.com/QwikDev/qwik)
|
|
6
|
-
- [@QwikDev](https://twitter.com/QwikDev)
|
|
7
|
-
- [Vite](https://vitejs.dev/)
|
|
8
|
-
- [Partytown](https://partytown.builder.io/)
|
|
9
|
-
- [Mitosis](https://github.com/BuilderIO/mitosis)
|
|
10
|
-
- [Builder.io](https://www.builder.io/)
|
|
3
|
+

|
|
11
4
|
|
|
12
|
-
|
|
5
|
+
Enhance your Qwik development experience with DevTools that provide real-time insights into your application, dependencies, and setup.
|
|
13
6
|
|
|
14
|
-
##
|
|
7
|
+
## Installation
|
|
15
8
|
|
|
16
|
-
|
|
9
|
+
> Qwik DevTools requires **Qwik v2.0.0-alpha.4 or higher**.
|
|
17
10
|
|
|
11
|
+
```shell copy
|
|
12
|
+
npm install @qwik.dev/devtools -D
|
|
18
13
|
```
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
├── components/
|
|
23
|
-
│ └── ...
|
|
24
|
-
└── index.ts
|
|
14
|
+
|
|
15
|
+
```shell copy
|
|
16
|
+
pnpm add @qwik.dev/devtools -D
|
|
25
17
|
```
|
|
26
18
|
|
|
27
|
-
|
|
19
|
+
```shell copy
|
|
20
|
+
yarn add @qwik.dev/devtools -D
|
|
21
|
+
```
|
|
28
22
|
|
|
29
|
-
|
|
23
|
+
## Setup
|
|
30
24
|
|
|
31
|
-
|
|
25
|
+
Add the plugin to your `vite.config.(m)ts`:
|
|
32
26
|
|
|
33
|
-
|
|
27
|
+
```ts copy
|
|
28
|
+
import { qwikDevtools } from '@qwik.dev/devtools';
|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
export default defineConfig({
|
|
31
|
+
plugins: [
|
|
32
|
+
qwikRouter(),
|
|
33
|
+
qwikVite(),
|
|
34
|
+
tsconfigPaths(),
|
|
35
|
+
qwikDevtools(), // 👈 Add the plugin here
|
|
36
|
+
],
|
|
37
|
+
});
|
|
37
38
|
```
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
## Features
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
- 🔍 Route Explorer
|
|
43
|
+
- ⚡️ Dependency Explorer
|
|
44
|
+
- 📊 Asset Explorer
|
|
45
|
+
- 🐞 Debug Tools
|
|
42
46
|
|
|
43
|
-
|
|
47
|
+
## Contribution Guide
|
|
48
|
+
|
|
49
|
+
Please refer to the [Contribution Guide](./CONTRIBUTING.md). Sharing feedback and feature request with GitHub issues is welcome.
|
|
50
|
+
|
|
51
|
+
## Community
|
|
52
|
+
|
|
53
|
+
Join our vibrant community:
|
|
54
|
+
|
|
55
|
+
- 🐦 Follow [@QwikDev](https://twitter.com/QwikDev) on Twitter
|
|
56
|
+
- 💬 Join our [Discord](https://qwik.dev/chat) community
|
|
57
|
+
- 🌐 Check out [other community groups](https://qwik.dev/ecosystem/#community)
|
|
58
|
+
|
|
59
|
+
## Related Links
|
|
60
|
+
|
|
61
|
+
- [📚 Qwik Documentation](https://qwik.dev/)
|
|
62
|
+
- [💬 Discord Chat](https://qwik.dev/chat)
|
|
63
|
+
- [⭐️ Qwik GitHub](https://github.com/QwikDev/qwik)
|
|
64
|
+
- [🐦 @QwikDev](https://twitter.com/QwikDev)
|
|
65
|
+
- [⚡️ Vite](https://vitejs.dev/)
|
|
44
66
|
|
|
45
|
-
```
|
|
46
|
-
pnpm build
|
|
47
|
-
```
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
function getDefaultExportFromCjs(x) {
|
|
4
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
5
|
+
}
|
|
6
|
+
exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
|
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("@qwik.dev/core/jsx-runtime");
|
|
4
4
|
const core = require("@qwik.dev/core");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const client = require("./kit/client.qwik.cjs");
|
|
9
|
-
require("superjson");
|
|
10
|
-
require("
|
|
11
|
-
const
|
|
12
|
-
const dree = require("dree");
|
|
5
|
+
const index = require("./node_modules/.pnpm/vite-hot-client@0.2.4_vite@5.4.10_@types_node@20.14.11_/node_modules/vite-hot-client/dist/index.qwik.cjs");
|
|
6
|
+
const hi_qwik = require("./node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/hi.qwik.qwik.cjs");
|
|
7
|
+
const lu_qwik = require("./node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/lu.qwik.qwik.cjs");
|
|
8
|
+
const client = require("./packages/kit/src/client.qwik.cjs");
|
|
9
|
+
require("./node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.qwik.cjs");
|
|
10
|
+
const context = require("./packages/kit/src/context.qwik.cjs");
|
|
11
|
+
const index_esm = require("./node_modules/.pnpm/dree@5.1.5/node_modules/dree/bundled/lib/esm/index.esm.qwik.cjs");
|
|
13
12
|
const devtools = require("./devtools.css.qwik.cjs");
|
|
14
|
-
const
|
|
13
|
+
const router = require("@qwik.dev/router");
|
|
15
14
|
function getClientRpcFunctions() {
|
|
16
15
|
return {
|
|
17
16
|
healthCheck: () => true
|
|
@@ -27,9 +26,9 @@ const QwikDevtools = core.component$(() => {
|
|
|
27
26
|
routes: void 0
|
|
28
27
|
});
|
|
29
28
|
const panelRef = core.useSignal();
|
|
30
|
-
const location
|
|
29
|
+
const location = router.useLocation();
|
|
31
30
|
core.useVisibleTask$(async ({ cleanup, track }) => {
|
|
32
|
-
const hot = await
|
|
31
|
+
const hot = await index.tryCreateHotContext(void 0, [
|
|
33
32
|
"/"
|
|
34
33
|
]);
|
|
35
34
|
if (!hot) {
|
|
@@ -50,7 +49,7 @@ const QwikDevtools = core.component$(() => {
|
|
|
50
49
|
{
|
|
51
50
|
relativePath: "",
|
|
52
51
|
name: "index",
|
|
53
|
-
type:
|
|
52
|
+
type: index_esm.Type.DIRECTORY,
|
|
54
53
|
path: "",
|
|
55
54
|
isSymbolicLink: false,
|
|
56
55
|
children: void 0
|
|
@@ -117,7 +116,7 @@ const QwikDevtools = core.component$(() => {
|
|
|
117
116
|
},
|
|
118
117
|
onClick$: () => state.activeTab = "overview",
|
|
119
118
|
title: "Overview",
|
|
120
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
119
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(hi_qwik.HiBoltOutline, {
|
|
121
120
|
width: 20,
|
|
122
121
|
height: 20
|
|
123
122
|
})
|
|
@@ -128,7 +127,7 @@ const QwikDevtools = core.component$(() => {
|
|
|
128
127
|
},
|
|
129
128
|
onClick$: () => state.activeTab = "components",
|
|
130
129
|
title: "Components",
|
|
131
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
130
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(hi_qwik.HiCubeOutline, {
|
|
132
131
|
width: 20,
|
|
133
132
|
height: 20
|
|
134
133
|
})
|
|
@@ -139,7 +138,7 @@ const QwikDevtools = core.component$(() => {
|
|
|
139
138
|
},
|
|
140
139
|
onClick$: () => state.activeTab = "routes",
|
|
141
140
|
title: "Routes",
|
|
142
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
141
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lu_qwik.LuFolderTree, {
|
|
143
142
|
width: 20,
|
|
144
143
|
height: 20
|
|
145
144
|
})
|
|
@@ -174,7 +173,7 @@ const QwikDevtools = core.component$(() => {
|
|
|
174
173
|
},
|
|
175
174
|
onClick$: () => state.activeTab = "assets",
|
|
176
175
|
title: "Assets",
|
|
177
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
176
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(hi_qwik.HiPhotoOutline, {
|
|
178
177
|
width: 20,
|
|
179
178
|
height: 20
|
|
180
179
|
})
|
|
@@ -222,7 +221,7 @@ const QwikDevtools = core.component$(() => {
|
|
|
222
221
|
children: [
|
|
223
222
|
/* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
224
223
|
class: "metric-icon",
|
|
225
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
224
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lu_qwik.LuFolderTree, {
|
|
226
225
|
class: "icon"
|
|
227
226
|
})
|
|
228
227
|
}),
|
|
@@ -246,7 +245,7 @@ const QwikDevtools = core.component$(() => {
|
|
|
246
245
|
children: [
|
|
247
246
|
/* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
248
247
|
class: "metric-icon",
|
|
249
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
248
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(hi_qwik.HiCubeOutline, {
|
|
250
249
|
class: "icon"
|
|
251
250
|
})
|
|
252
251
|
}),
|
|
@@ -270,7 +269,7 @@ const QwikDevtools = core.component$(() => {
|
|
|
270
269
|
children: [
|
|
271
270
|
/* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
272
271
|
class: "metric-icon",
|
|
273
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
272
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(hi_qwik.HiPhotoOutline, {
|
|
274
273
|
class: "icon"
|
|
275
274
|
})
|
|
276
275
|
}),
|
|
@@ -502,7 +501,7 @@ const QwikDevtools = core.component$(() => {
|
|
|
502
501
|
/* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
503
502
|
class: "col-route",
|
|
504
503
|
children: /* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
505
|
-
class: location
|
|
504
|
+
class: location.url.pathname === "/" && route.relativePath === "" || location.url.pathname === `/${route.relativePath}/` ? "active-route" : "",
|
|
506
505
|
children: route.relativePath === "" ? "/" : `/${route.relativePath}/`
|
|
507
506
|
})
|
|
508
507
|
}),
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { jsxs, jsx } from "@qwik.dev/core/jsx-runtime";
|
|
2
2
|
import { component$, useStyles$, useStore, useSignal, useVisibleTask$, noSerialize } from "@qwik.dev/core";
|
|
3
|
-
import { tryCreateHotContext } from "vite-hot-client";
|
|
4
|
-
import { HiBoltOutline, HiCubeOutline, HiPhotoOutline } from "@qwikest/icons/
|
|
5
|
-
import { LuFolderTree } from "@qwikest/icons/
|
|
6
|
-
import { createClientRpc } from "./kit/client.qwik.mjs";
|
|
7
|
-
import "superjson";
|
|
8
|
-
import "
|
|
9
|
-
import {
|
|
10
|
-
import { Type } from "dree";
|
|
3
|
+
import { tryCreateHotContext } from "./node_modules/.pnpm/vite-hot-client@0.2.4_vite@5.4.10_@types_node@20.14.11_/node_modules/vite-hot-client/dist/index.qwik.mjs";
|
|
4
|
+
import { HiBoltOutline, HiCubeOutline, HiPhotoOutline } from "./node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/hi.qwik.qwik.mjs";
|
|
5
|
+
import { LuFolderTree } from "./node_modules/.pnpm/@qwikest_icons@0.0.13_@builder.io_qwik@1.11.0_vite@5.4.10_@types_node@20.14.11__/node_modules/@qwikest/icons/lib/lu.qwik.qwik.mjs";
|
|
6
|
+
import { createClientRpc } from "./packages/kit/src/client.qwik.mjs";
|
|
7
|
+
import "./node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/index.qwik.mjs";
|
|
8
|
+
import { setViteClientContext, getViteClientRpc } from "./packages/kit/src/context.qwik.mjs";
|
|
9
|
+
import { Type as re } from "./node_modules/.pnpm/dree@5.1.5/node_modules/dree/bundled/lib/esm/index.esm.qwik.mjs";
|
|
11
10
|
import styles from "./devtools.css.qwik.mjs";
|
|
12
|
-
import {
|
|
11
|
+
import { useLocation } from "@qwik.dev/router";
|
|
13
12
|
function getClientRpcFunctions() {
|
|
14
13
|
return {
|
|
15
14
|
healthCheck: () => true
|
|
@@ -25,7 +24,7 @@ const QwikDevtools = component$(() => {
|
|
|
25
24
|
routes: void 0
|
|
26
25
|
});
|
|
27
26
|
const panelRef = useSignal();
|
|
28
|
-
const location =
|
|
27
|
+
const location = useLocation();
|
|
29
28
|
useVisibleTask$(async ({ cleanup, track }) => {
|
|
30
29
|
const hot = await tryCreateHotContext(void 0, [
|
|
31
30
|
"/"
|
|
@@ -48,7 +47,7 @@ const QwikDevtools = component$(() => {
|
|
|
48
47
|
{
|
|
49
48
|
relativePath: "",
|
|
50
49
|
name: "index",
|
|
51
|
-
type:
|
|
50
|
+
type: re.DIRECTORY,
|
|
52
51
|
path: "",
|
|
53
52
|
isSymbolicLink: false,
|
|
54
53
|
children: void 0
|
|
@@ -500,7 +499,7 @@ const QwikDevtools = component$(() => {
|
|
|
500
499
|
/* @__PURE__ */ jsx("div", {
|
|
501
500
|
class: "col-route",
|
|
502
501
|
children: /* @__PURE__ */ jsx("span", {
|
|
503
|
-
class: location === `/${route.relativePath}
|
|
502
|
+
class: location.url.pathname === "/" && route.relativePath === "" || location.url.pathname === `/${route.relativePath}/` ? "active-route" : "",
|
|
504
503
|
children: route.relativePath === "" ? "/" : `/${route.relativePath}/`
|
|
505
504
|
})
|
|
506
505
|
}),
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("./plugin/index.qwik.cjs");
|
|
4
3
|
const devtools = require("./devtools.qwik.cjs");
|
|
5
|
-
exports.qwikDevtools = index.qwikDevtools;
|
|
6
4
|
exports.QwikDevtools = devtools.QwikDevtools;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const core = require("@qwik.dev/core");
|
|
4
|
+
const HiBoltOutline = (props) => /* @__PURE__ */ core._jsxS("svg", {
|
|
5
|
+
...props,
|
|
6
|
+
children: /* @__PURE__ */ core._jsxQ("path", null, {
|
|
7
|
+
d: "M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z",
|
|
8
|
+
"stroke-linecap": "round",
|
|
9
|
+
"stroke-linejoin": "round"
|
|
10
|
+
}, null, 3, null)
|
|
11
|
+
}, {
|
|
12
|
+
"aria-hidden": "true",
|
|
13
|
+
"data-qwikest-icon": true,
|
|
14
|
+
fill: "none",
|
|
15
|
+
height: "1em",
|
|
16
|
+
stroke: "currentColor",
|
|
17
|
+
"stroke-width": "1.5",
|
|
18
|
+
viewBox: "0 0 24 24",
|
|
19
|
+
width: "1em",
|
|
20
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
21
|
+
}, 0, "z0_0");
|
|
22
|
+
const HiCubeOutline = (props) => /* @__PURE__ */ core._jsxS("svg", {
|
|
23
|
+
...props,
|
|
24
|
+
children: /* @__PURE__ */ core._jsxQ("path", null, {
|
|
25
|
+
d: "M21 7.5l-9-5.25L3 7.5m18 0l-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9",
|
|
26
|
+
"stroke-linecap": "round",
|
|
27
|
+
"stroke-linejoin": "round"
|
|
28
|
+
}, null, 3, null)
|
|
29
|
+
}, {
|
|
30
|
+
"aria-hidden": "true",
|
|
31
|
+
"data-qwikest-icon": true,
|
|
32
|
+
fill: "none",
|
|
33
|
+
height: "1em",
|
|
34
|
+
stroke: "currentColor",
|
|
35
|
+
"stroke-width": "1.5",
|
|
36
|
+
viewBox: "0 0 24 24",
|
|
37
|
+
width: "1em",
|
|
38
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
39
|
+
}, 0, "Tf_0");
|
|
40
|
+
const HiPhotoOutline = (props) => /* @__PURE__ */ core._jsxS("svg", {
|
|
41
|
+
...props,
|
|
42
|
+
children: /* @__PURE__ */ core._jsxQ("path", null, {
|
|
43
|
+
d: "M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z",
|
|
44
|
+
"stroke-linecap": "round",
|
|
45
|
+
"stroke-linejoin": "round"
|
|
46
|
+
}, null, 3, null)
|
|
47
|
+
}, {
|
|
48
|
+
"aria-hidden": "true",
|
|
49
|
+
"data-qwikest-icon": true,
|
|
50
|
+
fill: "none",
|
|
51
|
+
height: "1em",
|
|
52
|
+
stroke: "currentColor",
|
|
53
|
+
"stroke-width": "1.5",
|
|
54
|
+
viewBox: "0 0 24 24",
|
|
55
|
+
width: "1em",
|
|
56
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
57
|
+
}, 0, "Vu_0");
|
|
58
|
+
exports.HiBoltOutline = HiBoltOutline;
|
|
59
|
+
exports.HiCubeOutline = HiCubeOutline;
|
|
60
|
+
exports.HiPhotoOutline = HiPhotoOutline;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { _jsxS, _jsxQ } from "@qwik.dev/core";
|
|
2
|
+
const HiBoltOutline = (props) => /* @__PURE__ */ _jsxS("svg", {
|
|
3
|
+
...props,
|
|
4
|
+
children: /* @__PURE__ */ _jsxQ("path", null, {
|
|
5
|
+
d: "M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75z",
|
|
6
|
+
"stroke-linecap": "round",
|
|
7
|
+
"stroke-linejoin": "round"
|
|
8
|
+
}, null, 3, null)
|
|
9
|
+
}, {
|
|
10
|
+
"aria-hidden": "true",
|
|
11
|
+
"data-qwikest-icon": true,
|
|
12
|
+
fill: "none",
|
|
13
|
+
height: "1em",
|
|
14
|
+
stroke: "currentColor",
|
|
15
|
+
"stroke-width": "1.5",
|
|
16
|
+
viewBox: "0 0 24 24",
|
|
17
|
+
width: "1em",
|
|
18
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
19
|
+
}, 0, "z0_0");
|
|
20
|
+
const HiCubeOutline = (props) => /* @__PURE__ */ _jsxS("svg", {
|
|
21
|
+
...props,
|
|
22
|
+
children: /* @__PURE__ */ _jsxQ("path", null, {
|
|
23
|
+
d: "M21 7.5l-9-5.25L3 7.5m18 0l-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9",
|
|
24
|
+
"stroke-linecap": "round",
|
|
25
|
+
"stroke-linejoin": "round"
|
|
26
|
+
}, null, 3, null)
|
|
27
|
+
}, {
|
|
28
|
+
"aria-hidden": "true",
|
|
29
|
+
"data-qwikest-icon": true,
|
|
30
|
+
fill: "none",
|
|
31
|
+
height: "1em",
|
|
32
|
+
stroke: "currentColor",
|
|
33
|
+
"stroke-width": "1.5",
|
|
34
|
+
viewBox: "0 0 24 24",
|
|
35
|
+
width: "1em",
|
|
36
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
37
|
+
}, 0, "Tf_0");
|
|
38
|
+
const HiPhotoOutline = (props) => /* @__PURE__ */ _jsxS("svg", {
|
|
39
|
+
...props,
|
|
40
|
+
children: /* @__PURE__ */ _jsxQ("path", null, {
|
|
41
|
+
d: "M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909m-18 3.75h16.5a1.5 1.5 0 001.5-1.5V6a1.5 1.5 0 00-1.5-1.5H3.75A1.5 1.5 0 002.25 6v12a1.5 1.5 0 001.5 1.5zm10.5-11.25h.008v.008h-.008V8.25zm.375 0a.375.375 0 11-.75 0 .375.375 0 01.75 0z",
|
|
42
|
+
"stroke-linecap": "round",
|
|
43
|
+
"stroke-linejoin": "round"
|
|
44
|
+
}, null, 3, null)
|
|
45
|
+
}, {
|
|
46
|
+
"aria-hidden": "true",
|
|
47
|
+
"data-qwikest-icon": true,
|
|
48
|
+
fill: "none",
|
|
49
|
+
height: "1em",
|
|
50
|
+
stroke: "currentColor",
|
|
51
|
+
"stroke-width": "1.5",
|
|
52
|
+
viewBox: "0 0 24 24",
|
|
53
|
+
width: "1em",
|
|
54
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
55
|
+
}, 0, "Vu_0");
|
|
56
|
+
export {
|
|
57
|
+
HiBoltOutline,
|
|
58
|
+
HiCubeOutline,
|
|
59
|
+
HiPhotoOutline
|
|
60
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const core = require("@qwik.dev/core");
|
|
4
|
+
const LuFolderTree = (props) => /* @__PURE__ */ core._jsxS("svg", {
|
|
5
|
+
...props,
|
|
6
|
+
children: [
|
|
7
|
+
/* @__PURE__ */ core._jsxQ("path", null, {
|
|
8
|
+
d: "M13 10h7a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z"
|
|
9
|
+
}, null, 3, null),
|
|
10
|
+
/* @__PURE__ */ core._jsxQ("path", null, {
|
|
11
|
+
d: "M13 21h7a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.88a1 1 0 0 1-.9-.55l-.44-.9a1 1 0 0 0-.9-.55H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z"
|
|
12
|
+
}, null, 3, null),
|
|
13
|
+
/* @__PURE__ */ core._jsxQ("path", null, {
|
|
14
|
+
d: "M3 3v2c0 1.1.9 2 2 2h3"
|
|
15
|
+
}, null, 3, null),
|
|
16
|
+
/* @__PURE__ */ core._jsxQ("path", null, {
|
|
17
|
+
d: "M3 3v13c0 1.1.9 2 2 2h3"
|
|
18
|
+
}, null, 3, null)
|
|
19
|
+
]
|
|
20
|
+
}, {
|
|
21
|
+
"data-qwikest-icon": true,
|
|
22
|
+
fill: "none",
|
|
23
|
+
height: "1em",
|
|
24
|
+
stroke: "currentColor",
|
|
25
|
+
"stroke-linecap": "round",
|
|
26
|
+
"stroke-linejoin": "round",
|
|
27
|
+
"stroke-width": "2",
|
|
28
|
+
viewBox: "0 0 24 24",
|
|
29
|
+
width: "1em",
|
|
30
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
31
|
+
}, 0, "Sp_0");
|
|
32
|
+
exports.LuFolderTree = LuFolderTree;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { _jsxS, _jsxQ } from "@qwik.dev/core";
|
|
2
|
+
const LuFolderTree = (props) => /* @__PURE__ */ _jsxS("svg", {
|
|
3
|
+
...props,
|
|
4
|
+
children: [
|
|
5
|
+
/* @__PURE__ */ _jsxQ("path", null, {
|
|
6
|
+
d: "M13 10h7a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z"
|
|
7
|
+
}, null, 3, null),
|
|
8
|
+
/* @__PURE__ */ _jsxQ("path", null, {
|
|
9
|
+
d: "M13 21h7a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.88a1 1 0 0 1-.9-.55l-.44-.9a1 1 0 0 0-.9-.55H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z"
|
|
10
|
+
}, null, 3, null),
|
|
11
|
+
/* @__PURE__ */ _jsxQ("path", null, {
|
|
12
|
+
d: "M3 3v2c0 1.1.9 2 2 2h3"
|
|
13
|
+
}, null, 3, null),
|
|
14
|
+
/* @__PURE__ */ _jsxQ("path", null, {
|
|
15
|
+
d: "M3 3v13c0 1.1.9 2 2 2h3"
|
|
16
|
+
}, null, 3, null)
|
|
17
|
+
]
|
|
18
|
+
}, {
|
|
19
|
+
"data-qwikest-icon": true,
|
|
20
|
+
fill: "none",
|
|
21
|
+
height: "1em",
|
|
22
|
+
stroke: "currentColor",
|
|
23
|
+
"stroke-linecap": "round",
|
|
24
|
+
"stroke-linejoin": "round",
|
|
25
|
+
"stroke-width": "2",
|
|
26
|
+
viewBox: "0 0 24 24",
|
|
27
|
+
width: "1em",
|
|
28
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
29
|
+
}, 0, "Sp_0");
|
|
30
|
+
export {
|
|
31
|
+
LuFolderTree
|
|
32
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
var balancedMatch = balanced;
|
|
4
|
+
function balanced(a, b, str) {
|
|
5
|
+
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
6
|
+
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
7
|
+
var r = range(a, b, str);
|
|
8
|
+
return r && {
|
|
9
|
+
start: r[0],
|
|
10
|
+
end: r[1],
|
|
11
|
+
pre: str.slice(0, r[0]),
|
|
12
|
+
body: str.slice(r[0] + a.length, r[1]),
|
|
13
|
+
post: str.slice(r[1] + b.length)
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function maybeMatch(reg, str) {
|
|
17
|
+
var m = str.match(reg);
|
|
18
|
+
return m ? m[0] : null;
|
|
19
|
+
}
|
|
20
|
+
balanced.range = range;
|
|
21
|
+
function range(a, b, str) {
|
|
22
|
+
var begs, beg, left, right, result;
|
|
23
|
+
var ai = str.indexOf(a);
|
|
24
|
+
var bi = str.indexOf(b, ai + 1);
|
|
25
|
+
var i = ai;
|
|
26
|
+
if (ai >= 0 && bi > 0) {
|
|
27
|
+
if (a === b) {
|
|
28
|
+
return [ai, bi];
|
|
29
|
+
}
|
|
30
|
+
begs = [];
|
|
31
|
+
left = str.length;
|
|
32
|
+
while (i >= 0 && !result) {
|
|
33
|
+
if (i == ai) {
|
|
34
|
+
begs.push(i);
|
|
35
|
+
ai = str.indexOf(a, i + 1);
|
|
36
|
+
} else if (begs.length == 1) {
|
|
37
|
+
result = [begs.pop(), bi];
|
|
38
|
+
} else {
|
|
39
|
+
beg = begs.pop();
|
|
40
|
+
if (beg < left) {
|
|
41
|
+
left = beg;
|
|
42
|
+
right = bi;
|
|
43
|
+
}
|
|
44
|
+
bi = str.indexOf(b, i + 1);
|
|
45
|
+
}
|
|
46
|
+
i = ai < bi && ai >= 0 ? ai : bi;
|
|
47
|
+
}
|
|
48
|
+
if (begs.length) {
|
|
49
|
+
result = [left, right];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
exports.balancedMatch = balancedMatch;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var balancedMatch = balanced;
|
|
2
|
+
function balanced(a, b, str) {
|
|
3
|
+
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
4
|
+
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
5
|
+
var r = range(a, b, str);
|
|
6
|
+
return r && {
|
|
7
|
+
start: r[0],
|
|
8
|
+
end: r[1],
|
|
9
|
+
pre: str.slice(0, r[0]),
|
|
10
|
+
body: str.slice(r[0] + a.length, r[1]),
|
|
11
|
+
post: str.slice(r[1] + b.length)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function maybeMatch(reg, str) {
|
|
15
|
+
var m = str.match(reg);
|
|
16
|
+
return m ? m[0] : null;
|
|
17
|
+
}
|
|
18
|
+
balanced.range = range;
|
|
19
|
+
function range(a, b, str) {
|
|
20
|
+
var begs, beg, left, right, result;
|
|
21
|
+
var ai = str.indexOf(a);
|
|
22
|
+
var bi = str.indexOf(b, ai + 1);
|
|
23
|
+
var i = ai;
|
|
24
|
+
if (ai >= 0 && bi > 0) {
|
|
25
|
+
if (a === b) {
|
|
26
|
+
return [ai, bi];
|
|
27
|
+
}
|
|
28
|
+
begs = [];
|
|
29
|
+
left = str.length;
|
|
30
|
+
while (i >= 0 && !result) {
|
|
31
|
+
if (i == ai) {
|
|
32
|
+
begs.push(i);
|
|
33
|
+
ai = str.indexOf(a, i + 1);
|
|
34
|
+
} else if (begs.length == 1) {
|
|
35
|
+
result = [begs.pop(), bi];
|
|
36
|
+
} else {
|
|
37
|
+
beg = begs.pop();
|
|
38
|
+
if (beg < left) {
|
|
39
|
+
left = beg;
|
|
40
|
+
right = bi;
|
|
41
|
+
}
|
|
42
|
+
bi = str.indexOf(b, i + 1);
|
|
43
|
+
}
|
|
44
|
+
i = ai < bi && ai >= 0 ? ai : bi;
|
|
45
|
+
}
|
|
46
|
+
if (begs.length) {
|
|
47
|
+
result = [left, right];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
balancedMatch as b
|
|
54
|
+
};
|