Skip to content

Commit

Permalink
Merge pull request #41 from zernonia/use-unbuild
Browse files Browse the repository at this point in the history
chore: update bundler to unbuild
  • Loading branch information
zernonia authored May 9, 2023
2 parents 1e6b447 + 435f7f7 commit 4879d8a
Show file tree
Hide file tree
Showing 25 changed files with 1,106 additions and 1,900 deletions.
16 changes: 16 additions & 0 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { resolve } from "path";
import { defineBuildConfig } from "unbuild";

export default defineBuildConfig({
entries: [
{ builder: "mkdist", input: "./src/" },
{ builder: "mkdist", input: "./src/", format: "cjs", ext: "js" },
],

alias: {
"@": resolve(__dirname, "./src"),
},

declaration: true,
clean: true,
});
8 changes: 0 additions & 8 deletions demo/vue/src/env.d.ts

This file was deleted.

5 changes: 5 additions & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module "*.vue" {
import { DefineComponent } from "vue";
const component: DefineComponent<{}, {}, any>;
export default component;
}
14 changes: 7 additions & 7 deletions nuxt/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import VueNotion from "vue3-notion"
import { getPageBlocks, getPageTable } from "vue3-notion"
import { defineNuxtPlugin } from "#app"
import VueNotion from "vue3-notion";
import { getPageBlocks, getPageTable } from "vue3-notion";
import { defineNuxtPlugin } from "#app";

export default defineNuxtPlugin(({ vueApp }) => {
const notion = { getPageBlocks, getPageTable }
vueApp.use(VueNotion)
const notion = { getPageBlocks, getPageTable };
vueApp.use(VueNotion);
return {
provide: {
notion,
},
}
})
};
});
46 changes: 14 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"description": "Vue 3 Unofficial Notion Renderer",
"homepage": "https://vue3-notion.vercel.app/",
"repository": "github:zernonia/vue3-notion",
"main": "./dist/index.umd.js",
"module": "./dist/index.es.js",
"type": "module",
"main": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.es.js",
"require": "./dist/index.umd.js"
"import": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./nuxt": {
"require": "./nuxt/index.ts",
Expand All @@ -22,11 +22,8 @@
}
},
"files": [
"dist/**/*.ts",
"dist/**/*.js",
"dist/**/*.d.ts",
"dist/*.css",
"nuxt/*.ts"
"dist",
"nuxt"
],
"keywords": [
"vue",
Expand All @@ -37,45 +34,30 @@
],
"license": "MIT",
"scripts": {
"dev": "vite -c vite-dev.config.ts",
"dev:build": "vue-tsc --noEmit && vite build -c vite-dev.config.ts",
"build": "vue-tsc --noEmit && vite build && rollup -c",
"build:rollup": "rollup -c",
"build:types": "vue-tsc --noEmit",
"dev": "vite serve playground",
"dev:build": "vite build playground",
"build": "unbuild",
"preview": "vite preview",
"version": " git add -A src",
"postversion": "git push && git push --tags",
"deploy": "npm run build && npm version patch && npm publish"
},
"dependencies": {
"@nuxt/kit": "^3.0.0-rc.1",
"@nuxt/kit": "^3.4.3",
"@vueuse/core": "^8.7.5",
"katex": "^0.15.1",
"pathe": "^0.2.0",
"prismjs": "^1.25.0",
"vue": "^3.2.26",
"vue-router": "4"
},
"devDependencies": {
"@rollup/plugin-alias": "^3.1.8",
"@rollup/plugin-commonjs": "^21.0.2",
"@rollup/plugin-node-resolve": "^13.1.3",
"@rollup/plugin-replace": "^3.0.0",
"@types/katex": "^0.11.1",
"@types/node": "^17.0.5",
"@types/prismjs": "^1.16.6",
"@vitejs/plugin-vue": "^2.0.0",
"postcss": "^8.4.5",
"rollup": "^2.62.0",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-typescript": "^1.0.1",
"rollup-plugin-vue": "^6.0.0",
"tslib": "^2.3.1",
"typescript": "^4.4.4",
"vite": "^2.9.7",
"vite-plugin-dts": "^0.9.10",
"vue-tsc": "^0.34.11"
"@vitejs/plugin-vue": "^4.2.1",
"typescript": "^5.0.4",
"unbuild": "^1.2.1",
"vite": "^4.3.5"
},
"peerDependencies": {
"katex": "^0.15.1",
Expand Down
5 changes: 5 additions & 0 deletions playground/App.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div id="app">
<router-view :key="$route.params.id?.toString()"></router-view>
</div>
</template>
File renamed without changes
2 changes: 1 addition & 1 deletion index.html → playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
<script type="module" src="/main.ts"></script>
</body>
</html>
6 changes: 6 additions & 0 deletions playground/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { createApp } from "vue";
import App from "./App.vue";
import { router } from "./router";
import "@/style.css";

createApp(App).use(router).mount("#app");
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions playground/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"types": ["vite/client"]
}
}
9 changes: 4 additions & 5 deletions src/view/Index.vue → playground/view/Index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { NotionRenderer } from "../components"
import { useGetPageBlocks } from "../lib/composables"
import { mapPageUrl, pageLinkOptions } from "../lib/props"
import { NotionRenderer } from "@/components";
import { useGetPageBlocks } from "@/lib/composables";
import { mapPageUrl, pageLinkOptions } from "@/lib/props";
// const blockMap = ref()
Expand All @@ -13,7 +13,7 @@ import { mapPageUrl, pageLinkOptions } from "../lib/props"
// blockMap.value = await getPageBlocks("4b2dc28a5df74034a943f8c8e639066a")
// })
const { data: blockMap } = useGetPageBlocks("4b2dc28a5df74034a943f8c8e639066a")
const { data: blockMap } = useGetPageBlocks("4b2dc28a5df74034a943f8c8e639066a");
</script>

