mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 13:31:54 +00:00
clean up browser extension webpack build (#57229)
* use single-file entrypoints for browser ext webpack config This is more standard and puts more of the config in code not config. This also makes it easier to support esbuild builds for the browser extension (esbuild does not support multiple sources for an entrypoint, because such behavior is undefined except by webpack, and who knows what it does). * use different file basenames for native & phabricator integrations This makes it easier (in the future) to simplify our bundler config for the browser extension because some bundlers (esbuild via Bazel, for example) do not support 2 entrypoints with the same file basename. * name entrypoint bundles after their entrypoint, not a custom name This removes another source of "names" and also makes it so that the browser extension can be built by esbuild via Bazel in the future (which does not support renaming entrypoints). Also remove Webpack auto-reloading because its implementation depended on this. There is a workaround, but the intent is to remove Webpack for bext builds, so it's not worth keeping it.
This commit is contained in:
parent
cbac3c6390
commit
6456733516
@ -149,9 +149,14 @@ ts_project(
|
||||
"src/browser-extension/web-extension-api/runtime.ts",
|
||||
"src/browser-extension/web-extension-api/storage.ts",
|
||||
"src/browser-extension/web-extension-api/types.ts",
|
||||
"src/config/background.entry.ts",
|
||||
"src/config/content.entry.ts",
|
||||
"src/config/extension.entry.ts",
|
||||
"src/config/options.entry.ts",
|
||||
"src/config/page.entry.ts",
|
||||
"src/globals.d.ts",
|
||||
"src/native-integration/integration.main.ts",
|
||||
"src/native-integration/phabricator/integration.main.ts",
|
||||
"src/native-integration/nativeIntegration.main.ts",
|
||||
"src/native-integration/phabricator/phabricatorNativeIntegration.main.ts",
|
||||
"src/native-integration/phabricator/util.ts",
|
||||
"src/shared/backend/diffs.tsx",
|
||||
"src/shared/backend/extension-api-conversion.tsx",
|
||||
@ -361,18 +366,15 @@ webpack_bundle(
|
||||
# STATIC ASSSETS
|
||||
"//client/browser/assets",
|
||||
],
|
||||
# HACK: these entry-points are duplicated in the webpack config
|
||||
# because rule_webpack does not support multi-main entry-points (defined by arrays)
|
||||
# but it mirror ouptut files list defined in the webpack config.
|
||||
entry_points = {
|
||||
"src/browser-extension/scripts/backgroundPage.main.js": "background",
|
||||
"src/browser-extension/scripts/contentPage.main.js": "inject",
|
||||
"src/browser-extension/scripts/optionsPage.main.js": "options",
|
||||
"src/browser-extension/scripts/afterInstallPage.main.js": "after-install",
|
||||
"src/native-integration/integration.main.js": "integration",
|
||||
"src/native-integration/phabricator/integration.main.js": "phabricator",
|
||||
"src/app.css": "style",
|
||||
"src/branded.css": "branded-style",
|
||||
"src/browser-extension/scripts/backgroundPage.main.js": "backgroundPage.main",
|
||||
"src/browser-extension/scripts/contentPage.main.js": "contentPage.main",
|
||||
"src/browser-extension/scripts/optionsPage.main.js": "optionsPage.main",
|
||||
"src/browser-extension/scripts/afterInstallPage.main.js": "afterInstallPage.main",
|
||||
"src/native-integration/nativeIntegration.main.js": "nativeIntegration.main",
|
||||
"src/native-integration/phabricator/phabricatorNativeIntegration.main.js": "phabricatorNativeIntegration.main",
|
||||
"src/app.css": "app",
|
||||
"src/branded.css": "branded",
|
||||
},
|
||||
env = {
|
||||
"NODE_ENV": "production",
|
||||
|
||||
@ -24,8 +24,8 @@ The tooltips include features like:
|
||||
|
||||
It works as follows:
|
||||
|
||||
- when visiting e.g. https://github.com/..., the extension injects a content script (inject.bundle.js)
|
||||
- there is a background script running to access certain chrome APIs, like storage (background.bundle.js)
|
||||
- when visiting e.g. https://github.com/..., the extension injects a content script (contentPage.main.bundle.js)
|
||||
- there is a background script running to access certain chrome APIs, like storage (backgroundPage.main.bundle.js)
|
||||
- a "code view" contains rendered (syntax highlighted) code (in an HTML table); the extension adds event listeners to the code view which control the tooltip
|
||||
- when the user mouses over a code table cell, the extension modifies the DOM node:
|
||||
- text nodes are wrapped in `<span>` (so hover/click events have appropriate specificity)
|
||||
@ -85,7 +85,7 @@ Now, follow the steps below for the browser you intend to work with.
|
||||
- If you already have the Sourcegraph extension installed, disable it using the toggle.
|
||||
- Enable 'developer mode', click on [Load unpacked extensions](https://developer.chrome.com/extensions/getstarted#unpacked), save it in the `sourcegraph/client/browser/build/chrome` folder.
|
||||
- Browse to any public repository on GitHub to confirm it is working.
|
||||
- After making changes it is sometimes necessary to refresh the extension. This is done by going to [chrome://extensions](chrome://extensions) and clicking the "Reload" icon.
|
||||
- After making changes, it is necessary to refresh the extension. This is done by going to [chrome://extensions](chrome://extensions) and clicking the "Reload" icon.
|
||||
|
||||

|
||||
|
||||
@ -93,27 +93,6 @@ Now, follow the steps below for the browser you intend to work with.
|
||||
|
||||
Click reload for Sourcegraph at `chrome://extensions`
|
||||
|
||||
### Firefox (hot reloading)
|
||||
|
||||
In a separate terminal session run:
|
||||
|
||||
```bash
|
||||
pnpm global add web-ext
|
||||
pnpm run dev:firefox
|
||||
```
|
||||
|
||||
A Firefox window will be spun up with the extension already installed.
|
||||
|
||||
#### Updating the bundle
|
||||
|
||||
Save a file and wait for webpack to finish rebuilding.
|
||||
|
||||
#### Caveats
|
||||
|
||||
The window that is spun up is completely separate from any existing sessions you have on Firefox.
|
||||
You'll have to sign into everything at the beginning of each development session(each time you run `pnpm run dev:firefox`).
|
||||
You should ensure you're signed into any Sourcegraph instance you point the extension at as well as GitHub.
|
||||
|
||||
### Firefox (manual)
|
||||
|
||||
- Go to `about:debugging`
|
||||
|
||||
@ -9,7 +9,6 @@ load("@aspect_rules_js//js:defs.bzl", "js_library")
|
||||
ts_project(
|
||||
name = "config",
|
||||
srcs = [
|
||||
"webpack/auto-reloading.ts",
|
||||
"webpack/base.config.bazel.ts",
|
||||
"webpack/base.config.ts",
|
||||
"webpack/development.config.ts",
|
||||
@ -23,14 +22,12 @@ ts_project(
|
||||
deps = [
|
||||
"//:node_modules/@babel/runtime", #keep
|
||||
"//:node_modules/@types/node",
|
||||
"//:node_modules/@types/socket.io-client",
|
||||
"//:node_modules/css-loader", #keep
|
||||
"//:node_modules/css-minimizer-webpack-plugin",
|
||||
"//:node_modules/mini-css-extract-plugin",
|
||||
# HACKS: bundle-time css import
|
||||
"//:node_modules/open-color", #keep
|
||||
"//:node_modules/path-browserify", #keep
|
||||
"//:node_modules/socket.io-client",
|
||||
"//:node_modules/style-loader", #keep
|
||||
"//:node_modules/terser-webpack-plugin",
|
||||
"//:node_modules/webpack",
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
import socketIoClient from 'socket.io-client'
|
||||
|
||||
/**
|
||||
* Reloads the extension when notified from the development server. Only enabled
|
||||
* during development when `process.env.AUTO_RELOAD !== 'false'.
|
||||
*/
|
||||
async function main(): Promise<void> {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
const self = await browser.management.getSelf()
|
||||
if (self.installType === 'development') {
|
||||
// Since the port is hard-coded, it must match scripts/dev.ts
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
socketIoClient.connect('http://localhost:8890').on('file.change', () => browser.runtime.reload())
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(console.error.bind(console))
|
||||
@ -12,13 +12,7 @@ import {
|
||||
getCSSModulesLoader,
|
||||
} from '@sourcegraph/build-config'
|
||||
|
||||
export const browserWorkspacePath = path.resolve(process.cwd(), 'client/browser')
|
||||
const browserSourcePath = path.resolve(browserWorkspacePath, 'src')
|
||||
const contentEntry = path.resolve(browserSourcePath, 'config/content.entry.js')
|
||||
const backgroundEntry = path.resolve(browserSourcePath, 'config/background.entry.js')
|
||||
const optionsEntry = path.resolve(browserSourcePath, 'config/options.entry.js')
|
||||
const pageEntry = path.resolve(browserSourcePath, 'config/page.entry.js')
|
||||
const extensionEntry = path.resolve(browserSourcePath, 'config/extension.entry.js')
|
||||
const browserWorkspacePath = path.resolve(process.cwd(), 'client/browser')
|
||||
|
||||
const JS_OUTPUT_FOLDER = 'scripts'
|
||||
const CSS_OUTPUT_FOLDER = 'css'
|
||||
@ -30,34 +24,6 @@ export const config = {
|
||||
children: true,
|
||||
},
|
||||
target: 'browserslist',
|
||||
entry: {
|
||||
// Browser extension
|
||||
background: [
|
||||
extensionEntry,
|
||||
backgroundEntry,
|
||||
path.resolve(browserSourcePath, 'browser-extension/scripts/backgroundPage.main.js'),
|
||||
],
|
||||
inject: [
|
||||
extensionEntry,
|
||||
contentEntry,
|
||||
path.resolve(browserSourcePath, 'browser-extension/scripts/contentPage.main.js'),
|
||||
],
|
||||
options: [
|
||||
extensionEntry,
|
||||
optionsEntry,
|
||||
path.resolve(browserSourcePath, 'browser-extension/scripts/optionsPage.main.js'),
|
||||
],
|
||||
'after-install': path.resolve(browserSourcePath, 'browser-extension/scripts/afterInstallPage.main.js'),
|
||||
|
||||
// Common native integration entry point (Gitlab, Bitbucket)
|
||||
integration: [pageEntry, path.resolve(browserSourcePath, 'native-integration/integration.main.js')],
|
||||
// Phabricator-only native integration entry point
|
||||
phabricator: [pageEntry, path.resolve(browserSourcePath, 'native-integration/phabricator/integration.main.js')],
|
||||
|
||||
// Styles
|
||||
style: path.join(browserSourcePath, 'app.scss'),
|
||||
'branded-style': path.join(browserSourcePath, 'branded.scss'),
|
||||
},
|
||||
output: {
|
||||
path: path.join(browserWorkspacePath, 'build/dist/js'),
|
||||
filename: `${JS_OUTPUT_FOLDER}/[name].bundle.js`,
|
||||
|
||||
@ -17,44 +17,27 @@ import {
|
||||
|
||||
export const browserWorkspacePath = path.resolve(ROOT_PATH, 'client/browser')
|
||||
const browserSourcePath = path.resolve(browserWorkspacePath, 'src')
|
||||
const contentEntry = path.resolve(browserSourcePath, 'config/content.entry.js')
|
||||
const backgroundEntry = path.resolve(browserSourcePath, 'config/background.entry.js')
|
||||
const optionsEntry = path.resolve(browserSourcePath, 'config/options.entry.js')
|
||||
const pageEntry = path.resolve(browserSourcePath, 'config/page.entry.js')
|
||||
const extensionEntry = path.resolve(browserSourcePath, 'config/extension.entry.js')
|
||||
|
||||
const extensionHostWorker = /main\.worker\.ts$/
|
||||
|
||||
export const config = {
|
||||
target: 'browserslist',
|
||||
entry: {
|
||||
entry: [
|
||||
// Browser extension
|
||||
background: [
|
||||
extensionEntry,
|
||||
backgroundEntry,
|
||||
path.resolve(browserSourcePath, 'browser-extension/scripts/backgroundPage.main.ts'),
|
||||
],
|
||||
inject: [
|
||||
extensionEntry,
|
||||
contentEntry,
|
||||
path.resolve(browserSourcePath, 'browser-extension/scripts/contentPage.main.ts'),
|
||||
],
|
||||
options: [
|
||||
extensionEntry,
|
||||
optionsEntry,
|
||||
path.resolve(browserSourcePath, 'browser-extension/scripts/optionsPage.main.tsx'),
|
||||
],
|
||||
'after-install': path.resolve(browserSourcePath, 'browser-extension/scripts/afterInstallPage.main.tsx'),
|
||||
path.resolve(browserSourcePath, 'browser-extension/scripts/backgroundPage.main.ts'),
|
||||
path.resolve(browserSourcePath, 'browser-extension/scripts/contentPage.main.ts'),
|
||||
path.resolve(browserSourcePath, 'browser-extension/scripts/optionsPage.main.tsx'),
|
||||
path.resolve(browserSourcePath, 'browser-extension/scripts/afterInstallPage.main.tsx'),
|
||||
|
||||
// Common native integration entry point (Gitlab, Bitbucket)
|
||||
integration: [pageEntry, path.resolve(browserSourcePath, 'native-integration/integration.main.ts')],
|
||||
path.resolve(browserSourcePath, 'native-integration/nativeIntegration.main.ts'),
|
||||
// Phabricator-only native integration entry point
|
||||
phabricator: [pageEntry, path.resolve(browserSourcePath, 'native-integration/phabricator/integration.main.ts')],
|
||||
path.resolve(browserSourcePath, 'native-integration/phabricator/phabricatorNativeIntegration.main.ts'),
|
||||
|
||||
// Styles
|
||||
style: path.join(browserSourcePath, 'app.scss'),
|
||||
'branded-style': path.join(browserSourcePath, 'branded.scss'),
|
||||
},
|
||||
path.join(browserSourcePath, 'app.scss'),
|
||||
path.join(browserSourcePath, 'branded.scss'),
|
||||
],
|
||||
output: {
|
||||
path: path.join(browserWorkspacePath, 'build/dist/js'),
|
||||
filename: '[name].bundle.js',
|
||||
|
||||
@ -7,16 +7,10 @@ import { getCacheConfig } from '@sourcegraph/build-config'
|
||||
import { config as baseConfig, browserWorkspacePath } from './base.config'
|
||||
import { generateBundleUID } from './utils'
|
||||
|
||||
const { plugins, entry: entries, ...base } = baseConfig
|
||||
|
||||
const entriesWithAutoReload = {
|
||||
...entries,
|
||||
background: [path.join(__dirname, 'auto-reloading.ts'), ...entries.background],
|
||||
}
|
||||
const { plugins, ...base } = baseConfig
|
||||
|
||||
export const config: webpack.Configuration = {
|
||||
...base,
|
||||
entry: process.env.AUTO_RELOAD === 'false' ? entries : entriesWithAutoReload,
|
||||
mode: 'development',
|
||||
// Use cache only in `development` mode to speed up production build.
|
||||
cache: getCacheConfig({ invalidateCacheFiles: [path.resolve(browserWorkspacePath, 'babel.config.js')] }),
|
||||
|
||||
@ -1,36 +0,0 @@
|
||||
import signale from 'signale'
|
||||
import { Server } from 'socket.io'
|
||||
|
||||
/**
|
||||
* Returns a trigger function that notifies the extension to reload itself.
|
||||
*/
|
||||
export const initializeServer = (): (() => void) => {
|
||||
const logger = new signale.Signale({ scope: 'Auto reloading' })
|
||||
logger.config({ displayTimestamp: true })
|
||||
|
||||
// Since this port is hard-coded, it must match background.ts
|
||||
const socketIOServer = new Server(8890, {
|
||||
cors: {
|
||||
origin: '*',
|
||||
},
|
||||
})
|
||||
logger.await('Ready for a browser extension to connect')
|
||||
socketIOServer.on('connect', () => {
|
||||
logger.info('Browser extension connected')
|
||||
})
|
||||
socketIOServer.on('disconnect', () => {
|
||||
logger.info('Browser extension disconnected')
|
||||
})
|
||||
|
||||
return () => {
|
||||
if (socketIOServer.engine.clientsCount === 0) {
|
||||
logger.warn('No browser extension has connected yet, so no reload was triggered')
|
||||
logger.warn("- Make sure it's enabled")
|
||||
logger.warn("- Make sure it's in developer mode (unpacked extension)")
|
||||
logger.warn('- Try manually reloading it 🔄')
|
||||
} else {
|
||||
logger.info('Triggering a reload of browser extensions')
|
||||
socketIOServer.emit('file.change', {})
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,16 +1,12 @@
|
||||
import { noop } from 'lodash'
|
||||
import signale from 'signale'
|
||||
import webpack from 'webpack'
|
||||
|
||||
import { config } from '../config/webpack/development.config'
|
||||
|
||||
import * as autoReloading from './auto-reloading'
|
||||
import * as tasks from './tasks'
|
||||
|
||||
signale.config({ displayTimestamp: true })
|
||||
|
||||
const triggerReload = process.env.AUTO_RELOAD === 'false' ? noop : autoReloading.initializeServer()
|
||||
|
||||
const buildChrome = tasks.buildChrome('dev')
|
||||
const buildFirefox = tasks.buildFirefox('dev')
|
||||
const buildEdge = tasks.buildEdge('dev')
|
||||
@ -40,6 +36,5 @@ compiler.watch(
|
||||
buildEdge()
|
||||
buildFirefox()
|
||||
tasks.copyIntegrationAssets()
|
||||
triggerReload()
|
||||
}
|
||||
)
|
||||
|
||||
@ -119,11 +119,21 @@ export function copyInlineExtensions(toDirectory: string): void {
|
||||
export function copyIntegrationAssets(): void {
|
||||
shelljs.mkdir('-p', 'build/integration/scripts')
|
||||
shelljs.mkdir('-p', 'build/integration/css')
|
||||
shelljs.cp('build/dist/js/phabricator.bundle.js', 'build/integration/scripts')
|
||||
shelljs.cp('build/dist/js/integration.bundle.js', 'build/integration/scripts')
|
||||
|
||||
// The destination filename is hardcoded in
|
||||
// https://sourcegraph.com/github.com/sourcegraph/phabricator-extension@master/-/blob/src/application/SourcegraphApplication.php?L33.
|
||||
shelljs.cp(
|
||||
'build/dist/js/phabricatorNativeIntegration.main.bundle.js',
|
||||
'build/integration/scripts/phabricator.bundle.js'
|
||||
)
|
||||
|
||||
// The destination filename is hardcoded in
|
||||
// https://sourcegraph.com/github.com/sourcegraph/bitbucket-server-plugin@master/-/blob/src/main/resources/js/sourcegraph-bitbucket.js?L23:52.
|
||||
shelljs.cp('build/dist/js/nativeIntegration.main.bundle.js', 'build/integration/scripts/integration.bundle.js')
|
||||
|
||||
shelljs.cp('build/dist/js/extensionHostWorker.bundle.js', 'build/integration/scripts')
|
||||
shelljs.cp('build/dist/css/style.bundle.css', 'build/integration/css')
|
||||
shelljs.cp('build/dist/css/inject.bundle.css', 'build/integration/css')
|
||||
shelljs.cp('build/dist/css/app.bundle.css', 'build/integration/css')
|
||||
shelljs.cp('build/dist/css/contentPage.main.bundle.css', 'build/integration/css')
|
||||
shelljs.cp('src/native-integration/extensionHostFrame.html', 'build/integration')
|
||||
copyInlineExtensions('build/integration')
|
||||
// Copy to the ui/assets directory so that these files can be served by
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
"128": "img/icon-128.png"
|
||||
},
|
||||
"background": {
|
||||
"scripts": ["js/background.bundle.js"]
|
||||
"scripts": ["js/backgroundPage.main.bundle.js"]
|
||||
},
|
||||
"options_ui": {
|
||||
"page": "options.html",
|
||||
|
||||
@ -4,12 +4,12 @@
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||||
<title>Sourcegraph browser extension</title>
|
||||
<meta name="color-scheme" content="light dark" />
|
||||
<link href="./css/branded-style.bundle.css" rel="stylesheet" type="text/css" />
|
||||
<link href="./css/after-install.bundle.css" rel="stylesheet" type="text/css" />
|
||||
<link href="./css/branded.bundle.css" rel="stylesheet" type="text/css" />
|
||||
<link href="./css/afterInstallPage.main.bundle.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<noscript>You must enable JavaScript for the Sourcegraph browser extension to work.</noscript>
|
||||
<script type="text/javascript" src="./js/after-install.bundle.js"></script>
|
||||
<script type="text/javascript" src="./js/afterInstallPage.main.bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -4,10 +4,10 @@
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
||||
<title>Sourcegraph extension</title>
|
||||
<meta name="color-scheme" content="light dark" />
|
||||
<link href="./css/branded-style.bundle.css" rel="stylesheet" type="text/css" />
|
||||
<link href="./css/options.bundle.css" rel="stylesheet" type="text/css" />
|
||||
<link href="./css/branded.bundle.css" rel="stylesheet" type="text/css" />
|
||||
<link href="./css/optionsPage.main.bundle.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript" src="./js/options.bundle.js"></script>
|
||||
<script type="text/javascript" src="./js/optionsPage.main.bundle.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
// We want to polyfill first.
|
||||
// Set globals first before any imports.
|
||||
import '../../config/extension.entry'
|
||||
import '../../config/background.entry'
|
||||
// Polyfill before other imports.
|
||||
import '../../shared/polyfills'
|
||||
|
||||
import type { Endpoint } from 'comlink'
|
||||
@ -204,7 +207,7 @@ async function main(): Promise<void> {
|
||||
* See https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Content_scripts#loading_content_scripts
|
||||
*/
|
||||
await browser.tabs.executeScript(tabId, {
|
||||
file: 'js/inject.bundle.js',
|
||||
file: 'js/contentPage.main.bundle.js',
|
||||
runAt: 'document_end',
|
||||
})
|
||||
}
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
// Set globals first before any imports.
|
||||
import '../../config/extension.entry'
|
||||
import '../../config/content.entry'
|
||||
// Polyfill before other imports.
|
||||
import '../../shared/polyfills'
|
||||
|
||||
import { fromEvent, Subscription } from 'rxjs'
|
||||
@ -113,11 +117,11 @@ async function main(): Promise<void> {
|
||||
const styleSheets = [
|
||||
{
|
||||
id: 'ext-style-sheet',
|
||||
path: 'css/style.bundle.css',
|
||||
path: 'css/app.bundle.css',
|
||||
},
|
||||
{
|
||||
id: 'ext-style-sheet-css-modules',
|
||||
path: 'css/inject.bundle.css',
|
||||
path: 'css/contentPage.main.bundle.css',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
// We want to polyfill first.
|
||||
// Set globals first before any imports.
|
||||
import '../../config/extension.entry'
|
||||
import '../../config/options.entry'
|
||||
// Polyfill before other imports.
|
||||
import '../../shared/polyfills'
|
||||
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
// Set globals first before any imports.
|
||||
import '../config/page.entry'
|
||||
// Polyfill before other imports.
|
||||
import '@sourcegraph/shared/src/polyfills'
|
||||
|
||||
import { setLinkComponent, AnchorLink } from '@sourcegraph/wildcard'
|
||||
@ -45,8 +48,8 @@ function init(): void {
|
||||
} else {
|
||||
injectExtensionMarker()
|
||||
}
|
||||
insertStyleSheet({ id: 'sourcegraph-styles', path: 'css/style.bundle.css', assetsURL })
|
||||
insertStyleSheet({ id: 'sourcegraph-styles-css-modules', path: 'css/inject.bundle.css', assetsURL })
|
||||
insertStyleSheet({ id: 'sourcegraph-styles', path: 'css/app.bundle.css', assetsURL })
|
||||
insertStyleSheet({ id: 'sourcegraph-styles-css-modules', path: 'css/contentPage.main.bundle.css', assetsURL })
|
||||
window.localStorage.setItem('SOURCEGRAPH_URL', sourcegraphURL)
|
||||
window.SOURCEGRAPH_URL = sourcegraphURL
|
||||
// TODO handle subscription
|
||||
@ -1,3 +1,6 @@
|
||||
// Set globals first before any imports.
|
||||
import '../../config/page.entry'
|
||||
// Polyfill before other imports.
|
||||
import '@sourcegraph/shared/src/polyfills'
|
||||
|
||||
import { setLinkComponent, AnchorLink } from '@sourcegraph/wildcard'
|
||||
@ -65,11 +68,11 @@ async function init(): Promise<void> {
|
||||
const styleSheets = [
|
||||
{
|
||||
id: 'sourcegraph-styles',
|
||||
cssURL: sourcegraphURL + '/.assets/extension/css/style.bundle.css',
|
||||
cssURL: sourcegraphURL + '/.assets/extension/css/app.bundle.css',
|
||||
},
|
||||
{
|
||||
id: 'sourcegraph-styles-css-modules',
|
||||
cssURL: sourcegraphURL + '/.assets/extension/css/inject.bundle.css',
|
||||
cssURL: sourcegraphURL + '/.assets/extension/css/contentPage.main.bundle.css',
|
||||
},
|
||||
]
|
||||
await Promise.all(styleSheets.map(appendHeadStyles))
|
||||
@ -13,8 +13,8 @@ describe('Native integrations regression test suite', () => {
|
||||
'/.assets/extension/scripts/integration.bundle.js',
|
||||
'/.assets/extension/scripts/phabricator.bundle.js',
|
||||
'/.assets/extension/scripts/extensionHostWorker.bundle.js',
|
||||
'/.assets/extension/css/style.bundle.css',
|
||||
'/.assets/extension/css/inject.bundle.css',
|
||||
'/.assets/extension/css/app.bundle.css',
|
||||
'/.assets/extension/css/contentPage.main.bundle.css',
|
||||
'/.assets/extension/extensionHostFrame.html',
|
||||
]
|
||||
await merge(
|
||||
|
||||
@ -215,7 +215,6 @@
|
||||
"@types/signale": "1.4.1",
|
||||
"@types/simmerjs": "0.5.1",
|
||||
"@types/sinon": "9.0.4",
|
||||
"@types/socket.io-client": "1.4.33",
|
||||
"@types/speed-measure-webpack-plugin": "1.3.4",
|
||||
"@types/stream-json": "^1.7.3",
|
||||
"@types/svgo": "2.6.0",
|
||||
@ -314,8 +313,6 @@
|
||||
"signale": "^1.4.0",
|
||||
"simmerjs": "^0.5.6",
|
||||
"sinon": "^9.0.2",
|
||||
"socket.io": "^4.5.2",
|
||||
"socket.io-client": "^4.5.2",
|
||||
"sourcegraph": "workspace:*",
|
||||
"speed-measure-webpack-plugin": "^1.5.0",
|
||||
"storybook-addon-designs": "^6.3.1",
|
||||
|
||||
127
pnpm-lock.yaml
127
pnpm-lock.yaml
@ -849,9 +849,6 @@ importers:
|
||||
'@types/sinon':
|
||||
specifier: 9.0.4
|
||||
version: 9.0.4
|
||||
'@types/socket.io-client':
|
||||
specifier: 1.4.33
|
||||
version: 1.4.33
|
||||
'@types/speed-measure-webpack-plugin':
|
||||
specifier: 1.3.4
|
||||
version: 1.3.4(esbuild@0.17.14)(webpack-cli@5.0.1)
|
||||
@ -1143,12 +1140,6 @@ importers:
|
||||
sinon:
|
||||
specifier: ^9.0.2
|
||||
version: 9.0.2
|
||||
socket.io:
|
||||
specifier: ^4.5.2
|
||||
version: 4.5.2
|
||||
socket.io-client:
|
||||
specifier: ^4.5.2
|
||||
version: 4.5.2
|
||||
sourcegraph:
|
||||
specifier: workspace:*
|
||||
version: link:client/extension-api
|
||||
@ -9308,10 +9299,6 @@ packages:
|
||||
lodash.values: 4.3.0
|
||||
dev: true
|
||||
|
||||
/@socket.io/component-emitter@3.1.0:
|
||||
resolution: {integrity: sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==}
|
||||
dev: true
|
||||
|
||||
/@sourcegraph/codemod-cli@1.0.0:
|
||||
resolution: {integrity: sha512-qT9b1zyW/fa5h9v5UTkmGokqyoriTgTtZY2oHKyXsCbekdlbd1WJ+tXBHpsLRGOuBTGfjv1hIHcXeWdBi7j9Eg==}
|
||||
hasBin: true
|
||||
@ -12595,10 +12582,6 @@ packages:
|
||||
resolution: {integrity: sha512-COUnqfB2+ckwXXSFInsFdOAWQzCCx+a5hq2ruyj+Vjund94RJQd4LG2u9hnvJrTgunKAaax7ancBYlDrNYxA0g==}
|
||||
dev: true
|
||||
|
||||
/@types/cors@2.8.12:
|
||||
resolution: {integrity: sha512-vt+kDhq/M2ayberEtJcIN/hxXy1Pk+59g2FV/ZQceeaTyCtCucjL2Q7FXlFjtWn4n15KCr1NE2lNNFhp0lEThw==}
|
||||
dev: true
|
||||
|
||||
/@types/cross-spawn@6.0.2:
|
||||
resolution: {integrity: sha512-KuwNhp3eza+Rhu8IFI5HUXRP0LIhqH5cAjubUvGXXthh4YYBuP2ntwEX+Cz8GJoZUHlKo247wPWOfA9LYEq4cw==}
|
||||
dependencies:
|
||||
@ -13253,10 +13236,6 @@ packages:
|
||||
resolution: {integrity: sha512-yYezQwGWty8ziyYLdZjwxyMb0CZR49h8JALHGrxjQHWlqGgc8kLdHEgWrgL0uZ29DMvEVBDnHU2Wg36zKSIUtA==}
|
||||
dev: true
|
||||
|
||||
/@types/socket.io-client@1.4.33:
|
||||
resolution: {integrity: sha512-m4LnxkljsI9fMsjwpW5QhRpMixo2BeeLpFmg0AE+sS4H1pzAd/cs/ftTiL60FLZgfFa8PFRPx5KsHu8O0bADKQ==}
|
||||
dev: true
|
||||
|
||||
/@types/sockjs@0.3.33:
|
||||
resolution: {integrity: sha512-f0KEEe05NvUnat+boPTZ0dgaLZ4SfSouXUgv5noUiefG2ajgKjmETo9ZJyuqsl7dfl2aHlLJUiki6B4ZYldiiw==}
|
||||
dependencies:
|
||||
@ -15537,11 +15516,6 @@ packages:
|
||||
/base64-js@1.5.1:
|
||||
resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
|
||||
|
||||
/base64id@2.0.0:
|
||||
resolution: {integrity: sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==}
|
||||
engines: {node: ^4.5.0 || >= 5.9}
|
||||
dev: true
|
||||
|
||||
/base@0.11.2:
|
||||
resolution: {integrity: sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
@ -18863,45 +18837,6 @@ packages:
|
||||
objectorarray: 1.0.4
|
||||
dev: true
|
||||
|
||||
/engine.io-client@6.2.2:
|
||||
resolution: {integrity: sha512-8ZQmx0LQGRTYkHuogVZuGSpDqYZtCM/nv8zQ68VZ+JkOpazJ7ICdsSpaO6iXwvaU30oFg5QJOJWj8zWqhbKjkQ==}
|
||||
dependencies:
|
||||
'@socket.io/component-emitter': 3.1.0
|
||||
debug: 4.3.4
|
||||
engine.io-parser: 5.0.4
|
||||
ws: 8.2.3
|
||||
xmlhttprequest-ssl: 2.0.0
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- supports-color
|
||||
- utf-8-validate
|
||||
dev: true
|
||||
|
||||
/engine.io-parser@5.0.4:
|
||||
resolution: {integrity: sha512-+nVFp+5z1E3HcToEnO7ZIj3g+3k9389DvWtvJZz0T6/eOCPIyyxehFcedoYrZQrp0LgQbD9pPXhpMBKMd5QURg==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
dev: true
|
||||
|
||||
/engine.io@6.2.0:
|
||||
resolution: {integrity: sha512-4KzwW3F3bk+KlzSOY57fj/Jx6LyRQ1nbcyIadehl+AnXjKT7gDO0ORdRi/84ixvMKTym6ZKuxvbzN62HDDU1Lg==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
dependencies:
|
||||
'@types/cookie': 0.4.1
|
||||
'@types/cors': 2.8.12
|
||||
'@types/node': 18.17.15
|
||||
accepts: 1.3.8
|
||||
base64id: 2.0.0
|
||||
cookie: 0.4.2
|
||||
cors: 2.8.5
|
||||
debug: 4.3.4
|
||||
engine.io-parser: 5.0.4
|
||||
ws: 8.2.3
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- supports-color
|
||||
- utf-8-validate
|
||||
dev: true
|
||||
|
||||
/enhanced-resolve@5.10.0:
|
||||
resolution: {integrity: sha512-T0yTFjdpldGY8PmuXXR0PyQ1ufZpEGiHVrp7zHKB7jdR4qlmZHhONVM5AQOAWXuF/w3dnHbEQVrNptJgt7F+cQ==}
|
||||
engines: {node: '>=10.13.0'}
|
||||
@ -30960,50 +30895,6 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/socket.io-adapter@2.4.0:
|
||||
resolution: {integrity: sha512-W4N+o69rkMEGVuk2D/cvca3uYsvGlMwsySWV447y99gUPghxq42BxqLNMndb+a1mm/5/7NeXVQS7RLa2XyXvYg==}
|
||||
dev: true
|
||||
|
||||
/socket.io-client@4.5.2:
|
||||
resolution: {integrity: sha512-naqYfFu7CLDiQ1B7AlLhRXKX3gdeaIMfgigwavDzgJoIUYulc1qHH5+2XflTsXTPY7BlPH5rppJyUjhjrKQKLg==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
dependencies:
|
||||
'@socket.io/component-emitter': 3.1.0
|
||||
debug: 4.3.4
|
||||
engine.io-client: 6.2.2
|
||||
socket.io-parser: 4.2.1
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- supports-color
|
||||
- utf-8-validate
|
||||
dev: true
|
||||
|
||||
/socket.io-parser@4.2.1:
|
||||
resolution: {integrity: sha512-V4GrkLy+HeF1F/en3SpUaM+7XxYXpuMUWLGde1kSSh5nQMN4hLrbPIkD+otwh6q9R6NOQBN4AMaOZ2zVjui82g==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
dependencies:
|
||||
'@socket.io/component-emitter': 3.1.0
|
||||
debug: 4.3.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/socket.io@4.5.2:
|
||||
resolution: {integrity: sha512-6fCnk4ARMPZN448+SQcnn1u8OHUC72puJcNtSgg2xS34Cu7br1gQ09YKkO1PFfDn/wyUE9ZgMAwosJed003+NQ==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
dependencies:
|
||||
accepts: 1.3.8
|
||||
base64id: 2.0.0
|
||||
debug: 4.3.4
|
||||
engine.io: 6.2.0
|
||||
socket.io-adapter: 2.4.0
|
||||
socket.io-parser: 4.2.1
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- supports-color
|
||||
- utf-8-validate
|
||||
dev: true
|
||||
|
||||
/sockjs@0.3.24:
|
||||
resolution: {integrity: sha512-GJgLTZ7vYb/JtPSSZ10hsOYIvEYsjbNU+zPdIHcUaWVNUEPivzxku31865sSSud0Da0W4lEeOPlmw93zLQchuQ==}
|
||||
dependencies:
|
||||
@ -34653,19 +34544,6 @@ packages:
|
||||
utf-8-validate:
|
||||
optional: true
|
||||
|
||||
/ws@8.2.3:
|
||||
resolution: {integrity: sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
peerDependencies:
|
||||
bufferutil: ^4.0.1
|
||||
utf-8-validate: ^5.0.2
|
||||
peerDependenciesMeta:
|
||||
bufferutil:
|
||||
optional: true
|
||||
utf-8-validate:
|
||||
optional: true
|
||||
dev: true
|
||||
|
||||
/ws@8.5.0:
|
||||
resolution: {integrity: sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
@ -34739,11 +34617,6 @@ packages:
|
||||
/xmlchars@2.2.0:
|
||||
resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==}
|
||||
|
||||
/xmlhttprequest-ssl@2.0.0:
|
||||
resolution: {integrity: sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
dev: true
|
||||
|
||||
/xregexp@2.0.0:
|
||||
resolution: {integrity: sha512-xl/50/Cf32VsGq/1R8jJE5ajH1yMCQkpmoS10QbFZWl2Oor4H0Me64Pu2yxvsRWK3m6soJbmGfzSR7BYmDcWAA==}
|
||||
dev: true
|
||||
|
||||
@ -456,7 +456,6 @@ PNPM,@slack/types,1.7.0,MIT,"",Approved
|
||||
PNPM,@slack/web-api,5.15.0,MIT,"",Approved
|
||||
PNPM,@snyk/dep-graph,2.6.0,Apache 2.0,"",Approved
|
||||
PNPM,@snyk/graphlib,2.1.9-patch.3,MIT,"",Approved
|
||||
PNPM,@socket.io/component-emitter,3.1.0,MIT,"",Approved
|
||||
PNPM,@sourcegraph/codemod-cli,1.0.0,Apache 2.0,"",Approved
|
||||
PNPM,@sourcegraph/codemod-common,1.0.0,Apache 2.0,"",Approved
|
||||
PNPM,@sourcegraph/codemod-toolkit-packages,1.0.1,Apache 2.0,"",Approved
|
||||
@ -609,7 +608,6 @@ PNPM,@types/compression,1.7.2,MIT,"",Approved
|
||||
PNPM,@types/connect,3.4.32,MIT,"",Approved
|
||||
PNPM,@types/connect-history-api-fallback,1.3.5,MIT,"",Approved
|
||||
PNPM,@types/cookie,0.5.1,MIT,"",Approved
|
||||
PNPM,@types/cors,2.8.12,MIT,"",Approved
|
||||
PNPM,@types/cross-spawn,6.0.2,MIT,"",Approved
|
||||
PNPM,@types/d3-color,1.4.1,MIT,"",Approved
|
||||
PNPM,@types/d3-format,2.0.0,MIT,"",Approved
|
||||
@ -727,7 +725,6 @@ PNPM,@types/signale,1.4.1,MIT,"",Approved
|
||||
PNPM,@types/simmerjs,0.5.1,MIT,"",Approved
|
||||
PNPM,@types/sinon,9.0.4,MIT,"",Approved
|
||||
PNPM,@types/sinonjs__fake-timers,6.0.1,MIT,"",Approved
|
||||
PNPM,@types/socket.io-client,1.4.33,MIT,"",Approved
|
||||
PNPM,@types/sockjs,0.3.33,MIT,"",Approved
|
||||
PNPM,@types/speed-measure-webpack-plugin,1.3.4,MIT,"",Approved
|
||||
PNPM,@types/stack-utils,2.0.1,MIT,"",Approved
|
||||
@ -1295,9 +1292,6 @@ PNPM,emojis-list,3.0.0,MIT,"",Approved
|
||||
PNPM,encodeurl,1.0.2,MIT,"",Approved
|
||||
PNPM,end-of-stream,1.1.0,MIT,"",Approved
|
||||
PNPM,endent,2.0.1,MIT,"",Approved
|
||||
PNPM,engine.io,6.2.0,MIT,"",Approved
|
||||
PNPM,engine.io-client,6.2.2,MIT,"",Approved
|
||||
PNPM,engine.io-parser,5.0.4,MIT,"",Approved
|
||||
PNPM,enhanced-resolve,5.10.0,MIT,"",Approved
|
||||
PNPM,enquirer,2.3.6,MIT,"",Approved
|
||||
PNPM,entities,2.1.0,Simplified BSD,"",Approved
|
||||
@ -2909,10 +2903,6 @@ PNPM,snapdragon-node,2.1.1,MIT,"",Approved
|
||||
PNPM,snapdragon-util,3.0.1,MIT,"",Approved
|
||||
PNPM,snyk-config,5.1.0,(Apache-2.0 AND MIT),"",Approved
|
||||
PNPM,snyk-nodejs-lockfile-parser,1.48.2,Apache 2.0,"",Approved
|
||||
PNPM,socket.io,4.5.2,MIT,"",Approved
|
||||
PNPM,socket.io-adapter,2.4.0,MIT,"",Approved
|
||||
PNPM,socket.io-client,4.5.2,MIT,"",Approved
|
||||
PNPM,socket.io-parser,4.2.1,MIT,"",Approved
|
||||
PNPM,sockjs,0.3.24,MIT,"",Approved
|
||||
PNPM,socks,2.7.0,MIT,"",Approved
|
||||
PNPM,socks-proxy-agent,5.0.1,MIT,"",Approved
|
||||
@ -3276,7 +3266,6 @@ PNPM,wrap-ansi,8.1.0,MIT,"",Approved
|
||||
PNPM,wrappy,1.0.2,ISC,"",Approved
|
||||
PNPM,write-file-atomic,4.0.2,ISC,"",Approved
|
||||
PNPM,write-json-file,2.3.0,MIT,"",Approved
|
||||
PNPM,ws,6.2.2,MIT,"",Approved
|
||||
PNPM,x-default-browser,0.4.0,MIT,"",Approved
|
||||
PNPM,x2js,3.4.4,Apache 2.0,"",Approved
|
||||
PNPM,xdg-basedir,3.0.0,MIT,"",Approved
|
||||
@ -3285,7 +3274,6 @@ PNPM,xml-name-validator,4.0.0,Apache 2.0,"",Approved
|
||||
PNPM,xml2js,0.4.23,MIT,"",Approved
|
||||
PNPM,xmlbuilder,11.0.1,MIT,"",Approved
|
||||
PNPM,xmlchars,2.2.0,MIT,"",Approved
|
||||
PNPM,xmlhttprequest-ssl,2.0.0,MIT,"",Approved
|
||||
PNPM,xregexp,2.0.0,MIT,"",Approved
|
||||
PNPM,xtend,4.0.2,MIT,"",Approved
|
||||
PNPM,y18n,4.0.3,ISC,"",Approved
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user