@fluxwp/plugin-kit 0.0.0-stage → 0.1.1
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/README.md +163 -2
- package/dist/codegen.js +264 -0
- package/dist/flx-kit.js +476 -0
- package/dist/modules.js +19 -0
- package/dist/vite.js +152 -0
- package/package.json +80 -4
- package/runtime-exports.json +316 -0
- package/src/codegen.ts +117 -0
- package/src/css.d.ts +1 -0
- package/src/modules.ts +23 -0
- package/src/vite.ts +150 -0
- package/types/codegen.d.ts +18 -0
- package/types/modules.d.ts +8 -0
- package/types/vite.d.ts +12 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface CodegenOptions {
|
|
2
|
+
/** Plugin folder (its slug is the folder name). */
|
|
3
|
+
plugin: string;
|
|
4
|
+
/** Folder for types.ts and operations.ts (default <plugin>/screens/generated). */
|
|
5
|
+
out?: string;
|
|
6
|
+
/** FluxWP schema (default: @fluxwp/graphql's schema/full.graphql). */
|
|
7
|
+
schema?: string;
|
|
8
|
+
/** Write nothing; return the manifest paths that are out of date. */
|
|
9
|
+
check?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface CodegenResult {
|
|
12
|
+
operations: number;
|
|
13
|
+
written: string[];
|
|
14
|
+
stale: string[];
|
|
15
|
+
}
|
|
16
|
+
/** The FluxWP schema a plugin compiles against: an explicit file, else the one @fluxwp/graphql ships. */
|
|
17
|
+
export declare function defaultSchemaPath(from: string): string;
|
|
18
|
+
export declare function codegen(o: CodegenOptions): Promise<CodegenResult>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module specifiers the shared runtime (Flux GraphQL) provides to plugin bundles. Same list and order as
|
|
3
|
+
* `modules` in apps/wp-embed/src/runtime.tsx (scripts/runtime-exports.ts checks it). A plugin imports these
|
|
4
|
+
* and only these from React, React Query, i18next and the open @fluxwp packages; `@fluxwp/host` is
|
|
5
|
+
* useHost / useModuleApi / ModuleHost.
|
|
6
|
+
*/
|
|
7
|
+
export declare const RUNTIME_MODULES: readonly ["react", "react/jsx-runtime", "react-dom", "react-dom/client", "@tanstack/react-query", "i18next", "react-i18next", "@fluxwp/core", "@fluxwp/tokens", "@fluxwp/ui", "@fluxwp/graphql", "@fluxwp/graphql/react", "@fluxwp/host"];
|
|
8
|
+
export type RuntimeModule = (typeof RUNTIME_MODULES)[number];
|
package/types/vite.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type UserConfig } from 'vite';
|
|
2
|
+
/** Runtime API the bundle needs (apps/wp-embed/src/runtime.tsx RUNTIME_API). */
|
|
3
|
+
export declare const RUNTIME_API = 1;
|
|
4
|
+
export interface FluxScreensOptions {
|
|
5
|
+
/** Module exporting `screens` (and optionally `resources`). Relative to the Vite root. */
|
|
6
|
+
entry: string;
|
|
7
|
+
/** Where the bundle goes: the plugin's assets/flux/ folder. Emptied of old flux-screens* files. */
|
|
8
|
+
outDir: string;
|
|
9
|
+
/** Extra Vite config merged over the preset. */
|
|
10
|
+
vite?: UserConfig;
|
|
11
|
+
}
|
|
12
|
+
export declare function fluxScreens(o: FluxScreensOptions): UserConfig;
|