<template>
Expand All @@ -28,4 +28,3 @@ const { data: blockMap } = useGetPageBlocks("4b2dc28a5df74034a943f8c8e639066a")
/>
</div>
</template>

19 changes: 9 additions & 10 deletions src/view/Page.vue → playground/view/Page.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<script setup lang="ts">
import { NotionRenderer } from "../components"
import { getPageBlocks } from "../lib/api"
import { onMounted, ref } from "vue"
import { useRoute } from "vue-router"
import { mapPageUrl, pageLinkOptions } from "../lib/props"
import { NotionRenderer } from "@/components";
import { getPageBlocks } from "@/lib/api";
import { onMounted, ref } from "vue";
import { useRoute } from "vue-router";
import { mapPageUrl, pageLinkOptions } from "@/lib/props";
const route = useRoute()
const blockMap = ref()
const route = useRoute();
const blockMap = ref();
onMounted(async () => {
blockMap.value = await getPageBlocks(route.params.id as string)
})
blockMap.value = await getPageBlocks(route.params.id as string);
});
</script>

<template>
Expand All @@ -24,4 +24,3 @@ onMounted(async () => {
/>
</div>
</template>

13 changes: 13 additions & 0 deletions playground/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import path from "path";
import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [vue()],
resolve: {
alias: {
"@": path.resolve(__dirname, "../src"),
},
},
});
4 changes: 0 additions & 4 deletions shim/vue.d.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/App.vue

This file was deleted.

15 changes: 7 additions & 8 deletions src/components/notion-renderer.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
<script setup lang="ts">
import { defineNotionProps, useNotionBlock } from "@/lib/blockable"
import NotionBlock from "@/components/block.vue"
import { defineNotionProps, useNotionBlock } from "@/lib/blockable";
import NotionBlock from "@/components/block.vue";
import "prismjs/themes/prism.css"
import "katex/dist/katex.min.css"
import { computed } from "vue"
import "prismjs/themes/prism.css";
import "katex/dist/katex.min.css";
const props = defineProps({ ...defineNotionProps })
const props = defineProps({ ...defineNotionProps });
//@ts-ignore
const { pass, block } = useNotionBlock(props)
const { pass, block } = useNotionBlock(props);
</script>

<script lang="ts">
export default {
name: "NotionRenderer",
}
};
</script>

<template>
Expand Down
8 changes: 0 additions & 8 deletions src/env.d.ts

This file was deleted.

18 changes: 9 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { App } from "vue"
import * as components from "@/components/index"
import { App } from "vue";
import * as components from "./components";

// Default export is library as a whole, registered via Vue.use()
export default {
install: (app: App) => {
Object.entries(components).forEach(([componentName, component]) => {
app.component(componentName, component)
})
app.component(componentName, component);
});
},
}
};

// To allow individual component use, export components
// each can be registered via Vue.component()
export * from "@/components/index"
export * from "./components";

// export additional js methods
export * from "@/lib/api"
export * from "./lib/api";

// export types
export * from "@/lib/types"
export * from "./lib/types";

// export composables
export * from "@/lib/composables"
export * from "./lib/composables";
6 changes: 0 additions & 6 deletions src/main.ts

This file was deleted.

6 changes: 2 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@
"esModuleInterop": true,
"declaration": true,
"lib": ["esnext", "dom"],
"types": ["vite/client", "web-bluetooth"],
"baseUrl": ".",
"outDir": "dist",
"paths": {
"@/*": ["src/*"]
}
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.vue", "shim/*.d.ts"],
"exclude": ["src/router/index.ts", "src/lib/props.ts", "src/main.ts", "src/env.d.ts"]

"include": ["src/**/*.ts", "src/**/*.vue", "playground/**/*.ts", "playground/**/*.vue"]
}
13 changes: 0 additions & 13 deletions vite-dev.config.ts

This file was deleted.

34 changes: 0 additions & 34 deletions vite.config.ts

This file was deleted.

Loading

2 comments on commit 4879d8a

@vercel
Copy link

@vercel vercel bot commented on 4879d8a May 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 4879d8a May 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vue3-notion – ./demo/nuxt

vue3-notion.vercel.app
vue3-notion-git-master-zernonia.vercel.app
vue3-notion-zernonia.vercel.app

Please sign in to comment.