@weaverse/core 0.2.4 → 0.3.2

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 CHANGED
@@ -1,115 +0,0 @@
1
- # TSDX User Guide
2
-
3
- Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with
4
- what’s here and how to use it.
5
-
6
- > This TSDX setup is meant for developing libraries (not apps!) that can be published to NPM. If you’re looking to build a Node app, you could use `ts-node-dev`, plain `ts-node`, or simple `tsc`.
7
-
8
- > If you’re new to TypeScript, checkout [this handy cheatsheet](https://devhints.io/typescript)
9
-
10
- ## Commands
11
-
12
- TSDX scaffolds your new library inside `/src`.
13
-
14
- To run TSDX, use:
15
-
16
- ```bash
17
- npm start # or yarn start
18
- ```
19
-
20
- This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`
21
- .
22
-
23
- To do a one-off build, use `npm run build` or `yarn build`.
24
-
25
- To run tests, use `npm test` or `yarn test`.
26
-
27
- ## Configuration
28
-
29
- Code quality is set up for you with `prettier`, `husky`, and `lint-staged`. Adjust the respective fields
30
- in `package.json` accordingly.
31
-
32
- ### Jest
33
-
34
- Jest tests are set up to run with `npm test` or `yarn test`.
35
-
36
- ### Bundle Analysis
37
-
38
- [`size-limit`](https://github.com/ai/size-limit) is set up to calculate the real cost of your library
39
- with `npm run size` and visualize the bundle with `npm run analyze`.
40
-
41
- #### Setup Files
42
-
43
- This is the folder structure we set up for you:
44
-
45
- ```txt
46
- /src
47
- index.tsx # EDIT THIS
48
- /test
49
- blah.test.tsx # EDIT THIS
50
- .gitignore
51
- package.json
52
- README.md # EDIT THIS
53
- tsconfig.json
54
- ```
55
-
56
- ### Rollup
57
-
58
- TSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats
59
- and build settings. See [Optimizations](#optimizations) for details.
60
-
61
- ### TypeScript
62
-
63
- `tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your
64
- needs.
65
-
66
- ## Continuous Integration
67
-
68
- ### GitHub Actions
69
-
70
- Two actions are added by default:
71
-
72
- - `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
73
- - `size` which comments cost comparison of your library on every pull request
74
- using [`size-limit`](https://github.com/ai/size-limit)
75
-
76
- ## Optimizations
77
-
78
- Please see the main `tsdx` [optimizations docs](https://github.com/palmerhq/tsdx#optimizations). In particular, know
79
- that you can take advantage of development-only optimizations:
80
-
81
- ```js
82
- // ./types/index.d.ts
83
- declare var __DEV__: boolean;
84
-
85
- // inside your code...
86
- if (__DEV__) {
87
- console.log('foo');
88
- }
89
- ```
90
-
91
- You can also choose to install and use [invariant](https://github.com/palmerhq/tsdx#invariant)
92
- and [warning](https://github.com/palmerhq/tsdx#warning) functions.
93
-
94
- ## Module Formats
95
-
96
- CJS, ESModules, and UMD module formats are supported.
97
-
98
- The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are
99
- found.
100
-
101
- ## Named Exports
102
-
103
- Per Palmer Group guidelines, [always use named exports.](https://github.com/palmerhq/typescript#exports) Code split
104
- inside your React app instead of your React library.
105
-
106
- ## Including Styles
107
-
108
- There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.
109
-
110
- For vanilla CSS, you can include it at the root directory and add it to the `files` section in your `package.json`, so
111
- that it can be imported separately by your users and run through their bundler's loader.
112
-
113
- ## Publishing to NPM
114
-
115
- We recommend using [np](https://github.com/sindresorhus/np).
package/dist/index.d.ts CHANGED
@@ -1,3 +1,131 @@
1
- import { ProjectDataItemType, ProjectDataType, Weaverse, WeaverseItemStore, WeaverseType } from './core';
2
- import { isBrowser, isIframe, isReactNative } from './utils';
3
- export { Weaverse, WeaverseType, WeaverseItemStore, ProjectDataType, ProjectDataItemType, isBrowser, isReactNative, isIframe };
1
+ import Stitches from '@stitches/core/types/stitches';
2
+
3
+ interface ProjectDataItemType {
4
+ type: string;
5
+ name?: string;
6
+ id: string | number;
7
+ description?: string;
8
+ childIds?: Array<string | number>;
9
+ css?: {
10
+ [key: string]: string;
11
+ };
12
+ }
13
+ interface ProjectDataType {
14
+ items: ProjectDataItemType[];
15
+ rootId: string | number;
16
+ }
17
+ declare type WeaverseType = {
18
+ [key: string]: any;
19
+ appUrl?: string;
20
+ projectKey?: string;
21
+ projectData?: ProjectDataType;
22
+ };
23
+ declare class Weaverse {
24
+ /**
25
+ * For storing, registering element React component from Weaverse or created by user/developer
26
+ * @type {Map<string, React.Component>}
27
+ */
28
+ elementInstances: Map<string, any>;
29
+ /**
30
+ * list of element/items store to provide data, handle state update, state sharing, etc.
31
+ * @type {Map<string, any>}
32
+ */
33
+ itemInstances: Map<string | number, WeaverseItemStore>;
34
+ /**
35
+ * Weaverse base URL that can provide by user/developer. for local development, use localhost:3000
36
+ * @type {string}
37
+ */
38
+ appUrl: string;
39
+ /**
40
+ * Weaverse project key to access project data via API
41
+ * @type {string}
42
+ */
43
+ projectKey: string;
44
+ /**
45
+ * Weaverse project data, by default, user can provide project data via React Component:
46
+ * <WeaverseRoot defaultData={projectData} /> it will be used to server-side rendering
47
+ */
48
+ projectData: ProjectDataType;
49
+ /**
50
+ * storing subscribe callback function for any component that want to listen to the change of WeaverseRoot
51
+ * @type {Map<string, (data: any) => void>}
52
+ */
53
+ listeners: Set<any>;
54
+ /**
55
+ * check whether the sdk is inEditor or not
56
+ * if isEditor is true, it means the sdk is inEditor mode, render the editor UI
57
+ * else render the preview UI, plain HTML + CSS + React hydrate
58
+ * @type {boolean}
59
+ */
60
+ isEditor: boolean;
61
+ /**
62
+ * stitches instance for handling CSS stylesheet, media, theme for Weaverse project
63
+ */
64
+ stitchesInstance: Stitches | any;
65
+ studioBridge?: any;
66
+ /**
67
+ * constructor
68
+ * @param appUrl {string} Weaverse base URL that can provide by user/developer. for local development, use localhost:3000
69
+ * @param projectKey {string} Weaverse project key to access project data via API
70
+ * @param projectData {ProjectDataType} Weaverse project data, by default, user can provide project data via React Component.
71
+ */
72
+ constructor({ appUrl, projectKey, projectData }?: WeaverseType);
73
+ /**
74
+ * register the custom React Component to Weaverse, store it into Weaverse.elementInstances
75
+ * @param name {string} unique name of the custom React Component
76
+ * @param element {React.Component} custom React Component
77
+ */
78
+ registerElement(name: string, element: any): void;
79
+ init(): void;
80
+ listen(callback: any): void;
81
+ loadStudio(): void;
82
+ subscribe(fn: any): void;
83
+ unsubscribe(fn: any): void;
84
+ triggerUpdate(): void;
85
+ /**
86
+ * fetch data from Weaverse API (https://weaverse.io/api/v1/projects/:projectKey)
87
+ * @param fetch {fetch} custom fetch function, pass in custom fetch function if you want to use your own fetch function
88
+ */
89
+ fetchProjectData(fetch?: typeof globalThis.fetch): Promise<any>;
90
+ /**
91
+ * fetch and update the project data, then trigger update to re-render the WeaverseRoot
92
+ */
93
+ updateProjectData(): void;
94
+ triggerEditorUpdate(type?: string): void;
95
+ initProjectItemData(): void;
96
+ addItem(item: any): WeaverseItemStore;
97
+ }
98
+ /**
99
+ * WeaverseItemStore is a store for Weaverse item, it can be used to subscribe/update the item data
100
+ * @param itemData {ProjectDataItemType} Weaverse item data
101
+ * @param weaverse {Weaverse} Weaverse instance
102
+ * Usage:
103
+ * ```jsx
104
+ * useEffect(() => {
105
+ * let handleUpdate = (update: any) => {
106
+ * setData({...update})
107
+ * }
108
+ * itemInstance.subscribe(handleUpdate)
109
+ * return () => {
110
+ * itemInstance.unsubscribe(handleUpdate)
111
+ * }
112
+ * }, [])
113
+ * ```
114
+ */
115
+ declare class WeaverseItemStore {
116
+ data: any;
117
+ listeners: Set<any>;
118
+ Component: any;
119
+ ref: any;
120
+ constructor(itemData: any, weaverse: Weaverse);
121
+ setData: (data: any) => void;
122
+ subscribe: (fn: any) => void;
123
+ unsubscribe: (fn: any) => void;
124
+ triggerUpdate: () => void;
125
+ }
126
+
127
+ declare const isReactNative: boolean;
128
+ declare const isBrowser: boolean;
129
+ declare const isIframe: boolean;
130
+
131
+ export { ProjectDataItemType, ProjectDataType, Weaverse, WeaverseItemStore, WeaverseType, isBrowser, isIframe, isReactNative };
package/dist/index.js CHANGED
@@ -1,8 +1,201 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
1
28
 
2
- 'use strict'
29
+ // src/index.ts
30
+ var src_exports = {};
31
+ __export(src_exports, {
32
+ Weaverse: () => Weaverse,
33
+ WeaverseItemStore: () => WeaverseItemStore,
34
+ isBrowser: () => isBrowser,
35
+ isIframe: () => isIframe,
36
+ isReactNative: () => isReactNative
37
+ });
3
38
 
4
- if (process.env.NODE_ENV === 'production') {
5
- module.exports = require('./core.cjs.production.min.js')
6
- } else {
7
- module.exports = require('./core.cjs.development.js')
8
- }
39
+ // src/utils/index.ts
40
+ var isReactNative = typeof navigator === "object" && navigator.product === "ReactNative";
41
+ var isBrowser = typeof window !== "undefined" && !isReactNative;
42
+ var isIframe = isBrowser && window.top !== window.self;
43
+
44
+ // src/core.ts
45
+ var stitches = __toESM(require("@stitches/core"));
46
+ var Weaverse = class {
47
+ constructor({ appUrl, projectKey, projectData } = {}) {
48
+ this.elementInstances = /* @__PURE__ */ new Map();
49
+ this.itemInstances = /* @__PURE__ */ new Map();
50
+ this.appUrl = process.env.NODE_ENV === "development" ? "http://localhost:3000" : "https://weaverse.io";
51
+ this.projectKey = "";
52
+ this.projectData = {
53
+ items: [],
54
+ rootId: 0
55
+ };
56
+ this.listeners = /* @__PURE__ */ new Set();
57
+ this.isEditor = false;
58
+ this.appUrl = appUrl || this.appUrl;
59
+ this.projectKey = projectKey || this.projectKey;
60
+ projectData && (this.projectData = projectData);
61
+ this.init();
62
+ }
63
+ registerElement(name, element) {
64
+ this.elementInstances.set(name, element);
65
+ }
66
+ init() {
67
+ this.stitchesInstance = stitches.createStitches({
68
+ prefix: "weaverse",
69
+ media: {
70
+ bp1: "(min-width: 640px)",
71
+ bp2: "(max-width: 768px)",
72
+ bp3: "(min-width: 1024px)"
73
+ }
74
+ });
75
+ this.loadStudio();
76
+ }
77
+ listen(callback) {
78
+ if (window.addEventListener) {
79
+ window.addEventListener("message", callback, false);
80
+ } else {
81
+ window.attachEvent("onmessage", callback);
82
+ }
83
+ }
84
+ loadStudio() {
85
+ if (isIframe) {
86
+ console.log("Weaverse SDK is initializing...", isIframe);
87
+ let initStudio = () => {
88
+ let StudioBridge = window.WeaverseStudioBridge;
89
+ this.studioBridge = new StudioBridge(this);
90
+ this.studioBridge.subscribeMessageEvent();
91
+ this.triggerUpdate();
92
+ console.log("studio bridge initialized", this.studioBridge);
93
+ };
94
+ window.addEventListener("load", () => {
95
+ window.addEventListener("message", (e) => {
96
+ var _a;
97
+ if (((_a = e.data) == null ? void 0 : _a.type) === "weaverse.editor.ready") {
98
+ console.log("studio message", e.data);
99
+ this.isEditor = true;
100
+ if (!window.WeaverseStudioBridge) {
101
+ const studioBridgeScript = document.createElement("script");
102
+ studioBridgeScript.src = `${this.appUrl}/assets/studio/studio-bridge.js?t=1`;
103
+ studioBridgeScript.onload = initStudio;
104
+ document.body.appendChild(studioBridgeScript);
105
+ } else {
106
+ initStudio();
107
+ }
108
+ }
109
+ });
110
+ });
111
+ }
112
+ }
113
+ subscribe(fn) {
114
+ this.listeners.add(fn);
115
+ }
116
+ unsubscribe(fn) {
117
+ this.listeners.delete(fn);
118
+ }
119
+ triggerUpdate() {
120
+ this.listeners.forEach((fn) => fn());
121
+ this.triggerEditorUpdate();
122
+ }
123
+ fetchProjectData(fetch = globalThis.fetch) {
124
+ console.log("fetching project data...");
125
+ return fetch(this.appUrl + `/api/public/${this.projectKey}`).then((r) => r.json()).catch(console.error);
126
+ }
127
+ updateProjectData() {
128
+ if (this.projectKey) {
129
+ this.fetchProjectData().then((data) => {
130
+ if (data) {
131
+ this.projectData = data;
132
+ this.initProjectItemData();
133
+ this.triggerUpdate();
134
+ }
135
+ }).catch((err) => {
136
+ console.error(err);
137
+ });
138
+ }
139
+ }
140
+ triggerEditorUpdate(type = "weaverse.workspace.init") {
141
+ if (this.isEditor && this.studioBridge) {
142
+ this.studioBridge.sendMessageToEditor(type, {
143
+ projectData: this.projectData,
144
+ projectKey: this.projectKey,
145
+ appUrl: this.appUrl
146
+ });
147
+ }
148
+ }
149
+ initProjectItemData() {
150
+ let data = this.projectData;
151
+ if (data.items) {
152
+ data.items.forEach((item) => {
153
+ let itemStore = this.itemInstances.get(item.id) || new WeaverseItemStore(item, this);
154
+ this.itemInstances.set(item.id, itemStore);
155
+ });
156
+ }
157
+ }
158
+ addItem(item) {
159
+ let itemStore = new WeaverseItemStore(item, this);
160
+ this.itemInstances.set(item.id, itemStore);
161
+ return itemStore;
162
+ }
163
+ };
164
+ var WeaverseItemStore = class {
165
+ constructor(itemData = {}, weaverse) {
166
+ this.data = {};
167
+ this.listeners = /* @__PURE__ */ new Set();
168
+ this.ref = {
169
+ current: null
170
+ };
171
+ this.setData = (data) => {
172
+ this.data = Object.assign(this.data, data);
173
+ this.triggerUpdate();
174
+ };
175
+ this.subscribe = (fn) => {
176
+ this.listeners.add(fn);
177
+ };
178
+ this.unsubscribe = (fn) => {
179
+ this.listeners.delete(fn);
180
+ };
181
+ this.triggerUpdate = () => {
182
+ this.listeners.forEach((fn) => {
183
+ return fn(this.data);
184
+ });
185
+ };
186
+ this.data = itemData;
187
+ let { type, id } = itemData;
188
+ if (type && id) {
189
+ this.Component = weaverse.elementInstances.get(type);
190
+ }
191
+ }
192
+ };
193
+ module.exports = __toCommonJS(src_exports);
194
+ // Annotate the CommonJS export names for ESM import in node:
195
+ 0 && (module.exports = {
196
+ Weaverse,
197
+ WeaverseItemStore,
198
+ isBrowser,
199
+ isIframe,
200
+ isReactNative
201
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,161 @@
1
+ // src/utils/index.ts
2
+ var isReactNative = typeof navigator === "object" && navigator.product === "ReactNative";
3
+ var isBrowser = typeof window !== "undefined" && !isReactNative;
4
+ var isIframe = isBrowser && window.top !== window.self;
5
+
6
+ // src/core.ts
7
+ import * as stitches from "@stitches/core";
8
+ var Weaverse = class {
9
+ constructor({ appUrl, projectKey, projectData } = {}) {
10
+ this.elementInstances = /* @__PURE__ */ new Map();
11
+ this.itemInstances = /* @__PURE__ */ new Map();
12
+ this.appUrl = process.env.NODE_ENV === "development" ? "http://localhost:3000" : "https://weaverse.io";
13
+ this.projectKey = "";
14
+ this.projectData = {
15
+ items: [],
16
+ rootId: 0
17
+ };
18
+ this.listeners = /* @__PURE__ */ new Set();
19
+ this.isEditor = false;
20
+ this.appUrl = appUrl || this.appUrl;
21
+ this.projectKey = projectKey || this.projectKey;
22
+ projectData && (this.projectData = projectData);
23
+ this.init();
24
+ }
25
+ registerElement(name, element) {
26
+ this.elementInstances.set(name, element);
27
+ }
28
+ init() {
29
+ this.stitchesInstance = stitches.createStitches({
30
+ prefix: "weaverse",
31
+ media: {
32
+ bp1: "(min-width: 640px)",
33
+ bp2: "(max-width: 768px)",
34
+ bp3: "(min-width: 1024px)"
35
+ }
36
+ });
37
+ this.loadStudio();
38
+ }
39
+ listen(callback) {
40
+ if (window.addEventListener) {
41
+ window.addEventListener("message", callback, false);
42
+ } else {
43
+ window.attachEvent("onmessage", callback);
44
+ }
45
+ }
46
+ loadStudio() {
47
+ if (isIframe) {
48
+ console.log("Weaverse SDK is initializing...", isIframe);
49
+ let initStudio = () => {
50
+ let StudioBridge = window.WeaverseStudioBridge;
51
+ this.studioBridge = new StudioBridge(this);
52
+ this.studioBridge.subscribeMessageEvent();
53
+ this.triggerUpdate();
54
+ console.log("studio bridge initialized", this.studioBridge);
55
+ };
56
+ window.addEventListener("load", () => {
57
+ window.addEventListener("message", (e) => {
58
+ var _a;
59
+ if (((_a = e.data) == null ? void 0 : _a.type) === "weaverse.editor.ready") {
60
+ console.log("studio message", e.data);
61
+ this.isEditor = true;
62
+ if (!window.WeaverseStudioBridge) {
63
+ const studioBridgeScript = document.createElement("script");
64
+ studioBridgeScript.src = `${this.appUrl}/assets/studio/studio-bridge.js?t=1`;
65
+ studioBridgeScript.onload = initStudio;
66
+ document.body.appendChild(studioBridgeScript);
67
+ } else {
68
+ initStudio();
69
+ }
70
+ }
71
+ });
72
+ });
73
+ }
74
+ }
75
+ subscribe(fn) {
76
+ this.listeners.add(fn);
77
+ }
78
+ unsubscribe(fn) {
79
+ this.listeners.delete(fn);
80
+ }
81
+ triggerUpdate() {
82
+ this.listeners.forEach((fn) => fn());
83
+ this.triggerEditorUpdate();
84
+ }
85
+ fetchProjectData(fetch = globalThis.fetch) {
86
+ console.log("fetching project data...");
87
+ return fetch(this.appUrl + `/api/public/${this.projectKey}`).then((r) => r.json()).catch(console.error);
88
+ }
89
+ updateProjectData() {
90
+ if (this.projectKey) {
91
+ this.fetchProjectData().then((data) => {
92
+ if (data) {
93
+ this.projectData = data;
94
+ this.initProjectItemData();
95
+ this.triggerUpdate();
96
+ }
97
+ }).catch((err) => {
98
+ console.error(err);
99
+ });
100
+ }
101
+ }
102
+ triggerEditorUpdate(type = "weaverse.workspace.init") {
103
+ if (this.isEditor && this.studioBridge) {
104
+ this.studioBridge.sendMessageToEditor(type, {
105
+ projectData: this.projectData,
106
+ projectKey: this.projectKey,
107
+ appUrl: this.appUrl
108
+ });
109
+ }
110
+ }
111
+ initProjectItemData() {
112
+ let data = this.projectData;
113
+ if (data.items) {
114
+ data.items.forEach((item) => {
115
+ let itemStore = this.itemInstances.get(item.id) || new WeaverseItemStore(item, this);
116
+ this.itemInstances.set(item.id, itemStore);
117
+ });
118
+ }
119
+ }
120
+ addItem(item) {
121
+ let itemStore = new WeaverseItemStore(item, this);
122
+ this.itemInstances.set(item.id, itemStore);
123
+ return itemStore;
124
+ }
125
+ };
126
+ var WeaverseItemStore = class {
127
+ constructor(itemData = {}, weaverse) {
128
+ this.data = {};
129
+ this.listeners = /* @__PURE__ */ new Set();
130
+ this.ref = {
131
+ current: null
132
+ };
133
+ this.setData = (data) => {
134
+ this.data = Object.assign(this.data, data);
135
+ this.triggerUpdate();
136
+ };
137
+ this.subscribe = (fn) => {
138
+ this.listeners.add(fn);
139
+ };
140
+ this.unsubscribe = (fn) => {
141
+ this.listeners.delete(fn);
142
+ };
143
+ this.triggerUpdate = () => {
144
+ this.listeners.forEach((fn) => {
145
+ return fn(this.data);
146
+ });
147
+ };
148
+ this.data = itemData;
149
+ let { type, id } = itemData;
150
+ if (type && id) {
151
+ this.Component = weaverse.elementInstances.get(type);
152
+ }
153
+ }
154
+ };
155
+ export {
156
+ Weaverse,
157
+ WeaverseItemStore,
158
+ isBrowser,
159
+ isIframe,
160
+ isReactNative
161
+ };
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
- "version": "0.2.4",
2
+ "version": "0.3.2",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
+ "module": "dist/index.mjs",
6
7
  "publishConfig": {
7
8
  "access": "public"
8
9
  },
@@ -13,48 +14,14 @@
13
14
  "node": ">=10"
14
15
  },
15
16
  "scripts": {
16
- "start": "tsdx watch",
17
- "dev": "tsdx watch",
18
- "build": "tsdx build",
19
- "test": "tsdx test",
20
- "lint": "tsdx lint",
21
- "prepare": "tsdx build",
22
- "size": "size-limit",
23
- "analyze": "size-limit --why"
24
- },
25
- "husky": {
26
- "hooks": {
27
- "pre-commit": "tsdx lint"
28
- }
29
- },
30
- "prettier": {
31
- "printWidth": 80,
32
- "semi": true,
33
- "singleQuote": true,
34
- "trailingComma": "es5"
17
+ "start": "npm run dev",
18
+ "dev": "tsup src/index.ts --format esm,cjs --dts --outDir dist --watch",
19
+ "build": "tsup src/index.ts --format esm,cjs --dts --outDir dist"
35
20
  },
36
21
  "name": "@weaverse/core",
37
22
  "author": "Paul",
38
- "module": "dist/core.esm.js",
39
- "size-limit": [
40
- {
41
- "path": "dist/core.cjs.production.min.js",
42
- "limit": "10 KB"
43
- },
44
- {
45
- "path": "dist/core.esm.js",
46
- "limit": "10 KB"
47
- }
48
- ],
49
23
  "dependencies": {
50
- "@stitches/core": "^1.2.6",
51
- "isomorphic-unfetch": "^3.1.0"
52
- },
53
- "devDependencies": {
54
- "@size-limit/preset-small-lib": "^7.0.8",
55
- "size-limit": "^7.0.8",
56
- "tsdx": "^0.14.1",
57
- "tslib": "^2.3.1",
58
- "typescript": "^4.5.5"
24
+ "@stitches/core": "^1.2.7",
25
+ "uuid": "^8.3.2"
59
26
  }
60
27
  }