@x18n/devtools 0.0.0-stage → 0.0.12

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.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-PRESENT Anthony Fu <https://github.com/antfu>
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.
@@ -0,0 +1,7 @@
1
+ import { t as X18nDevtoolsOptions } from "./load-BCdWXZqo.mjs";
2
+ import { DevframeDefinition } from "devframe";
3
+ //#region src/devframe.d.ts
4
+ /** The x18n devframe for a hub (`initHub`, `viteDevframeHub`): loads the workspace from the hub's root when mounted. */
5
+ export declare function createX18nDevframe(options?: X18nDevtoolsOptions): DevframeDefinition;
6
+ //#endregion
7
+ export type { X18nDevtoolsOptions };
@@ -0,0 +1,9 @@
1
+ import { n as rpcOptions, t as loadProjects } from "./load-BT8iVW8J.mjs";
2
+ import { createX18nDevframe as createX18nDevframe$1 } from "@x18n/ui";
3
+ //#region src/devframe.ts
4
+ /** The x18n devframe for a hub (`initHub`, `viteDevframeHub`): loads the workspace from the hub's root when mounted. */
5
+ function createX18nDevframe(options = {}) {
6
+ return createX18nDevframe$1((ctx) => loadProjects(ctx, options), rpcOptions);
7
+ }
8
+ //#endregion
9
+ export { createX18nDevframe };
@@ -0,0 +1,11 @@
1
+ import "@x18n/ui";
2
+ import "devframe";
3
+ //#region src/load.d.ts
4
+ interface X18nDevtoolsOptions {
5
+ /** Project root. Defaults to the host's root (the Vite root), from where x18n searches upward for a config. */
6
+ readonly root?: string | undefined;
7
+ /** Config file, instead of searching for one. */
8
+ readonly config?: string | undefined;
9
+ }
10
+ //#endregion
11
+ export { X18nDevtoolsOptions as t };
@@ -0,0 +1,19 @@
1
+ import { join } from "node:path";
2
+ import process from "node:process";
3
+ import { loadWorkspace, stderrLogger } from "@x18n/node";
4
+ import { launchEditor } from "devframe/utils/launch-editor";
5
+ //#region src/load.ts
6
+ async function loadProjects(ctx, options) {
7
+ const { projects } = await loadWorkspace({
8
+ cwd: options.root ?? ctx.cwd,
9
+ configFile: options.config,
10
+ upward: options.root === void 0,
11
+ cache: true,
12
+ logger: stderrLogger
13
+ });
14
+ if (ctx.mode === "dev") projects.forEach((p) => p.project.watch());
15
+ return projects;
16
+ }
17
+ const rpcOptions = { openInEditor: async ({ project, path, line, column }) => launchEditor(`${join(project.root, path)}:${line}:${column}`, process.env.LAUNCH_EDITOR || process.env.VISUAL || process.env.EDITOR || void 0) };
18
+ //#endregion
19
+ export { rpcOptions as n, loadProjects as t };
@@ -0,0 +1,7 @@
1
+ import { t as X18nDevtoolsOptions } from "./load-BCdWXZqo.mjs";
2
+ import { PluginWithDevTools } from "@vitejs/devtools-kit";
3
+ //#region src/vite.d.ts
4
+ /** A Vite plugin that adds the x18n panel to Vite DevTools, and to Nuxt DevTools, which runs on it. */
5
+ export declare function X18nDevtools(options?: X18nDevtoolsOptions): PluginWithDevTools;
6
+ //#endregion
7
+ export type { X18nDevtoolsOptions };
package/dist/vite.mjs ADDED
@@ -0,0 +1,18 @@
1
+ import { n as rpcOptions, t as loadProjects } from "./load-BT8iVW8J.mjs";
2
+ import { createX18nDevframe } from "@x18n/ui";
3
+ import { createPluginFromDevframe } from "@vitejs/devtools-kit/node";
4
+ //#region src/vite.ts
5
+ /** A Vite plugin that adds the x18n panel to Vite DevTools, and to Nuxt DevTools, which runs on it. */
6
+ function X18nDevtools(options = {}) {
7
+ let projects = [];
8
+ const definition = createX18nDevframe(async (ctx) => projects = await loadProjects(ctx, options), rpcOptions);
9
+ return {
10
+ ...createPluginFromDevframe(definition, { name: "x18n:devtools" }),
11
+ closeBundle() {
12
+ projects.forEach((p) => p.project.dispose());
13
+ projects = [];
14
+ }
15
+ };
16
+ }
17
+ //#endregion
18
+ export { X18nDevtools };
package/package.json CHANGED
@@ -1,6 +1,49 @@
1
1
  {
2
2
  "name": "@x18n/devtools",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "type": "module",
4
+ "version": "0.0.12",
5
+ "description": "x18n UI inside Vite DevTools, Nuxt DevTools and devframe hubs",
6
+ "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
+ "license": "MIT",
8
+ "homepage": "https://github.com/x18n-dev/x18n#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/x18n-dev/x18n.git",
12
+ "directory": "packages/devtools"
13
+ },
14
+ "bugs": "https://github.com/x18n-dev/x18n/issues",
15
+ "keywords": [
16
+ "i18n",
17
+ "devtools",
18
+ "devframe",
19
+ "vite"
20
+ ],
21
+ "sideEffects": false,
22
+ "exports": {
23
+ "./devframe": "./dist/devframe.mjs",
24
+ "./vite": "./dist/vite.mjs",
25
+ "./package.json": "./package.json"
26
+ },
27
+ "files": [
28
+ "dist"
29
+ ],
30
+ "engines": {
31
+ "node": ">=22"
32
+ },
33
+ "scripts": {
34
+ "build": "tsdown",
35
+ "dev": "tsdown --watch",
36
+ "typecheck": "tsc --noEmit",
37
+ "prepack": "pnpm build"
38
+ },
39
+ "dependencies": {
40
+ "@vitejs/devtools-kit": "catalog:deps",
41
+ "@x18n/node": "workspace:*",
42
+ "@x18n/ui": "workspace:*",
43
+ "devframe": "catalog:deps"
44
+ },
45
+ "devDependencies": {
46
+ "@vitejs/devtools": "catalog:testing",
47
+ "vite": "catalog:cli"
48
+ }
49
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.