@theia/ffmpeg 1.67.0-next.13 → 1.67.0-next.56

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theia/ffmpeg",
3
- "version": "1.67.0-next.13+c409d5d18",
3
+ "version": "1.67.0-next.56+d8f18cc386c",
4
4
  "description": "Theia FFMPEG reader utility.",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -36,5 +36,5 @@
36
36
  "devDependencies": {
37
37
  "@types/unzipper": "^0.9.2"
38
38
  },
39
- "gitHead": "c409d5d18d8c4f5a722f87b37ea9d6fd5af47ea8"
39
+ "gitHead": "d8f18cc386c45a736cd193d42eab02c8f64c6b10"
40
40
  }
@@ -1,11 +0,0 @@
1
- import * as ffmpeg from './ffmpeg';
2
- export interface CheckFfmpegOptions extends ffmpeg.FfmpegOptions {
3
- json?: boolean;
4
- }
5
- export interface CheckFfmpegResult {
6
- free: ffmpeg.Codec[];
7
- proprietary: ffmpeg.Codec[];
8
- }
9
- export declare const KNOWN_PROPRIETARY_CODECS: Set<string>;
10
- export declare function checkFfmpeg(options?: CheckFfmpegOptions): Promise<void>;
11
- //# sourceMappingURL=check-ffmpeg.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"check-ffmpeg.d.ts","sourceRoot":"","sources":["../src/check-ffmpeg.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,WAAW,kBAAmB,SAAQ,MAAM,CAAC,aAAa;IAC5D,IAAI,CAAC,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC;CAC/B;AAED,eAAO,MAAM,wBAAwB,aAA2B,CAAC;AAEjE,wBAAsB,WAAW,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BjF"}
@@ -1,47 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2019 Ericsson and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.checkFfmpeg = exports.KNOWN_PROPRIETARY_CODECS = void 0;
19
- const ffmpeg = require("./ffmpeg");
20
- exports.KNOWN_PROPRIETARY_CODECS = new Set(['h264', 'aac']);
21
- async function checkFfmpeg(options = {}) {
22
- const { ffmpegPath = ffmpeg.ffmpegAbsolutePath(options), json = false, } = options;
23
- const codecs = ffmpeg.getFfmpegCodecs(ffmpegPath);
24
- const free = [];
25
- const proprietary = [];
26
- for (const codec of codecs) {
27
- if (exports.KNOWN_PROPRIETARY_CODECS.has(codec.name.toLowerCase())) {
28
- proprietary.push(codec);
29
- }
30
- else {
31
- free.push(codec);
32
- }
33
- }
34
- if (json) {
35
- // Pretty format JSON on stdout.
36
- const result = { free, proprietary };
37
- console.log(JSON.stringify(result, undefined, 2));
38
- }
39
- if (proprietary.length > 0) {
40
- // Should be displayed on stderr to not pollute the JSON on stdout.
41
- throw new Error(`${proprietary.length} proprietary codecs found\n${proprietary.map(codec => `> ${codec.name} detected (${codec.longName})`).join('\n')}`);
42
- }
43
- // Print to stderr to not pollute the JSON on stdout.
44
- console.warn(`"${ffmpegPath}" does not contain proprietary codecs (${codecs.length} found).`);
45
- }
46
- exports.checkFfmpeg = checkFfmpeg;
47
- //# sourceMappingURL=check-ffmpeg.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"check-ffmpeg.js","sourceRoot":"","sources":["../src/check-ffmpeg.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,mCAAmC;AAWtB,QAAA,wBAAwB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;AAE1D,KAAK,UAAU,WAAW,CAAC,UAA8B,EAAE;IAC9D,MAAM,EACF,UAAU,GAAG,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAC/C,IAAI,GAAG,KAAK,GACf,GAAG,OAAO,CAAC;IACZ,MAAM,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,EAAE,CAAC;IAChB,MAAM,WAAW,GAAG,EAAE,CAAC;IACvB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,IAAI,gCAAwB,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC;YACzD,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACL,CAAC;IACD,IAAI,IAAI,EAAE,CAAC;QACP,gCAAgC;QAChC,MAAM,MAAM,GAAsB,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;QACxD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC;IACtD,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,mEAAmE;QACnE,MAAM,IAAI,KAAK,CAAC,GAAG,WAAW,CAAC,MAAM,8BAA8B,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,CAAC,IAAI,cAAc,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9J,CAAC;IACD,qDAAqD;IACrD,OAAO,CAAC,IAAI,CAAC,IAAI,UAAU,0CAA0C,MAAM,CAAC,MAAM,UAAU,CAAC,CAAC;AAClG,CAAC;AA1BD,kCA0BC"}
package/lib/ffmpeg.d.ts DELETED
@@ -1,48 +0,0 @@
1
- /// <reference types="node" />
2
- export interface Codec {
3
- id: number;
4
- name: string;
5
- longName: string;
6
- }
7
- export interface FfmpegNativeAddon {
8
- codecs(ffmpegPath: string): Codec[];
9
- }
10
- export interface FfmpegNameAndLocation {
11
- /**
12
- * Name with extension of the shared library.
13
- */
14
- name: string;
15
- /**
16
- * Relative location of the file from Electron's dist root.
17
- */
18
- location: string;
19
- }
20
- export interface FfmpegOptions {
21
- electronVersion?: string;
22
- electronDist?: string;
23
- ffmpegPath?: string;
24
- platform?: NodeJS.Platform;
25
- }
26
- /**
27
- * @internal
28
- */
29
- export declare function _loadFfmpegNativeAddon(): FfmpegNativeAddon;
30
- /**
31
- * @returns name and relative path from Electron's root where FFMPEG is located at.
32
- */
33
- export declare function ffmpegNameAndLocation({ platform }?: FfmpegOptions): FfmpegNameAndLocation;
34
- /**
35
- * @returns relative ffmpeg shared library path from the Electron distribution root.
36
- */
37
- export declare function ffmpegRelativePath(options?: FfmpegOptions): string;
38
- /**
39
- * @returns absolute ffmpeg shared library path.
40
- */
41
- export declare function ffmpegAbsolutePath(options?: FfmpegOptions): string;
42
- /**
43
- * Dynamically link to `ffmpegPath` and use FFMPEG APIs to list the included `Codec`s.
44
- * @param ffmpegPath absolute path the the FFMPEG shared library.
45
- * @returns list of codecs for the given ffmpeg shared library.
46
- */
47
- export declare function getFfmpegCodecs(ffmpegPath: string): Codec[];
48
- //# sourceMappingURL=ffmpeg.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ffmpeg.d.ts","sourceRoot":"","sources":["../src/ffmpeg.ts"],"names":[],"mappings":";AAkBA,MAAM,WAAW,KAAK;IAClB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,iBAAiB;IAC9B,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK,EAAE,CAAA;CACtC;AAED,MAAM,WAAW,qBAAqB;IAClC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,aAAa;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAA;CAC7B;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,iBAAiB,CAU1D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,EAClC,QAA2B,EAC9B,GAAE,aAAkB,GAAG,qBAAqB,CAoB5C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,aAAkB,GAAG,MAAM,CAGtE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,aAAkB,GAAG,MAAM,CAKtE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK,EAAE,CAE3D"}
package/lib/ffmpeg.js DELETED
@@ -1,87 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2019 Ericsson and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.getFfmpegCodecs = exports.ffmpegAbsolutePath = exports.ffmpegRelativePath = exports.ffmpegNameAndLocation = exports._loadFfmpegNativeAddon = void 0;
19
- const path = require("path");
20
- /**
21
- * @internal
22
- */
23
- function _loadFfmpegNativeAddon() {
24
- try {
25
- return require('../build/Release/ffmpeg.node');
26
- }
27
- catch (error) {
28
- if (error.code === 'MODULE_NOT_FOUND') {
29
- return require('../build/Debug/ffmpeg.node');
30
- }
31
- else {
32
- throw error;
33
- }
34
- }
35
- }
36
- exports._loadFfmpegNativeAddon = _loadFfmpegNativeAddon;
37
- /**
38
- * @returns name and relative path from Electron's root where FFMPEG is located at.
39
- */
40
- function ffmpegNameAndLocation({ platform = process.platform } = {}) {
41
- switch (platform) {
42
- case 'darwin':
43
- return {
44
- name: 'libffmpeg.dylib',
45
- location: 'Electron.app/Contents/Frameworks/Electron Framework.framework/Libraries/',
46
- };
47
- case 'win32':
48
- return {
49
- name: 'ffmpeg.dll',
50
- location: '',
51
- };
52
- case 'linux':
53
- return {
54
- name: 'libffmpeg.so',
55
- location: '',
56
- };
57
- default:
58
- throw new Error(`${platform} is not supported`);
59
- }
60
- }
61
- exports.ffmpegNameAndLocation = ffmpegNameAndLocation;
62
- /**
63
- * @returns relative ffmpeg shared library path from the Electron distribution root.
64
- */
65
- function ffmpegRelativePath(options = {}) {
66
- const { location, name } = ffmpegNameAndLocation(options);
67
- return path.join(location, name);
68
- }
69
- exports.ffmpegRelativePath = ffmpegRelativePath;
70
- /**
71
- * @returns absolute ffmpeg shared library path.
72
- */
73
- function ffmpegAbsolutePath(options = {}) {
74
- const { electronDist = path.resolve(require.resolve('electron/package.json'), '..', 'dist') } = options;
75
- return path.join(electronDist, ffmpegRelativePath(options));
76
- }
77
- exports.ffmpegAbsolutePath = ffmpegAbsolutePath;
78
- /**
79
- * Dynamically link to `ffmpegPath` and use FFMPEG APIs to list the included `Codec`s.
80
- * @param ffmpegPath absolute path the the FFMPEG shared library.
81
- * @returns list of codecs for the given ffmpeg shared library.
82
- */
83
- function getFfmpegCodecs(ffmpegPath) {
84
- return _loadFfmpegNativeAddon().codecs(ffmpegPath);
85
- }
86
- exports.getFfmpegCodecs = getFfmpegCodecs;
87
- //# sourceMappingURL=ffmpeg.js.map
package/lib/ffmpeg.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"ffmpeg.js","sourceRoot":"","sources":["../src/ffmpeg.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,6BAA8B;AA8B9B;;GAEG;AACH,SAAgB,sBAAsB;IAClC,IAAI,CAAC;QACD,OAAO,OAAO,CAAC,8BAA8B,CAAC,CAAC;IACnD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,IAAI,KAAK,CAAC,IAAI,KAAK,kBAAkB,EAAE,CAAC;YACpC,OAAO,OAAO,CAAC,4BAA4B,CAAC,CAAC;QACjD,CAAC;aAAM,CAAC;YACJ,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC;AACL,CA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
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- export declare function hashFile(filePath: string): Promise<Buffer>;
4
- //# sourceMappingURL=hash.d.ts.map
package/lib/hash.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../src/hash.ts"],"names":[],"mappings":";;AAmBA,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQhE"}
package/lib/hash.js DELETED
@@ -1,31 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2021 Ericsson and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.hashFile = void 0;
19
- const crypto = require("crypto");
20
- const fs = require("fs-extra");
21
- async function hashFile(filePath) {
22
- return new Promise((resolve, reject) => {
23
- const sha256 = crypto.createHash('sha256');
24
- fs.createReadStream(filePath)
25
- .on('close', () => resolve(sha256.digest()))
26
- .on('data', data => sha256.update(data))
27
- .on('error', reject);
28
- });
29
- }
30
- exports.hashFile = hashFile;
31
- //# sourceMappingURL=hash.js.map
package/lib/hash.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"hash.js","sourceRoot":"","sources":["../src/hash.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,iCAAkC;AAClC,+BAAgC;AAEzB,KAAK,UAAU,QAAQ,CAAC,QAAgB;IAC3C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACnC,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC3C,EAAE,CAAC,gBAAgB,CAAC,QAAQ,CAAC;aACxB,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;aAC3C,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;aACvC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACP,CAAC;AARD,4BAQC"}
package/lib/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from './hash';
2
- export * from './ffmpeg';
3
- export * from './check-ffmpeg';
4
- export * from './replace-ffmpeg';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC"}
package/lib/index.js DELETED
@@ -1,23 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2021 Ericsson and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- const tslib_1 = require("tslib");
19
- tslib_1.__exportStar(require("./hash"), exports);
20
- tslib_1.__exportStar(require("./ffmpeg"), exports);
21
- tslib_1.__exportStar(require("./check-ffmpeg"), exports);
22
- tslib_1.__exportStar(require("./replace-ffmpeg"), exports);
23
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,iDAAuB;AACvB,mDAAyB;AACzB,yDAA+B;AAC/B,2DAAiC"}
@@ -1,4 +0,0 @@
1
- import * as ffmpeg from './ffmpeg';
2
- export declare function replaceFfmpeg(options?: ffmpeg.FfmpegOptions): Promise<void>;
3
- export declare function readElectronVersion(electronDist: string): Promise<string>;
4
- //# sourceMappingURL=replace-ffmpeg.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"replace-ffmpeg.d.ts","sourceRoot":"","sources":["../src/replace-ffmpeg.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAGnC,wBAAsB,aAAa,CAAC,OAAO,GAAE,MAAM,CAAC,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAiDrF;AAED,wBAAsB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAI/E"}
@@ -1,76 +0,0 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2019 Ericsson and others.
4
- //
5
- // This program and the accompanying materials are made available under the
6
- // terms of the Eclipse Public License v. 2.0 which is available at
7
- // http://www.eclipse.org/legal/epl-2.0.
8
- //
9
- // This Source Code may also be made available under the following Secondary
10
- // Licenses when the conditions for such availability set forth in the Eclipse
11
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- // with the GNU Classpath Exception which is available at
13
- // https://www.gnu.org/software/classpath/license.html.
14
- //
15
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.readElectronVersion = exports.replaceFfmpeg = void 0;
19
- const electronGet = require("@electron/get");
20
- const fs = require("fs-extra");
21
- const os = require("os");
22
- const path = require("path");
23
- const unzipper = require("unzipper");
24
- const ffmpeg = require("./ffmpeg");
25
- const hash_1 = require("./hash");
26
- async function replaceFfmpeg(options = {}) {
27
- let shouldDownload = true;
28
- let shouldReplace = true;
29
- const { name: ffmpegName, location: ffmpegLocation, } = ffmpeg.ffmpegNameAndLocation(options);
30
- const { electronDist = path.resolve(require.resolve('electron/package.json'), '..', 'dist'), electronVersion = await readElectronVersion(electronDist), ffmpegPath = path.resolve(electronDist, ffmpegLocation, ffmpegName), } = options;
31
- const ffmpegCachedPath = path.join(os.tmpdir(), `theia-cli/cache/electron-v${electronVersion}`, ffmpegName);
32
- if (await fs.pathExists(ffmpegCachedPath)) {
33
- shouldDownload = false; // If the file is already cached, do not download.
34
- console.warn('Found cached ffmpeg library.');
35
- const [cacheHash, distHash] = await Promise.all([
36
- (0, hash_1.hashFile)(ffmpegCachedPath),
37
- (0, hash_1.hashFile)(ffmpegPath),
38
- ]);
39
- if (cacheHash.equals(distHash)) {
40
- shouldReplace = false; // If files are already the same, do not replace.
41
- console.warn('Hashes are equal, not replacing the ffmpeg library.');
42
- }
43
- }
44
- if (shouldDownload) {
45
- const ffmpegZipPath = await electronGet.downloadArtifact({
46
- version: electronVersion,
47
- artifactName: 'ffmpeg'
48
- });
49
- const ffmpegZip = await unzipper.Open.file(ffmpegZipPath);
50
- const file = ffmpegZip.files.find(f => f.path.endsWith(ffmpegName));
51
- if (!file) {
52
- throw new Error(`Archive did not contain "${ffmpegName}".`);
53
- }
54
- // Extract file to cache.
55
- await fs.mkdirp(path.dirname(ffmpegCachedPath));
56
- await new Promise((resolve, reject) => {
57
- file.stream()
58
- .pipe(fs.createWriteStream(ffmpegCachedPath))
59
- .on('finish', resolve)
60
- .on('error', reject);
61
- });
62
- console.warn(`Downloaded ffmpeg shared library { version: "${electronVersion}", dist: "${electronDist}" }.`);
63
- }
64
- if (shouldReplace) {
65
- await fs.copy(ffmpegCachedPath, ffmpegPath);
66
- console.warn(`Successfully replaced "${ffmpegPath}".`);
67
- }
68
- }
69
- exports.replaceFfmpeg = replaceFfmpeg;
70
- async function readElectronVersion(electronDist) {
71
- const electronVersionFilePath = path.resolve(electronDist, 'version');
72
- const version = await fs.readFile(electronVersionFilePath, 'utf8');
73
- return version.trim();
74
- }
75
- exports.readElectronVersion = readElectronVersion;
76
- //# sourceMappingURL=replace-ffmpeg.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"replace-ffmpeg.js","sourceRoot":"","sources":["../src/replace-ffmpeg.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,6CAA8C;AAC9C,+BAAgC;AAChC,yBAA0B;AAC1B,6BAA8B;AAC9B,qCAAsC;AACtC,mCAAmC;AACnC,iCAAkC;AAE3B,KAAK,UAA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