]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
ci: fix build
authorEduardo San Martin Morote <posva13@gmail.com>
Sat, 23 Nov 2019 12:50:38 +0000 (13:50 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Sat, 23 Nov 2019 12:50:38 +0000 (13:50 +0100)
rollup.config.js
src/index.ts
src/useStore.ts [deleted file]

index 58da42fac82bff72a2402798b13094b00860bbf8..db0b321a2dcb0634f7b0bac2cbed31231484117a 100644 (file)
@@ -22,21 +22,14 @@ const banner = `/*!
 
 const exportName = pascalcase(pkg.name)
 
-function createEntry(
-  {
-    format, // Rollup format (iife, umd, cjs, es)
-    external, // Rollup external option
-    input = 'src/index.ts', // entry point
-    env = 'development', // NODE_ENV variable
-    minify = false,
-    isBrowser = false, // produce a browser module version or not
-  } = {
-    input: 'src/index.ts',
-    env: 'development',
-    minify: false,
-    isBrowser: false,
-  }
-) {
+function createEntry({
+  format, // Rollup format (iife, umd, cjs, es)
+  external = ['vue', '@vue/composition-api'],
+  input = 'src/index.ts', // entry point
+  env = 'development', // NODE_ENV variable
+  minify = false,
+  isBrowser = false, // produce a browser module version or not
+}) {
   // force production mode when minifying
   if (minify) env = 'production'
 
@@ -72,6 +65,9 @@ function createEntry(
     config.plugins.push(resolve(), commonjs())
   } else {
     config.external = external
+    config.globals = {
+      '@vue/composition-api': 'VueCompositionApi',
+    }
   }
 
   config.plugins.push(
index 27babaf124a6dc3655290d7982f9bd18ef65f93d..63844cf3c0e8759a73f60f85b59f5aa196439aac 100644 (file)
@@ -109,27 +109,39 @@ export function createStore<Id extends string, S extends StateTree>(
   return store
 }
 
-function makeStore<Id extends string, S extends StateTree>(
-  id: Id,
-  buildState: () => S
-) {
-  let store: Store<Id, S> | undefined
+/**
+ * The api needs more work we must be able to use the store easily in any
+ * function by calling `useStore` to get the store Instance and we also need to
+ * be able to reset the store instance between requests on the server
+ */
+
+/**
+ *
+ * @param id id of the store we are creating
+ * @param buildState function that returns a state
+ */
 
-  function useStore(): Store<Id, S> {
-    if (!store) store = createStore(id, buildState)
+// function makeStore<Id extends string, S extends StateTree>(
+//   id: Id,
+//   buildState: () => S
+// ) {
+//   let store: Store<Id, S> | undefined
 
-    return store
-  }
+//   function useStore(): Store<Id, S> {
+//     if (!store) store = createStore(id, buildState)
 
-  function clear(): void {
-    store = undefined
-  }
+//     return store
+//   }
 
-  return {
-    useStore,
-    clear,
-  }
-}
+//   function clear(): void {
+//     store = undefined
+//   }
+
+//   return {
+//     useStore,
+//     clear,
+//   }
+// }
 
 // export const store = createStore('main', initialState)
 // export const cartStore = createStore('cart', {
diff --git a/src/useStore.ts b/src/useStore.ts
deleted file mode 100644 (file)
index e69de29..0000000