Support for TypeScript Modules

This commit is contained in:
Jarek Rozanski 2023-05-16 20:01:42 +00:00
parent 21bd300632
commit 6193324e89
5 changed files with 63 additions and 5 deletions

View file

@ -1,12 +1,12 @@
import { initWideAngle } from "./src"; import { initWideAngle } from "./dist";
import { ref } from 'vue'; import { ref } from 'vue';
export default { export default {
install: async (app, options) => { install: async (app, options) => {
const waaRef = ref() const waaRef = ref()
app.provide('waa', waaRef); app.provide('waa', waaRef);
initWideAngle(options) initWideAngle(options)
.then(waa => { .then(waa => {
waaRef.value = waa; waaRef.value = waa;
console.debug("[WAA] Wide Angle Analytics instance available"); console.debug("[WAA] Wide Angle Analytics instance available");
}) })

37
package-lock.json generated Normal file
View file

@ -0,0 +1,37 @@
{
"name": "wideangle-vuejs",
"version": "0.0.3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "wideangle-vuejs",
"version": "0.0.3",
"license": "Apache-2.0",
"devDependencies": {
"typescript": "^5.0.4"
}
},
"node_modules/typescript": {
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz",
"integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==",
"dev": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=12.20"
}
}
},
"dependencies": {
"typescript": {
"version": "5.0.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz",
"integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==",
"dev": true
}
}
}

View file

@ -6,6 +6,10 @@
"repository": "github:inputobjects/wideangle-vuejs", "repository": "github:inputobjects/wideangle-vuejs",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"build": "tsc -p tsconfig.json",
"clear": "rimraf dist",
"rebuild": "npm run clear && npm run build",
"prepublishOnly": "npm run rebuild"
}, },
"keywords": [ "keywords": [
"wide angle analytics", "wide angle analytics",
@ -16,5 +20,8 @@
"vuejs plugin" "vuejs plugin"
], ],
"author": "Wide Angle Analytics <developers@wideangle.co>", "author": "Wide Angle Analytics <developers@wideangle.co>",
"license": "Apache-2.0" "license": "Apache-2.0",
"devDependencies": {
"typescript": "^5.0.4"
}
} }

View file

@ -3,7 +3,7 @@
"version": "0.0.0", "version": "0.0.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "vite", "dev": "vite --host 0.0.0.0",
"build": "vite build", "build": "vite build",
"preview": "vite preview" "preview": "vite preview"
}, },

14
tsconfig.json Normal file
View file

@ -0,0 +1,14 @@
{
"include": ["src/**/*"],
"compilerOptions": {
"target": "es2016",
// "module": "commonjs",
"declaration": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"allowJs": true,
"outDir": "dist",
"skipLibCheck": true
}
}