stage-browser 0.0.0-stage → 0.1.1
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/README.md +136 -2
- package/build/icon.icns +0 -0
- package/build/icon.png +0 -0
- package/dist/bin/stage.js +111 -0
- package/dist/main/cli-args.js +28 -0
- package/dist/main/context-menu.js +68 -0
- package/dist/main/context.js +2 -0
- package/dist/main/extensions.js +78 -0
- package/dist/main/ipc.js +90 -0
- package/dist/main/main.js +279 -0
- package/dist/main/menu.js +140 -0
- package/dist/main/reveal.js +155 -0
- package/dist/main/selftest.js +490 -0
- package/dist/main/store.js +85 -0
- package/dist/main/suggest.js +43 -0
- package/dist/main/tabs.js +324 -0
- package/dist/main/url.js +38 -0
- package/dist/main/window.js +68 -0
- package/dist/preload/extension-compat.js +163 -0
- package/dist/preload/ui-preload.js +33 -0
- package/dist/shared/contract.js +6 -0
- package/dist/ui/app.js +653 -0
- package/dist/ui/index.html +41 -0
- package/dist/ui/mock.js +479 -0
- package/dist/ui/newtab.html +69 -0
- package/dist/ui/styles.css +410 -0
- package/node_modules/@types/chrome/LICENSE +21 -0
- package/node_modules/@types/chrome/README.md +15 -0
- package/node_modules/@types/chrome/chrome-cast/index.d.ts +1156 -0
- package/node_modules/@types/chrome/har-format/index.d.ts +6 -0
- package/node_modules/@types/chrome/index.d.ts +13786 -0
- package/node_modules/@types/chrome/package.json +99 -0
- package/node_modules/@types/filesystem/LICENSE +21 -0
- package/node_modules/@types/filesystem/README.md +15 -0
- package/node_modules/@types/filesystem/index.d.ts +564 -0
- package/node_modules/@types/filesystem/package.json +26 -0
- package/node_modules/@types/filewriter/LICENSE +21 -0
- package/node_modules/@types/filewriter/README.md +15 -0
- package/node_modules/@types/filewriter/index.d.ts +166 -0
- package/node_modules/@types/filewriter/package.json +25 -0
- package/node_modules/@types/har-format/LICENSE +21 -0
- package/node_modules/@types/har-format/README.md +15 -0
- package/node_modules/@types/har-format/index.d.ts +938 -0
- package/node_modules/@types/har-format/package.json +31 -0
- package/node_modules/adm-zip/LICENSE +21 -0
- package/node_modules/adm-zip/README.md +90 -0
- package/node_modules/adm-zip/adm-zip.js +1020 -0
- package/node_modules/adm-zip/headers/entryHeader.js +396 -0
- package/node_modules/adm-zip/headers/index.js +2 -0
- package/node_modules/adm-zip/headers/mainHeader.js +177 -0
- package/node_modules/adm-zip/methods/deflater.js +33 -0
- package/node_modules/adm-zip/methods/index.js +3 -0
- package/node_modules/adm-zip/methods/inflater.js +64 -0
- package/node_modules/adm-zip/methods/zipcrypto.js +175 -0
- package/node_modules/adm-zip/package.json +56 -0
- package/node_modules/adm-zip/types.d.ts +223 -0
- package/node_modules/adm-zip/util/constants.js +142 -0
- package/node_modules/adm-zip/util/decoder.js +5 -0
- package/node_modules/adm-zip/util/errors.js +66 -0
- package/node_modules/adm-zip/util/fattr.js +76 -0
- package/node_modules/adm-zip/util/index.js +5 -0
- package/node_modules/adm-zip/util/utils.js +481 -0
- package/node_modules/adm-zip/zipEntry.js +415 -0
- package/node_modules/adm-zip/zipFile.js +466 -0
- package/node_modules/debug/LICENSE +20 -0
- package/node_modules/debug/README.md +481 -0
- package/node_modules/debug/package.json +64 -0
- package/node_modules/debug/src/browser.js +272 -0
- package/node_modules/debug/src/common.js +292 -0
- package/node_modules/debug/src/index.js +10 -0
- package/node_modules/debug/src/node.js +263 -0
- package/node_modules/electron-chrome-web-store/README.md +143 -0
- package/node_modules/electron-chrome-web-store/dist/chrome-web-store.preload.js +299 -0
- package/node_modules/electron-chrome-web-store/dist/cjs/browser/index.js +1674 -0
- package/node_modules/electron-chrome-web-store/dist/esm/browser/index.mjs +950 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/api.d.ts +2 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/crx3.d.ts +20 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/id.d.ts +9 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/index.d.ts +62 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/installer.d.ts +29 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/loader.d.ts +18 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/types.d.ts +21 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/updater.d.ts +6 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/utils.d.ts +4 -0
- package/node_modules/electron-chrome-web-store/dist/types/common/constants.d.ts +44 -0
- package/node_modules/electron-chrome-web-store/dist/types/renderer/chrome-web-store.preload.d.ts +1 -0
- package/node_modules/electron-chrome-web-store/package.json +43 -0
- package/node_modules/ms/index.js +162 -0
- package/node_modules/ms/license.md +21 -0
- package/node_modules/ms/package.json +38 -0
- package/node_modules/ms/readme.md +59 -0
- package/node_modules/pbf/LICENSE +27 -0
- package/node_modules/pbf/README.md +293 -0
- package/node_modules/pbf/bin/pbf +17 -0
- package/node_modules/pbf/compile.js +441 -0
- package/node_modules/pbf/dist/pbf-dev.js +838 -0
- package/node_modules/pbf/dist/pbf.js +1 -0
- package/node_modules/pbf/index.d.ts +206 -0
- package/node_modules/pbf/index.js +830 -0
- package/node_modules/pbf/package.json +63 -0
- package/node_modules/protocol-buffers-schema/.travis.yml +7 -0
- package/node_modules/protocol-buffers-schema/LICENSE +21 -0
- package/node_modules/protocol-buffers-schema/README.md +122 -0
- package/node_modules/protocol-buffers-schema/example.js +11 -0
- package/node_modules/protocol-buffers-schema/example.proto +13 -0
- package/node_modules/protocol-buffers-schema/index.js +6 -0
- package/node_modules/protocol-buffers-schema/package.json +31 -0
- package/node_modules/protocol-buffers-schema/parse.js +769 -0
- package/node_modules/protocol-buffers-schema/stringify.js +206 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/basic.json +90 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/basic.proto +11 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/comments.json +99 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/comments.proto +19 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/complex.json +125 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/complex.proto +30 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/enum.json +42 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/enum.proto +8 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/escaped-quotes.json +32 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/escaped-quotes.proto +3 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/extend.json +167 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/extend.proto +19 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/import.json +30 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/import.proto +6 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/map.json +33 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/map.proto +3 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/no-tags.proto +8 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/oneof.json +41 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/oneof.proto +6 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/option.json +364 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/option.proto +72 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/options.json +47 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/options.proto +8 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/pheromon-trajectories.proto +8 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/reserved.json +55 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/reserved.proto +17 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/search.json +30 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/search.proto +5 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/service.json +108 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/service.proto +30 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/valid-packed.proto +35 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/version.json +90 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/version.proto +13 -0
- package/node_modules/protocol-buffers-schema/test/index.js +157 -0
- package/node_modules/protocol-buffers-schema/tokenize.js +56 -0
- package/node_modules/resolve-protobuf-schema/.travis.yml +3 -0
- package/node_modules/resolve-protobuf-schema/LICENSE +21 -0
- package/node_modules/resolve-protobuf-schema/README.md +49 -0
- package/node_modules/resolve-protobuf-schema/index.js +50 -0
- package/node_modules/resolve-protobuf-schema/package.json +25 -0
- package/node_modules/resolve-protobuf-schema/test/a.proto +5 -0
- package/node_modules/resolve-protobuf-schema/test/b.proto +5 -0
- package/node_modules/resolve-protobuf-schema/test/c.proto +3 -0
- package/node_modules/resolve-protobuf-schema/test/index.js +49 -0
- package/package.json +64 -4
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import Pbf from 'pbf';
|
|
2
|
+
interface AsymmetricKeyProof {
|
|
3
|
+
public_key: Buffer;
|
|
4
|
+
signature: Buffer;
|
|
5
|
+
}
|
|
6
|
+
interface CrxFileHeader {
|
|
7
|
+
sha256_with_rsa: AsymmetricKeyProof[];
|
|
8
|
+
sha256_with_ecdsa: AsymmetricKeyProof[];
|
|
9
|
+
verified_contents?: Buffer;
|
|
10
|
+
signed_header_data?: Buffer;
|
|
11
|
+
}
|
|
12
|
+
export declare function readCrxFileHeader(pbf: Pbf, end?: any): CrxFileHeader;
|
|
13
|
+
export declare function readAsymmetricKeyProof(pbf: Pbf, end: any): {
|
|
14
|
+
public_key: undefined;
|
|
15
|
+
signature: undefined;
|
|
16
|
+
};
|
|
17
|
+
export declare function readSignedData(pbf: Pbf, end?: any): {
|
|
18
|
+
crx_id?: Buffer;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a normal hexadecimal string into the alphabet used by extensions.
|
|
3
|
+
* We use the characters 'a'-'p' instead of '0'-'f' to avoid ever having a
|
|
4
|
+
* completely numeric host, since some software interprets that as an IP address.
|
|
5
|
+
*
|
|
6
|
+
* @param id - The hexadecimal string to convert. This is modified in place.
|
|
7
|
+
*/
|
|
8
|
+
export declare function convertHexadecimalToIDAlphabet(id: string): string;
|
|
9
|
+
export declare function generateId(input: string): string;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export { loadAllExtensions } from './loader';
|
|
2
|
+
export { installExtension, uninstallExtension, downloadExtension } from './installer';
|
|
3
|
+
export { updateExtensions } from './updater';
|
|
4
|
+
import { BeforeInstall, ExtensionId } from './types';
|
|
5
|
+
interface ElectronChromeWebStoreOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Session to enable the Chrome Web Store in.
|
|
8
|
+
* Defaults to session.defaultSession
|
|
9
|
+
*/
|
|
10
|
+
session?: Electron.Session;
|
|
11
|
+
/**
|
|
12
|
+
* Path to the 'electron-chrome-web-store' module.
|
|
13
|
+
*
|
|
14
|
+
* @deprecated See "Packaging the preload script" in the readme.
|
|
15
|
+
*/
|
|
16
|
+
modulePath?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Path to extensions directory.
|
|
19
|
+
* Defaults to 'Extensions/' under app's userData path.
|
|
20
|
+
*/
|
|
21
|
+
extensionsPath?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Load extensions installed by Chrome Web Store.
|
|
24
|
+
* Defaults to true.
|
|
25
|
+
*/
|
|
26
|
+
loadExtensions?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Whether to allow loading unpacked extensions. Only loads if
|
|
29
|
+
* `loadExtensions` is also enabled.
|
|
30
|
+
* Defaults to false.
|
|
31
|
+
*/
|
|
32
|
+
allowUnpackedExtensions?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* List of allowed extension IDs to install.
|
|
35
|
+
*/
|
|
36
|
+
allowlist?: ExtensionId[];
|
|
37
|
+
/**
|
|
38
|
+
* List of denied extension IDs to install.
|
|
39
|
+
*/
|
|
40
|
+
denylist?: ExtensionId[];
|
|
41
|
+
/**
|
|
42
|
+
* Whether extensions should auto-update.
|
|
43
|
+
*/
|
|
44
|
+
autoUpdate?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Minimum supported version of Chrome extensions.
|
|
47
|
+
* Defaults to 3.
|
|
48
|
+
*/
|
|
49
|
+
minimumManifestVersion?: number;
|
|
50
|
+
/**
|
|
51
|
+
* Called prior to installing an extension. If implemented, return a Promise
|
|
52
|
+
* which resolves with `{ action: 'allow' | 'deny' }` depending on the action
|
|
53
|
+
* to be taken.
|
|
54
|
+
*/
|
|
55
|
+
beforeInstall?: BeforeInstall;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Install Chrome Web Store support.
|
|
59
|
+
*
|
|
60
|
+
* @param options Chrome Web Store configuration options.
|
|
61
|
+
*/
|
|
62
|
+
export declare function installChromeWebStore(opts?: ElectronChromeWebStoreOptions): Promise<void>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare function downloadExtensionFromURL(url: string, extensionsDir: string, expectedExtensionId?: string): Promise<string>;
|
|
2
|
+
/**
|
|
3
|
+
* Download and unpack extension to the given extensions directory.
|
|
4
|
+
*/
|
|
5
|
+
export declare function downloadExtension(extensionId: string, extensionsDir: string): Promise<string>;
|
|
6
|
+
interface CommonExtensionOptions {
|
|
7
|
+
/** Session to load extensions into. */
|
|
8
|
+
session?: Electron.Session;
|
|
9
|
+
/**
|
|
10
|
+
* Directory where web store extensions will be installed.
|
|
11
|
+
* Defaults to `Extensions` under the app's `userData` directory.
|
|
12
|
+
*/
|
|
13
|
+
extensionsPath?: string;
|
|
14
|
+
}
|
|
15
|
+
interface InstallExtensionOptions extends CommonExtensionOptions {
|
|
16
|
+
/** Options for loading the extension. */
|
|
17
|
+
loadExtensionOptions?: Electron.LoadExtensionOptions;
|
|
18
|
+
}
|
|
19
|
+
interface UninstallExtensionOptions extends CommonExtensionOptions {
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Install extension from the web store.
|
|
23
|
+
*/
|
|
24
|
+
export declare function installExtension(extensionId: string, opts?: InstallExtensionOptions): Promise<Electron.Extension>;
|
|
25
|
+
/**
|
|
26
|
+
* Uninstall extension from the web store.
|
|
27
|
+
*/
|
|
28
|
+
export declare function uninstallExtension(extensionId: string, opts?: UninstallExtensionOptions): Promise<void>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type ExtensionPathBaseInfo = {
|
|
2
|
+
manifest: chrome.runtime.Manifest;
|
|
3
|
+
path: string;
|
|
4
|
+
};
|
|
5
|
+
type ExtensionPathInfo = ({
|
|
6
|
+
type: 'store';
|
|
7
|
+
id: string;
|
|
8
|
+
} & ExtensionPathBaseInfo) | ({
|
|
9
|
+
type: 'unpacked';
|
|
10
|
+
} & ExtensionPathBaseInfo);
|
|
11
|
+
/**
|
|
12
|
+
* Load all extensions from the given directory.
|
|
13
|
+
*/
|
|
14
|
+
export declare function loadAllExtensions(session: Electron.Session, extensionsPath: string, options?: {
|
|
15
|
+
allowUnpacked?: boolean;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
export declare function findExtensionInstall(extensionId: string, extensionsPath: string): Promise<ExtensionPathInfo | null>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type ExtensionId = Electron.Extension['id'];
|
|
2
|
+
export interface ExtensionInstallDetails {
|
|
3
|
+
id: string;
|
|
4
|
+
localizedName: string;
|
|
5
|
+
manifest: chrome.runtime.Manifest;
|
|
6
|
+
icon: Electron.NativeImage;
|
|
7
|
+
browserWindow?: Electron.BrowserWindow;
|
|
8
|
+
frame: Electron.WebFrameMain;
|
|
9
|
+
}
|
|
10
|
+
export type BeforeInstall = (details: ExtensionInstallDetails) => Promise<{
|
|
11
|
+
action: 'allow' | 'deny';
|
|
12
|
+
}>;
|
|
13
|
+
export interface WebStoreState {
|
|
14
|
+
session: Electron.Session;
|
|
15
|
+
extensionsPath: string;
|
|
16
|
+
installing: Set<ExtensionId>;
|
|
17
|
+
allowlist?: Set<ExtensionId>;
|
|
18
|
+
denylist?: Set<ExtensionId>;
|
|
19
|
+
minimumManifestVersion: number;
|
|
20
|
+
beforeInstall?: BeforeInstall;
|
|
21
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { WebStoreState } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Check session's loaded extensions for updates and install any if available.
|
|
4
|
+
*/
|
|
5
|
+
export declare function updateExtensions(session?: Electron.Session): Promise<void>;
|
|
6
|
+
export declare function initUpdater(state: WebStoreState): Promise<void>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare const ExtensionInstallStatus: {
|
|
2
|
+
BLACKLISTED: string;
|
|
3
|
+
BLOCKED_BY_POLICY: string;
|
|
4
|
+
CAN_REQUEST: string;
|
|
5
|
+
CORRUPTED: string;
|
|
6
|
+
CUSTODIAN_APPROVAL_REQUIRED: string;
|
|
7
|
+
CUSTODIAN_APPROVAL_REQUIRED_FOR_INSTALLATION: string;
|
|
8
|
+
DEPRECATED_MANIFEST_VERSION: string;
|
|
9
|
+
DISABLED: string;
|
|
10
|
+
ENABLED: string;
|
|
11
|
+
FORCE_INSTALLED: string;
|
|
12
|
+
INSTALLABLE: string;
|
|
13
|
+
REQUEST_PENDING: string;
|
|
14
|
+
TERMINATED: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const MV2DeprecationStatus: {
|
|
17
|
+
INACTIVE: string;
|
|
18
|
+
SOFT_DISABLE: string;
|
|
19
|
+
WARNING: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const Result: {
|
|
22
|
+
ALREADY_INSTALLED: string;
|
|
23
|
+
BLACKLISTED: string;
|
|
24
|
+
BLOCKED_BY_POLICY: string;
|
|
25
|
+
BLOCKED_FOR_CHILD_ACCOUNT: string;
|
|
26
|
+
FEATURE_DISABLED: string;
|
|
27
|
+
ICON_ERROR: string;
|
|
28
|
+
INSTALL_ERROR: string;
|
|
29
|
+
INSTALL_IN_PROGRESS: string;
|
|
30
|
+
INVALID_ICON_URL: string;
|
|
31
|
+
INVALID_ID: string;
|
|
32
|
+
LAUNCH_IN_PROGRESS: string;
|
|
33
|
+
MANIFEST_ERROR: string;
|
|
34
|
+
MISSING_DEPENDENCIES: string;
|
|
35
|
+
SUCCESS: string;
|
|
36
|
+
UNKNOWN_ERROR: string;
|
|
37
|
+
UNSUPPORTED_EXTENSION_TYPE: string;
|
|
38
|
+
USER_CANCELLED: string;
|
|
39
|
+
USER_GESTURE_REQUIRED: string;
|
|
40
|
+
};
|
|
41
|
+
export declare const WebGlStatus: {
|
|
42
|
+
WEBGL_ALLOWED: string;
|
|
43
|
+
WEBGL_BLOCKED: string;
|
|
44
|
+
};
|
package/node_modules/electron-chrome-web-store/dist/types/renderer/chrome-web-store.preload.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "electron-chrome-web-store",
|
|
3
|
+
"version": "0.13.0",
|
|
4
|
+
"description": "Install and update Chrome extensions from the Chrome Web Store for Electron",
|
|
5
|
+
"main": "./dist/cjs/browser/index.js",
|
|
6
|
+
"module": "./dist/esm/browser/index.mjs",
|
|
7
|
+
"types": "./dist/types/browser/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/types/browser/index.d.ts",
|
|
11
|
+
"import": "./dist/esm/browser/index.mjs",
|
|
12
|
+
"require": "./dist/cjs/browser/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./preload": "./dist/chrome-web-store.preload.js"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "yarn clean && tsc && node esbuild.config.js",
|
|
18
|
+
"clean": "node ../../scripts/clean.js",
|
|
19
|
+
"prepublish": "NODE_ENV=production yarn build"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"electron",
|
|
23
|
+
"chrome",
|
|
24
|
+
"web",
|
|
25
|
+
"store",
|
|
26
|
+
"webstore",
|
|
27
|
+
"extensions"
|
|
28
|
+
],
|
|
29
|
+
"repository": "https://github.com/samuelmaddock/electron-browser-shell",
|
|
30
|
+
"author": "Samuel Maddock <sam@samuelmaddock.com>",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"esbuild": "^0.24.0",
|
|
34
|
+
"rimraf": "^6.0.1",
|
|
35
|
+
"typescript": "^5.6.3"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@types/chrome": "^0.0.287",
|
|
39
|
+
"adm-zip": "^0.5.16",
|
|
40
|
+
"debug": "^4.3.7",
|
|
41
|
+
"pbf": "^4.0.1"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
var s = 1000;
|
|
6
|
+
var m = s * 60;
|
|
7
|
+
var h = m * 60;
|
|
8
|
+
var d = h * 24;
|
|
9
|
+
var w = d * 7;
|
|
10
|
+
var y = d * 365.25;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Parse or format the given `val`.
|
|
14
|
+
*
|
|
15
|
+
* Options:
|
|
16
|
+
*
|
|
17
|
+
* - `long` verbose formatting [false]
|
|
18
|
+
*
|
|
19
|
+
* @param {String|Number} val
|
|
20
|
+
* @param {Object} [options]
|
|
21
|
+
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
22
|
+
* @return {String|Number}
|
|
23
|
+
* @api public
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
module.exports = function (val, options) {
|
|
27
|
+
options = options || {};
|
|
28
|
+
var type = typeof val;
|
|
29
|
+
if (type === 'string' && val.length > 0) {
|
|
30
|
+
return parse(val);
|
|
31
|
+
} else if (type === 'number' && isFinite(val)) {
|
|
32
|
+
return options.long ? fmtLong(val) : fmtShort(val);
|
|
33
|
+
}
|
|
34
|
+
throw new Error(
|
|
35
|
+
'val is not a non-empty string or a valid number. val=' +
|
|
36
|
+
JSON.stringify(val)
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Parse the given `str` and return milliseconds.
|
|
42
|
+
*
|
|
43
|
+
* @param {String} str
|
|
44
|
+
* @return {Number}
|
|
45
|
+
* @api private
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
function parse(str) {
|
|
49
|
+
str = String(str);
|
|
50
|
+
if (str.length > 100) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
|
|
54
|
+
str
|
|
55
|
+
);
|
|
56
|
+
if (!match) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
var n = parseFloat(match[1]);
|
|
60
|
+
var type = (match[2] || 'ms').toLowerCase();
|
|
61
|
+
switch (type) {
|
|
62
|
+
case 'years':
|
|
63
|
+
case 'year':
|
|
64
|
+
case 'yrs':
|
|
65
|
+
case 'yr':
|
|
66
|
+
case 'y':
|
|
67
|
+
return n * y;
|
|
68
|
+
case 'weeks':
|
|
69
|
+
case 'week':
|
|
70
|
+
case 'w':
|
|
71
|
+
return n * w;
|
|
72
|
+
case 'days':
|
|
73
|
+
case 'day':
|
|
74
|
+
case 'd':
|
|
75
|
+
return n * d;
|
|
76
|
+
case 'hours':
|
|
77
|
+
case 'hour':
|
|
78
|
+
case 'hrs':
|
|
79
|
+
case 'hr':
|
|
80
|
+
case 'h':
|
|
81
|
+
return n * h;
|
|
82
|
+
case 'minutes':
|
|
83
|
+
case 'minute':
|
|
84
|
+
case 'mins':
|
|
85
|
+
case 'min':
|
|
86
|
+
case 'm':
|
|
87
|
+
return n * m;
|
|
88
|
+
case 'seconds':
|
|
89
|
+
case 'second':
|
|
90
|
+
case 'secs':
|
|
91
|
+
case 'sec':
|
|
92
|
+
case 's':
|
|
93
|
+
return n * s;
|
|
94
|
+
case 'milliseconds':
|
|
95
|
+
case 'millisecond':
|
|
96
|
+
case 'msecs':
|
|
97
|
+
case 'msec':
|
|
98
|
+
case 'ms':
|
|
99
|
+
return n;
|
|
100
|
+
default:
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Short format for `ms`.
|
|
107
|
+
*
|
|
108
|
+
* @param {Number} ms
|
|
109
|
+
* @return {String}
|
|
110
|
+
* @api private
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
function fmtShort(ms) {
|
|
114
|
+
var msAbs = Math.abs(ms);
|
|
115
|
+
if (msAbs >= d) {
|
|
116
|
+
return Math.round(ms / d) + 'd';
|
|
117
|
+
}
|
|
118
|
+
if (msAbs >= h) {
|
|
119
|
+
return Math.round(ms / h) + 'h';
|
|
120
|
+
}
|
|
121
|
+
if (msAbs >= m) {
|
|
122
|
+
return Math.round(ms / m) + 'm';
|
|
123
|
+
}
|
|
124
|
+
if (msAbs >= s) {
|
|
125
|
+
return Math.round(ms / s) + 's';
|
|
126
|
+
}
|
|
127
|
+
return ms + 'ms';
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Long format for `ms`.
|
|
132
|
+
*
|
|
133
|
+
* @param {Number} ms
|
|
134
|
+
* @return {String}
|
|
135
|
+
* @api private
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
function fmtLong(ms) {
|
|
139
|
+
var msAbs = Math.abs(ms);
|
|
140
|
+
if (msAbs >= d) {
|
|
141
|
+
return plural(ms, msAbs, d, 'day');
|
|
142
|
+
}
|
|
143
|
+
if (msAbs >= h) {
|
|
144
|
+
return plural(ms, msAbs, h, 'hour');
|
|
145
|
+
}
|
|
146
|
+
if (msAbs >= m) {
|
|
147
|
+
return plural(ms, msAbs, m, 'minute');
|
|
148
|
+
}
|
|
149
|
+
if (msAbs >= s) {
|
|
150
|
+
return plural(ms, msAbs, s, 'second');
|
|
151
|
+
}
|
|
152
|
+
return ms + ' ms';
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Pluralization helper.
|
|
157
|
+
*/
|
|
158
|
+
|
|
159
|
+
function plural(ms, msAbs, n, name) {
|
|
160
|
+
var isPlural = msAbs >= n * 1.5;
|
|
161
|
+
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
|
162
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Vercel, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ms",
|
|
3
|
+
"version": "2.1.3",
|
|
4
|
+
"description": "Tiny millisecond conversion utility",
|
|
5
|
+
"repository": "vercel/ms",
|
|
6
|
+
"main": "./index",
|
|
7
|
+
"files": [
|
|
8
|
+
"index.js"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"precommit": "lint-staged",
|
|
12
|
+
"lint": "eslint lib/* bin/*",
|
|
13
|
+
"test": "mocha tests.js"
|
|
14
|
+
},
|
|
15
|
+
"eslintConfig": {
|
|
16
|
+
"extends": "eslint:recommended",
|
|
17
|
+
"env": {
|
|
18
|
+
"node": true,
|
|
19
|
+
"es6": true
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"lint-staged": {
|
|
23
|
+
"*.js": [
|
|
24
|
+
"npm run lint",
|
|
25
|
+
"prettier --single-quote --write",
|
|
26
|
+
"git add"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"eslint": "4.18.2",
|
|
32
|
+
"expect.js": "0.3.1",
|
|
33
|
+
"husky": "0.14.3",
|
|
34
|
+
"lint-staged": "5.0.0",
|
|
35
|
+
"mocha": "4.0.1",
|
|
36
|
+
"prettier": "2.0.5"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# ms
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
Use this package to easily convert various time formats to milliseconds.
|
|
6
|
+
|
|
7
|
+
## Examples
|
|
8
|
+
|
|
9
|
+
```js
|
|
10
|
+
ms('2 days') // 172800000
|
|
11
|
+
ms('1d') // 86400000
|
|
12
|
+
ms('10h') // 36000000
|
|
13
|
+
ms('2.5 hrs') // 9000000
|
|
14
|
+
ms('2h') // 7200000
|
|
15
|
+
ms('1m') // 60000
|
|
16
|
+
ms('5s') // 5000
|
|
17
|
+
ms('1y') // 31557600000
|
|
18
|
+
ms('100') // 100
|
|
19
|
+
ms('-3 days') // -259200000
|
|
20
|
+
ms('-1h') // -3600000
|
|
21
|
+
ms('-200') // -200
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Convert from Milliseconds
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
ms(60000) // "1m"
|
|
28
|
+
ms(2 * 60000) // "2m"
|
|
29
|
+
ms(-3 * 60000) // "-3m"
|
|
30
|
+
ms(ms('10 hours')) // "10h"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Time Format Written-Out
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
ms(60000, { long: true }) // "1 minute"
|
|
37
|
+
ms(2 * 60000, { long: true }) // "2 minutes"
|
|
38
|
+
ms(-3 * 60000, { long: true }) // "-3 minutes"
|
|
39
|
+
ms(ms('10 hours'), { long: true }) // "10 hours"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Features
|
|
43
|
+
|
|
44
|
+
- Works both in [Node.js](https://nodejs.org) and in the browser
|
|
45
|
+
- If a number is supplied to `ms`, a string with a unit is returned
|
|
46
|
+
- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`)
|
|
47
|
+
- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned
|
|
48
|
+
|
|
49
|
+
## Related Packages
|
|
50
|
+
|
|
51
|
+
- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time.
|
|
52
|
+
|
|
53
|
+
## Caught a Bug?
|
|
54
|
+
|
|
55
|
+
1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device
|
|
56
|
+
2. Link the package to the global module directory: `npm link`
|
|
57
|
+
3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms!
|
|
58
|
+
|
|
59
|
+
As always, you can run the tests using: `npm test`
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Copyright (c) 2024, Mapbox
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
* Neither the name of pbf nor the names of its
|
|
15
|
+
contributors may be used to endorse or promote products derived from
|
|
16
|
+
this software without specific prior written permission.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
19
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
20
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
22
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
23
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
24
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
25
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
26
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|