@capgo/camera-preview 6.1.4 → 6.1.6

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/dist/plugin.js CHANGED
@@ -1,15 +1,15 @@
1
1
  var capacitorApp = (function (exports, core) {
2
2
  'use strict';
3
3
 
4
- const CameraPreview = core.registerPlugin("CameraPreview", {
5
- web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CameraPreviewWeb()),
4
+ const CameraPreview = core.registerPlugin('CameraPreview', {
5
+ web: () => Promise.resolve().then(function () { return web; }).then(m => new m.CameraPreviewWeb()),
6
6
  });
7
7
 
8
8
  class CameraPreviewWeb extends core.WebPlugin {
9
9
  constructor() {
10
10
  super({
11
- name: "CameraPreview",
12
- platforms: ["web"],
11
+ name: 'CameraPreview',
12
+ platforms: ['web'],
13
13
  });
14
14
  }
15
15
  async start(options) {
@@ -21,30 +21,30 @@ var capacitorApp = (function (exports, core) {
21
21
  })
22
22
  .then((stream) => {
23
23
  // Stop any existing stream so we can request media with different constraints based on user input
24
- stream.getTracks().forEach((track) => track.stop());
24
+ stream.getTracks().forEach(track => track.stop());
25
25
  })
26
26
  .catch((error) => {
27
27
  Promise.reject(error);
28
28
  });
29
- const video = document.getElementById("video");
29
+ const video = document.getElementById('video');
30
30
  const parent = document.getElementById(options.parent);
31
31
  if (!video) {
32
- const videoElement = document.createElement("video");
33
- videoElement.id = "video";
34
- videoElement.setAttribute("class", options.className || "");
32
+ const videoElement = document.createElement('video');
33
+ videoElement.id = 'video';
34
+ videoElement.setAttribute('class', options.className || '');
35
35
  // Don't flip video feed if camera is rear facing
36
- if (options.position !== "rear") {
37
- videoElement.setAttribute("style", "-webkit-transform: scaleX(-1); transform: scaleX(-1);");
36
+ if (options.position !== 'rear') {
37
+ videoElement.setAttribute('style', '-webkit-transform: scaleX(-1); transform: scaleX(-1);');
38
38
  }
39
39
  const userAgent = navigator.userAgent.toLowerCase();
40
- const isSafari = userAgent.includes("safari") && !userAgent.includes("chrome");
40
+ const isSafari = userAgent.includes('safari') && !userAgent.includes('chrome');
41
41
  // Safari on iOS needs to have the autoplay, muted and playsinline attributes set for video.play() to be successful
42
42
  // Without these attributes videoElement.play() will throw a NotAllowedError
43
43
  // https://developer.apple.com/documentation/webkit/delivering_video_content_for_safari
44
44
  if (isSafari) {
45
- videoElement.setAttribute("autoplay", "true");
46
- videoElement.setAttribute("muted", "true");
47
- videoElement.setAttribute("playsinline", "true");
45
+ videoElement.setAttribute('autoplay', 'true');
46
+ videoElement.setAttribute('muted', 'true');
47
+ videoElement.setAttribute('playsinline', 'true');
48
48
  }
49
49
  parent.appendChild(videoElement);
50
50
  if ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia) {
@@ -54,45 +54,45 @@ var capacitorApp = (function (exports, core) {
54
54
  height: { ideal: options.height },
55
55
  },
56
56
  };
57
- if (options.position === "rear") {
58
- constraints.video.facingMode =
59
- "environment";
57
+ if (options.position === 'rear') {
58
+ constraints.video.facingMode
59
+ = 'environment';
60
60
  this.isBackCamera = true;
61
61
  }
62
62
  else {
63
63
  this.isBackCamera = false;
64
64
  }
65
+ // eslint-disable-next-line ts/no-this-alias
65
66
  const self = this;
66
- await navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {
67
- if (document.getElementById("video")) {
68
- //video.src = window.URL.createObjectURL(stream);
67
+ await navigator.mediaDevices.getUserMedia(constraints).then((stream) => {
68
+ if (document.getElementById('video')) {
69
+ // video.src = window.URL.createObjectURL(stream);
69
70
  videoElement.srcObject = stream;
70
71
  videoElement.play();
71
72
  Promise.resolve({});
72
73
  }
73
74
  else {
74
75
  self.stopStream(stream);
75
- Promise.reject({ message: "camera already stopped" });
76
+ Promise.reject(new Error('camera already stopped'));
76
77
  }
77
78
  }, (err) => {
78
- Promise.reject(err);
79
+ Promise.reject(new Error(err));
79
80
  });
80
81
  }
81
82
  }
82
83
  else {
83
- Promise.reject({ message: "camera already started" });
84
+ Promise.reject(new Error('camera already started'));
84
85
  }
85
86
  }
86
87
  stopStream(stream) {
87
88
  if (stream) {
88
89
  const tracks = stream.getTracks();
89
- for (const track of tracks) {
90
+ for (const track of tracks)
90
91
  track.stop();
91
- }
92
92
  }
93
93
  }
94
94
  async stop() {
95
- const video = document.getElementById("video");
95
+ const video = document.getElementById('video');
96
96
  if (video) {
97
97
  video.pause();
98
98
  this.stopStream(video.srcObject);
@@ -101,16 +101,16 @@ var capacitorApp = (function (exports, core) {
101
101
  }
102
102
  async capture(options) {
103
103
  return new Promise((resolve, reject) => {
104
- const video = document.getElementById("video");
104
+ const video = document.getElementById('video');
105
105
  if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {
106
- reject({ message: "camera is not running" });
106
+ reject(new Error('camera is not running'));
107
107
  return;
108
108
  }
109
109
  // video.width = video.offsetWidth;
110
110
  let base64EncodedImage;
111
111
  if (video && video.videoWidth > 0 && video.videoHeight > 0) {
112
- const canvas = document.createElement("canvas");
113
- const context = canvas.getContext("2d");
112
+ const canvas = document.createElement('canvas');
113
+ const context = canvas.getContext('2d');
114
114
  canvas.width = video.videoWidth;
115
115
  canvas.height = video.videoHeight;
116
116
  // flip horizontally back camera isn't used
@@ -119,15 +119,15 @@ var capacitorApp = (function (exports, core) {
119
119
  context.scale(-1, 1);
120
120
  }
121
121
  context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
122
- if ((options.format || "jpeg") === "jpeg") {
122
+ if ((options.format || 'jpeg') === 'jpeg') {
123
123
  base64EncodedImage = canvas
124
- .toDataURL("image/jpeg", (options.quality || 85) / 100.0)
125
- .replace("data:image/jpeg;base64,", "");
124
+ .toDataURL('image/jpeg', (options.quality || 85) / 100.0)
125
+ .replace('data:image/jpeg;base64,', '');
126
126
  }
127
127
  else {
128
128
  base64EncodedImage = canvas
129
- .toDataURL("image/png")
130
- .replace("data:image/png;base64,", "");
129
+ .toDataURL('image/png')
130
+ .replace('data:image/png;base64,', '');
131
131
  }
132
132
  }
133
133
  resolve({
@@ -139,28 +139,27 @@ var capacitorApp = (function (exports, core) {
139
139
  return this.capture(_options);
140
140
  }
141
141
  async stopRecordVideo() {
142
- throw new Error("stopRecordVideo not supported under the web platform");
142
+ throw new Error('stopRecordVideo not supported under the web platform');
143
143
  }
144
144
  async startRecordVideo(_options) {
145
- throw new Error("startRecordVideo not supported under the web platform");
145
+ throw new Error('startRecordVideo not supported under the web platform');
146
146
  }
147
147
  async getSupportedFlashModes() {
148
- throw new Error("getSupportedFlashModes not supported under the web platform");
148
+ throw new Error('getSupportedFlashModes not supported under the web platform');
149
149
  }
150
150
  async getHorizontalFov() {
151
- throw new Error("getHorizontalFov not supported under the web platform");
151
+ throw new Error('getHorizontalFov not supported under the web platform');
152
152
  }
153
153
  async setFlashMode(_options) {
154
- throw new Error("setFlashMode not supported under the web platform" + _options);
154
+ throw new Error(`setFlashMode not supported under the web platform${_options}`);
155
155
  }
156
156
  async flip() {
157
- throw new Error("flip not supported under the web platform");
157
+ throw new Error('flip not supported under the web platform');
158
158
  }
159
159
  async setOpacity(_options) {
160
- const video = document.getElementById("video");
161
- if (!!video && !!_options["opacity"]) {
162
- video.style.setProperty("opacity", _options["opacity"].toString());
163
- }
160
+ const video = document.getElementById('video');
161
+ if (!!video && !!_options.opacity)
162
+ video.style.setProperty('opacity', _options.opacity.toString());
164
163
  }
165
164
  }
166
165
 
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from \"@capacitor/core\";\nconst CameraPreview = registerPlugin(\"CameraPreview\", {\n web: () => import(\"./web\").then((m) => new m.CameraPreviewWeb()),\n});\nexport * from \"./definitions\";\nexport { CameraPreview };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nexport class CameraPreviewWeb extends WebPlugin {\n constructor() {\n super({\n name: \"CameraPreview\",\n platforms: [\"web\"],\n });\n }\n async start(options) {\n var _a;\n await navigator.mediaDevices\n .getUserMedia({\n audio: !options.disableAudio,\n video: true,\n })\n .then((stream) => {\n // Stop any existing stream so we can request media with different constraints based on user input\n stream.getTracks().forEach((track) => track.stop());\n })\n .catch((error) => {\n Promise.reject(error);\n });\n const video = document.getElementById(\"video\");\n const parent = document.getElementById(options.parent);\n if (!video) {\n const videoElement = document.createElement(\"video\");\n videoElement.id = \"video\";\n videoElement.setAttribute(\"class\", options.className || \"\");\n // Don't flip video feed if camera is rear facing\n if (options.position !== \"rear\") {\n videoElement.setAttribute(\"style\", \"-webkit-transform: scaleX(-1); transform: scaleX(-1);\");\n }\n const userAgent = navigator.userAgent.toLowerCase();\n const isSafari = userAgent.includes(\"safari\") && !userAgent.includes(\"chrome\");\n // Safari on iOS needs to have the autoplay, muted and playsinline attributes set for video.play() to be successful\n // Without these attributes videoElement.play() will throw a NotAllowedError\n // https://developer.apple.com/documentation/webkit/delivering_video_content_for_safari\n if (isSafari) {\n videoElement.setAttribute(\"autoplay\", \"true\");\n videoElement.setAttribute(\"muted\", \"true\");\n videoElement.setAttribute(\"playsinline\", \"true\");\n }\n parent.appendChild(videoElement);\n if ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia) {\n const constraints = {\n video: {\n width: { ideal: options.width },\n height: { ideal: options.height },\n },\n };\n if (options.position === \"rear\") {\n constraints.video.facingMode =\n \"environment\";\n this.isBackCamera = true;\n }\n else {\n this.isBackCamera = false;\n }\n const self = this;\n await navigator.mediaDevices.getUserMedia(constraints).then(function (stream) {\n if (document.getElementById(\"video\")) {\n //video.src = window.URL.createObjectURL(stream);\n videoElement.srcObject = stream;\n videoElement.play();\n Promise.resolve({});\n }\n else {\n self.stopStream(stream);\n Promise.reject({ message: \"camera already stopped\" });\n }\n }, (err) => {\n Promise.reject(err);\n });\n }\n }\n else {\n Promise.reject({ message: \"camera already started\" });\n }\n }\n stopStream(stream) {\n if (stream) {\n const tracks = stream.getTracks();\n for (const track of tracks) {\n track.stop();\n }\n }\n }\n async stop() {\n const video = document.getElementById(\"video\");\n if (video) {\n video.pause();\n this.stopStream(video.srcObject);\n video.remove();\n }\n }\n async capture(options) {\n return new Promise((resolve, reject) => {\n const video = document.getElementById(\"video\");\n if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {\n reject({ message: \"camera is not running\" });\n return;\n }\n // video.width = video.offsetWidth;\n let base64EncodedImage;\n if (video && video.videoWidth > 0 && video.videoHeight > 0) {\n const canvas = document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\");\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n // flip horizontally back camera isn't used\n if (!this.isBackCamera) {\n context.translate(video.videoWidth, 0);\n context.scale(-1, 1);\n }\n context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);\n if ((options.format || \"jpeg\") === \"jpeg\") {\n base64EncodedImage = canvas\n .toDataURL(\"image/jpeg\", (options.quality || 85) / 100.0)\n .replace(\"data:image/jpeg;base64,\", \"\");\n }\n else {\n base64EncodedImage = canvas\n .toDataURL(\"image/png\")\n .replace(\"data:image/png;base64,\", \"\");\n }\n }\n resolve({\n value: base64EncodedImage,\n });\n });\n }\n async captureSample(_options) {\n return this.capture(_options);\n }\n async stopRecordVideo() {\n throw new Error(\"stopRecordVideo not supported under the web platform\");\n }\n async startRecordVideo(_options) {\n throw new Error(\"startRecordVideo not supported under the web platform\");\n }\n async getSupportedFlashModes() {\n throw new Error(\"getSupportedFlashModes not supported under the web platform\");\n }\n async getHorizontalFov() {\n throw new Error(\"getHorizontalFov not supported under the web platform\");\n }\n async setFlashMode(_options) {\n throw new Error(\"setFlashMode not supported under the web platform\" + _options);\n }\n async flip() {\n throw new Error(\"flip not supported under the web platform\");\n }\n async setOpacity(_options) {\n const video = document.getElementById(\"video\");\n if (!!video && !!_options[\"opacity\"]) {\n video.style.setProperty(\"opacity\", _options[\"opacity\"].toString());\n }\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],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;IACjF,KAAK;IACL,IAAI,MAAM,sBAAsB,GAAG;IACnC,QAAQ,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACvF,KAAK;IACL,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;IACjF,KAAK;IACL,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC,QAAQ,MAAM,IAAI,KAAK,CAAC,mDAAmD,GAAG,QAAQ,CAAC,CAAC;IACxF,KAAK;IACL,IAAI,MAAM,IAAI,GAAG;IACjB,QAAQ,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IACrE,KAAK;IACL,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAC/B,QAAQ,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IACvD,QAAQ,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;IAC9C,YAAY,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC/E,SAAS;IACT,KAAK;IACL;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CameraPreview = registerPlugin('CameraPreview', {\n web: () => import('./web').then(m => new m.CameraPreviewWeb()),\n});\nexport * from './definitions';\nexport { CameraPreview };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CameraPreviewWeb extends WebPlugin {\n constructor() {\n super({\n name: 'CameraPreview',\n platforms: ['web'],\n });\n }\n async start(options) {\n var _a;\n await navigator.mediaDevices\n .getUserMedia({\n audio: !options.disableAudio,\n video: true,\n })\n .then((stream) => {\n // Stop any existing stream so we can request media with different constraints based on user input\n stream.getTracks().forEach(track => track.stop());\n })\n .catch((error) => {\n Promise.reject(error);\n });\n const video = document.getElementById('video');\n const parent = document.getElementById(options.parent);\n if (!video) {\n const videoElement = document.createElement('video');\n videoElement.id = 'video';\n videoElement.setAttribute('class', options.className || '');\n // Don't flip video feed if camera is rear facing\n if (options.position !== 'rear') {\n videoElement.setAttribute('style', '-webkit-transform: scaleX(-1); transform: scaleX(-1);');\n }\n const userAgent = navigator.userAgent.toLowerCase();\n const isSafari = userAgent.includes('safari') && !userAgent.includes('chrome');\n // Safari on iOS needs to have the autoplay, muted and playsinline attributes set for video.play() to be successful\n // Without these attributes videoElement.play() will throw a NotAllowedError\n // https://developer.apple.com/documentation/webkit/delivering_video_content_for_safari\n if (isSafari) {\n videoElement.setAttribute('autoplay', 'true');\n videoElement.setAttribute('muted', 'true');\n videoElement.setAttribute('playsinline', 'true');\n }\n parent.appendChild(videoElement);\n if ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia) {\n const constraints = {\n video: {\n width: { ideal: options.width },\n height: { ideal: options.height },\n },\n };\n if (options.position === 'rear') {\n constraints.video.facingMode\n = 'environment';\n this.isBackCamera = true;\n }\n else {\n this.isBackCamera = false;\n }\n // eslint-disable-next-line ts/no-this-alias\n const self = this;\n await navigator.mediaDevices.getUserMedia(constraints).then((stream) => {\n if (document.getElementById('video')) {\n // video.src = window.URL.createObjectURL(stream);\n videoElement.srcObject = stream;\n videoElement.play();\n Promise.resolve({});\n }\n else {\n self.stopStream(stream);\n Promise.reject(new Error('camera already stopped'));\n }\n }, (err) => {\n Promise.reject(new Error(err));\n });\n }\n }\n else {\n Promise.reject(new Error('camera already started'));\n }\n }\n stopStream(stream) {\n if (stream) {\n const tracks = stream.getTracks();\n for (const track of tracks)\n track.stop();\n }\n }\n async stop() {\n const video = document.getElementById('video');\n if (video) {\n video.pause();\n this.stopStream(video.srcObject);\n video.remove();\n }\n }\n async capture(options) {\n return new Promise((resolve, reject) => {\n const video = document.getElementById('video');\n if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {\n reject(new Error('camera is not running'));\n return;\n }\n // video.width = video.offsetWidth;\n let base64EncodedImage;\n if (video && video.videoWidth > 0 && video.videoHeight > 0) {\n const canvas = document.createElement('canvas');\n const context = canvas.getContext('2d');\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n // flip horizontally back camera isn't used\n if (!this.isBackCamera) {\n context.translate(video.videoWidth, 0);\n context.scale(-1, 1);\n }\n context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);\n if ((options.format || 'jpeg') === 'jpeg') {\n base64EncodedImage = canvas\n .toDataURL('image/jpeg', (options.quality || 85) / 100.0)\n .replace('data:image/jpeg;base64,', '');\n }\n else {\n base64EncodedImage = canvas\n .toDataURL('image/png')\n .replace('data:image/png;base64,', '');\n }\n }\n resolve({\n value: base64EncodedImage,\n });\n });\n }\n async captureSample(_options) {\n return this.capture(_options);\n }\n async stopRecordVideo() {\n throw new Error('stopRecordVideo not supported under the web platform');\n }\n async startRecordVideo(_options) {\n throw new Error('startRecordVideo not supported under the web platform');\n }\n async getSupportedFlashModes() {\n throw new Error('getSupportedFlashModes not supported under the web platform');\n }\n async getHorizontalFov() {\n throw new Error('getHorizontalFov not supported under the web platform');\n }\n async setFlashMode(_options) {\n throw new Error(`setFlashMode not supported under the web platform${_options}`);\n }\n async flip() {\n throw new Error('flip not supported under the web platform');\n }\n async setOpacity(_options) {\n const video = document.getElementById('video');\n if (!!video && !!_options.opacity)\n video.style.setProperty('opacity', _options.opacity.toString());\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,aAAa,GAAGA,mBAAc,CAAC,eAAe,EAAE;IACtD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAClE,CAAC;;ICFM,MAAM,gBAA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AC,CAAC;IACjF,KAAK;IACL,IAAI,MAAM,YAAY,CAAC,QAAQ,EAAE;IACjC,QAAQ,MAAM,IAAI,KAAK,CAAC,CAAC,iDAAiD,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IACxF,KAAK;IACL,IAAI,MAAM,IAAI,GAAG;IACjB,QAAQ,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IACrE,KAAK;IACL,IAAI,MAAM,UAAU,CAAC,QAAQ,EAAE;IAC/B,QAAQ,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IACvD,QAAQ,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO;IACzC,YAAY,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC5E,KAAK;IACL;;;;;;;;;;;;;;;"}
package/ios/Podfile.lock CHANGED
@@ -1,5 +1,5 @@
1
1
  PODS:
2
- - Capacitor (5.0.3):
2
+ - Capacitor (6.0.0):
3
3
  - CapacitorCordova
4
4
  - CapacitorCordova (2.0.1)
5
5
 
@@ -15,7 +15,7 @@ EXTERNAL SOURCES:
15
15
  :path: "../node_modules/@capacitor/ios"
16
16
 
17
17
  SPEC CHECKSUMS:
18
- Capacitor: 304a960e431f9e6f78556554ca71c41c1b2b9680
18
+ Capacitor: 559d073c4ca6c27f8e7002c807eea94c3ba435a9
19
19
  CapacitorCordova: 9fee2eb6780331b6ff09710d6a7d1f2e4707f1b9
20
20
 
21
21
  PODFILE CHECKSUM: e80ffb7ef3a0ac7d0d6143f3e64f287d4d027c84
package/package.json CHANGED
@@ -1,9 +1,29 @@
1
1
  {
2
2
  "name": "@capgo/camera-preview",
3
- "version": "6.1.4",
3
+ "version": "6.1.6",
4
4
  "description": "Camera preview",
5
+ "author": "Martin Donadieu <martindonadieu@gmail.com>",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/Cap-go/camera-preview.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/Cap-go/camera-preview/issues"
13
+ },
14
+ "keywords": [
15
+ "capacitor",
16
+ "plugin",
17
+ "native"
18
+ ],
5
19
  "main": "dist/esm/index.js",
6
20
  "types": "dist/esm/index.d.ts",
21
+ "files": [
22
+ "CapgoCameraPreview.podspec",
23
+ "android/",
24
+ "dist/",
25
+ "ios/"
26
+ ],
7
27
  "scripts": {
8
28
  "verify": "npm run verify:ios && npm run verify:android && npm run verify:web",
9
29
  "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..",
@@ -12,7 +32,7 @@
12
32
  "lint": "npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint",
13
33
  "fmt": "npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --autocorrect --format",
14
34
  "eslint": "eslint .",
15
- "prettier": "prettier --config .prettierrc.js \"**/*.{css,html,ts,js,java}\"",
35
+ "prettier": "prettier --config .prettierrc.js \"**/*.java\"",
16
36
  "swiftlint": "node-swiftlint",
17
37
  "build": "npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs",
18
38
  "clean": "rimraf ./dist",
@@ -21,21 +41,20 @@
21
41
  "prepublishOnly": "npm run build",
22
42
  "prepare": "husky install"
23
43
  },
24
- "author": "Martin Donadieu <martindonadieu@gmail.com>",
25
- "license": "MIT",
44
+ "peerDependencies": {
45
+ "@capacitor/core": "^6.0.0"
46
+ },
47
+ "dependencies": {},
26
48
  "devDependencies": {
49
+ "@antfu/eslint-config": "^2.16.1",
27
50
  "@capacitor/android": "^6.0.0",
28
51
  "@capacitor/cli": "^6.0.0",
29
52
  "@capacitor/core": "^6.0.0",
30
53
  "@capacitor/docgen": "^0.2.2",
31
54
  "@capacitor/ios": "^6.0.0",
32
- "@ionic/eslint-config": "^0.3.0",
33
55
  "@ionic/prettier-config": "^4.0.0",
34
56
  "@ionic/swiftlint-config": "^1.1.2",
35
- "@typescript-eslint/eslint-plugin": "^7.8.0",
36
- "@typescript-eslint/parser": "^7.8.0",
37
57
  "eslint": "^9.1.1",
38
- "eslint-plugin-import": "^2.29.1",
39
58
  "husky": "^9.0.11",
40
59
  "prettier": "^3.2.5",
41
60
  "prettier-plugin-java": "^2.6.0",
@@ -44,9 +63,6 @@
44
63
  "swiftlint": "^1.0.2",
45
64
  "typescript": "^5.4.5"
46
65
  },
47
- "peerDependencies": {
48
- "@capacitor/core": "^6.0.0"
49
- },
50
66
  "capacitor": {
51
67
  "ios": {
52
68
  "src": "ios"
@@ -56,26 +72,5 @@
56
72
  }
57
73
  },
58
74
  "prettier": "@ionic/prettier-config",
59
- "swiftlint": "@ionic/swiftlint-config",
60
- "eslintConfig": {
61
- "extends": "@ionic/eslint-config/recommended"
62
- },
63
- "files": [
64
- "dist/",
65
- "ios/",
66
- "android/",
67
- "CapgoCameraPreview.podspec"
68
- ],
69
- "keywords": [
70
- "capacitor",
71
- "plugin",
72
- "native"
73
- ],
74
- "repository": {
75
- "type": "git",
76
- "url": "https://github.com/Cap-go/camera-preview.git"
77
- },
78
- "bugs": {
79
- "url": "https://github.com/Cap-go/camera-preview/issues"
80
- }
75
+ "swiftlint": "@ionic/swiftlint-config"
81
76
  }