@vnejs/shared 0.0.9 → 0.0.11

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.
@@ -0,0 +1,6 @@
1
+ export type { VneNamespace, VnePluginConstants, VnePluginConstantsMap, VnePluginEvents, VnePluginEventsMap, VnePluginParams, VnePluginParamsMap, VnePluginSettings, VnePluginSettingsMap, VnePluginShape, } from "./types.js";
2
+ import type { VneNamespace, VnePluginShape, VneRegistry } from "./types.js";
3
+ export declare const VNE_MODULES: unknown[];
4
+ export declare const VNE: VneRegistry;
5
+ export declare const regModule: (Module: unknown) => unknown;
6
+ export declare const regPlugin: (namespace?: VneNamespace, { constants, events, settings, params }?: VnePluginShape, modules?: unknown[]) => void;
@@ -1,16 +1,12 @@
1
1
  export const VNE_MODULES = [];
2
-
3
2
  export const VNE = { CONST: {}, EVENTS: {}, SETTINGS: {}, PARAMS: {} };
4
-
5
3
  export const regModule = (Module) => Module && VNE_MODULES.push(Module);
6
-
7
4
  export const regPlugin = (namespace = "", { constants = {}, events = {}, settings = {}, params = {} } = {}, modules = []) => {
8
- if (!namespace) return;
9
-
10
- VNE.EVENTS[namespace] = events;
11
- VNE.PARAMS[namespace] = params;
12
- VNE.CONST[namespace] = constants;
13
- VNE.SETTINGS[namespace] = settings;
14
-
15
- modules.forEach(regModule);
5
+ if (!namespace)
6
+ return;
7
+ VNE.EVENTS[namespace] = events;
8
+ VNE.PARAMS[namespace] = params;
9
+ VNE.CONST[namespace] = constants;
10
+ VNE.SETTINGS[namespace] = settings;
11
+ modules.forEach(regModule);
16
12
  };
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Extend in consumer packages via module augmentation:
3
+ *
4
+ * @example
5
+ * declare module "@vnejs/shared" {
6
+ * interface VnePluginEventsMap {
7
+ * SCENARIO: typeof SUBSCRIBE_EVENTS;
8
+ * }
9
+ * interface VnePluginConstantsMap {
10
+ * SCENARIO: typeof constants;
11
+ * }
12
+ * }
13
+ */
14
+ export interface VnePluginConstantsMap {
15
+ }
16
+ export interface VnePluginEventsMap {
17
+ }
18
+ export interface VnePluginSettingsMap {
19
+ }
20
+ export interface VnePluginParamsMap {
21
+ }
22
+ /** Fallback shape for namespaces not listed in *Map interfaces. */
23
+ export interface VnePluginConstants {
24
+ }
25
+ export interface VnePluginEvents {
26
+ }
27
+ export interface VnePluginSettings {
28
+ }
29
+ export interface VnePluginParams {
30
+ }
31
+ export type VneNamespace = keyof VnePluginConstantsMap | keyof VnePluginEventsMap | keyof VnePluginSettingsMap | keyof VnePluginParamsMap | (string & {});
32
+ export type VneRegistry = {
33
+ CONST: VnePluginConstantsMap & Record<VneNamespace, VnePluginConstants>;
34
+ EVENTS: VnePluginEventsMap & Record<VneNamespace, VnePluginEvents>;
35
+ SETTINGS: VnePluginSettingsMap & Record<VneNamespace, VnePluginSettings>;
36
+ PARAMS: VnePluginParamsMap & Record<VneNamespace, VnePluginParams>;
37
+ };
38
+ export interface VnePluginShape {
39
+ constants?: VnePluginConstants;
40
+ events?: VnePluginEvents;
41
+ settings?: VnePluginSettings;
42
+ params?: VnePluginParams;
43
+ }
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,15 +1,22 @@
1
1
  {
2
2
  "name": "@vnejs/shared",
3
- "version": "0.0.9",
4
- "main": "index.js",
3
+ "version": "0.0.11",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
5
10
  "scripts": {
6
11
  "test": "echo \"Error: no test specified\" && exit 1",
7
- "build": "tsc ./index.ts",
8
- "publish:major": "npm version major && npm publish --access public --legacy-peer-deps",
9
- "publish:minor": "npm version minor && npm publish --access public --legacy-peer-deps",
10
- "publish:patch": "npm version patch && npm publish --access public --legacy-peer-deps"
12
+ "build": "tsc -p tsconfig.json",
13
+ "publish:major": "npm run build && npm version major && npm publish --access public",
14
+ "publish:minor": "npm run build && npm version minor && npm publish --access public",
15
+ "publish:patch": "npm run build && npm version patch && npm publish --access public"
11
16
  },
12
17
  "author": "",
13
18
  "license": "ISC",
14
- "description": ""
19
+ "devDependencies": {
20
+ "typescript": "^6.0.3"
21
+ }
15
22
  }
package/index.d.ts DELETED
@@ -1,12 +0,0 @@
1
- declare interface CONST {}
2
- declare interface EVENTS {}
3
- declare interface PARAMS {}
4
- declare interface SETTINGS {}
5
- declare interface MODULE_EXTENSIONS {}
6
-
7
- export const VNE: {
8
- CONST: CONST;
9
- EVENTS: EVENTS;
10
- PARAMS: PARAMS;
11
- SETTINGS: SETTINGS;
12
- };