Skip to content

Commit

Permalink
feat: only install polyfill if there is no native support (#447)
Browse files Browse the repository at this point in the history
* feat: only install polyfill if there is no native support

* Modified gitignore to ignore vitepress cache and dist
  • Loading branch information
pastc authored Sep 2, 2024
1 parent a5dbaa2 commit 2bd4763
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
# Icon must end with two \r
Icon

# VitePress
.vitepress/cache
.vitepress/dist

# Thumbnails
._*
Expand Down
2 changes: 1 addition & 1 deletion src/components/QrcodeCapture.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
</template>

<script setup lang="ts">
import { type BarcodeFormat } from 'barcode-detector'
import { type PropType } from 'vue'
import { processFile } from '../misc/scanner'
import { type BarcodeFormat } from 'barcode-detector/pure'
const props = defineProps({
formats: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/QrcodeDropZone.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
</template>

<script setup lang="ts">
import { type BarcodeFormat } from 'barcode-detector'
import { type PropType } from 'vue'
import { processFile, processUrl } from '../misc/scanner'
import { type BarcodeFormat } from 'barcode-detector/pure'
const props = defineProps({
formats: {
Expand Down
12 changes: 6 additions & 6 deletions src/components/QrcodeStream.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@
</template>

<script setup lang="ts">
import type { DetectedBarcode, BarcodeFormat } from 'barcode-detector/pure'
import type { BarcodeFormat, DetectedBarcode } from 'barcode-detector'
import {
onUnmounted,
computed,
onMounted,
onUnmounted,
ref,
watch,
type PropType,
type CSSProperties
type CSSProperties,
type PropType
} from 'vue'
import { keepScanning, setScanningFormats } from '../misc/scanner'
import * as cameraController from '../misc/camera'
import type { Point } from '../types/types'
import { keepScanning, setScanningFormats } from '../misc/scanner'
import { assert } from '../misc/util'
import type { Point } from '../types/types'
const props = defineProps({
// in this file: don't use `props.constraints` directly. Use `constraintsCached`.
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { App, Plugin } from 'vue'

import QrcodeStream from './components/QrcodeStream.vue'
import QrcodeCapture from './components/QrcodeCapture.vue'
import QrcodeDropZone from './components/QrcodeDropZone.vue'
import QrcodeStream from './components/QrcodeStream.vue'

// Install the components
export function install(app: App) {
Expand All @@ -12,10 +12,10 @@ export function install(app: App) {
}

// Expose the components
export { QrcodeStream, QrcodeCapture, QrcodeDropZone }
export { QrcodeCapture, QrcodeDropZone, QrcodeStream }

// Expose some exports from "barcode-detector"
export { setZXingModuleOverrides, type BarcodeFormat } from 'barcode-detector/pure'
export { setZXingModuleOverrides, type BarcodeFormat } from 'barcode-detector'

// Plugin definition
const plugin: Plugin = { install }
Expand Down
2 changes: 1 addition & 1 deletion src/misc/scanner.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type DetectedBarcode, type BarcodeFormat, BarcodeDetector } from 'barcode-detector/pure'
import { type BarcodeFormat, type DetectedBarcode, BarcodeDetector } from 'barcode-detector'
import { eventOn } from './callforth'
import { DropImageFetchError } from './errors'

Expand Down

0 comments on commit 2bd4763

Please sign in to comment.