Don't use webpack for local development (#1140)

* Don't use webpack for local development

* fix

* fixes
This commit is contained in:
Stephen Weatherford (MSFT) 2019-07-03 16:53:56 -07:00 коммит произвёл GitHub
Родитель 5b0b5282ab
Коммит 34f9eebd94
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
21 изменённых файлов: 111 добавлений и 114 удалений

46
.vscode/launch.json поставляемый
Просмотреть файл

@ -8,7 +8,7 @@
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}"
"--extensionDevelopmentPath=${workspaceFolder}"
],
"stopOnEntry": false,
"sourceMaps": true,
@ -16,26 +16,28 @@
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "npm: webpack",
"preLaunchTask": "npm: compile",
"env": {
"AZCODE_COSMOSDB_IGNORE_BUNDLE": "1",
"DEBUGTELEMETRY": "1",
"NODE_DEBUG": ""
}
},
{
"name": "Launch Extension (no build)",
"name": "Launch Extension (Webpack)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}"
"--extensionDevelopmentPath=${workspaceFolder}"
],
"stopOnEntry": false,
"sourceMaps": true,
// outFiles is used for locating generated JavaScript files, see https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_source-maps
"outFiles": [
"${workspaceFolder}/**/*.js"
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "npm: webpack",
"env": {
"DEBUGTELEMETRY": "1",
"NODE_DEBUG": ""
@ -47,8 +49,8 @@
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceRoot}",
"--extensionTestsPath=${workspaceRoot}/dist/test"
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/test"
],
"stopOnEntry": false,
"sourceMaps": true,
@ -56,6 +58,30 @@
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "npm: compile",
"env": {
"MOCHA_grep": "", // RegExp of tests to run (empty for all)
"MOCHA_enableTimeouts": "0", // Disable time-outs
"AZCODE_COSMOSDB_IGNORE_BUNDLE": "1",
"DEBUGTELEMETRY": "1",
"NODE_DEBUG": ""
}
},
{
"name": "Launch Tests (Webpack)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/dist/test"
],
"stopOnEntry": false,
"sourceMaps": true,
// outFiles is used for locating generated JavaScript files, see https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_source-maps
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
],
"preLaunchTask": "npm: webpack",
"env": {
"MOCHA_grep": "", // RegExp of tests to run (empty for all)
@ -72,7 +98,7 @@
"port": 6005,
"sourceMaps": true,
"outFiles": [
"${workspaceRoot}/dist/**/*.js"
"${workspaceFolder}/dist/**/*.js"
]
},
{
@ -84,7 +110,7 @@
"sourceMaps": true,
"restart": true,
"outFiles": [
"${workspaceRoot}/out/src"
"${workspaceFolder}/out/src"
]
},
{
@ -98,7 +124,7 @@
"name": "Debug Mongo grammar",
"type": "antlr-debug",
"request": "launch",
// This doesn't seem to work: "input": "${workspaceRoot}/${command:AskForTestInput}",
// This doesn't seem to work: "input": "${workspaceFolder}/${command:AskForTestInput}",
"input": "c:/temp/debugger-input.mongo",
"grammar": "grammar/mongo.g4",
"startRule": "mongoCommands",

Просмотреть файл

@ -16,7 +16,9 @@ let perfStats = {
Object.defineProperty(exports, "__esModule", { value: true });
const extension = require("./dist/extension.bundle");
const ignoreBundle = !/^(false|0)?$/i.test(process.env.AZCODE_COSMOSDB_IGNORE_BUNDLE || '');
const extensionPath = ignoreBundle ? "./out/src/extension" : "./dist/extension.bundle";
const extension = require(extensionPath);
async function activate(ctx) {
return await extension.activateInternal(ctx, perfStats);

Просмотреть файл

@ -3,9 +3,37 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import * as fs from 'fs';
import * as path from 'path';
import { ext } from './extensionVariables';
export const resourcesPath = path.join(__dirname, '..', 'resources'); // (relative to dist folder)
export interface IThemedIconPath {
light: string;
dark: string;
}
export function getThemedIconPath(iconName: string): IThemedIconPath {
let a = {
light: path.join(getResourcesPath(), 'icons', 'light', iconName),
dark: path.join(getResourcesPath(), 'icons', 'dark', iconName)
};
assert(fs.existsSync(a.light));
return a;
}
export function getThemeAgnosticIconPath(iconName: string): IThemedIconPath {
let a = {
light: path.join(getResourcesPath(), 'icons', 'theme-agnostic', iconName),
dark: path.join(getResourcesPath(), 'icons', 'theme-agnostic', iconName)
};
assert(fs.existsSync(a.light));
return a;
}
export function getResourcesPath(): string {
return ext.context.asAbsolutePath('resources');
}
export const defaultBatchSize: number = 50;

Просмотреть файл

@ -5,11 +5,10 @@
import { DatabaseAccount } from 'azure-arm-cosmosdb/lib/models';
import { DatabaseMeta, DocumentClient, FeedOptions, QueryIterator } from 'documentdb';
import * as path from 'path';
import * as vscode from 'vscode';
import { AzureParentTreeItem, AzureTreeItem, ICreateChildImplContext, UserCancelledError } from 'vscode-azureextensionui';
import { deleteCosmosDBAccount } from '../../commands/deleteCosmosDBAccount';
import { resourcesPath } from '../../constants';
import { getThemedIconPath } from '../../constants';
import { rejectOnTimeout } from '../../utils/timeout';
import { getDocumentClient } from '../getDocumentClient';
import { DocDBTreeItemBase } from './DocDBTreeItemBase';
@ -48,10 +47,7 @@ export abstract class DocDBAccountTreeItemBase extends DocDBTreeItemBase<Databas
}
public get iconPath(): string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri } {
return {
light: path.join(resourcesPath, 'icons', 'light', 'CosmosDBAccount.svg'),
dark: path.join(resourcesPath, 'icons', 'dark', 'CosmosDBAccount.svg')
};
return getThemedIconPath('CosmosDBAccount.svg');
}
public async getIterator(client: DocumentClient, feedOptions: FeedOptions): Promise<QueryIterator<DatabaseMeta>> {

Просмотреть файл

@ -4,10 +4,9 @@
*--------------------------------------------------------------------------------------------*/
import { CollectionMeta, CollectionPartitionKey } from 'documentdb';
import * as path from "path";
import * as vscode from 'vscode';
import { AzureParentTreeItem, AzureTreeItem, DialogResponses, UserCancelledError } from 'vscode-azureextensionui';
import { resourcesPath } from '../../constants';
import { getThemeAgnosticIconPath } from '../../constants';
import { DocDBDatabaseTreeItem } from './DocDBDatabaseTreeItem';
import { DocDBDocumentsTreeItem } from './DocDBDocumentsTreeItem';
import { DocDBDocumentTreeItem } from './DocDBDocumentTreeItem';
@ -40,10 +39,7 @@ export class DocDBCollectionTreeItem extends AzureParentTreeItem<IDocDBTreeRoot>
}
public get iconPath(): string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri } {
return {
light: path.join(resourcesPath, 'icons', 'theme-agnostic', 'Collection.svg'),
dark: path.join(resourcesPath, 'icons', 'theme-agnostic', 'Collection.svg')
};
return getThemeAgnosticIconPath('Collection.svg');
}
public get link(): string {

Просмотреть файл

@ -5,10 +5,9 @@
import { Collection, CollectionMeta, DatabaseMeta, DocumentClient, FeedOptions, QueryIterator } from 'documentdb';
import { DocumentBase } from 'documentdb/lib';
import * as path from 'path';
import * as vscode from 'vscode';
import { AzureTreeItem, DialogResponses, ICreateChildImplContext, UserCancelledError } from 'vscode-azureextensionui';
import { resourcesPath } from '../../constants';
import { getThemeAgnosticIconPath } from '../../constants';
import { ext } from '../../extensionVariables';
import { DocDBAccountTreeItemBase } from './DocDBAccountTreeItemBase';
import { DocDBTreeItemBase } from './DocDBTreeItemBase';
@ -32,10 +31,7 @@ export abstract class DocDBDatabaseTreeItemBase extends DocDBTreeItemBase<Collec
}
public get iconPath(): string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri } {
return {
light: path.join(resourcesPath, 'icons', 'theme-agnostic', 'Database.svg'),
dark: path.join(resourcesPath, 'icons', 'theme-agnostic', 'Database.svg')
};
return getThemeAgnosticIconPath('Database.svg');
}
public get id(): string {

Просмотреть файл

@ -4,10 +4,9 @@
*--------------------------------------------------------------------------------------------*/
import { DocumentClient, RetrievedDocument } from 'documentdb';
import * as path from 'path';
import * as vscode from 'vscode';
import { AzureTreeItem, DialogResponses, UserCancelledError } from 'vscode-azureextensionui';
import { emptyPartitionKeyValue, resourcesPath } from '../../constants';
import { emptyPartitionKeyValue, getThemeAgnosticIconPath } from '../../constants';
import { getDocumentTreeItemLabel } from '../../utils/vscodeUtils';
import { DocDBDocumentsTreeItem } from './DocDBDocumentsTreeItem';
import { IDocDBTreeRoot } from './IDocDBTreeRoot';
@ -55,10 +54,7 @@ export class DocDBDocumentTreeItem extends AzureTreeItem<IDocDBTreeRoot> {
}
public get iconPath(): string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri } {
return {
light: path.join(resourcesPath, 'icons', 'theme-agnostic', 'Document.svg'),
dark: path.join(resourcesPath, 'icons', 'theme-agnostic', 'Document.svg')
};
return getThemeAgnosticIconPath('Document.svg');
}
public async deleteTreeItemImpl(): Promise<void> {

Просмотреть файл

@ -4,10 +4,9 @@
*--------------------------------------------------------------------------------------------*/
import { DocumentClient, FeedOptions, NewDocument, QueryIterator, RetrievedDocument } from 'documentdb';
import * as path from 'path';
import * as vscode from 'vscode';
import { ICreateChildImplContext, UserCancelledError } from 'vscode-azureextensionui';
import { resourcesPath } from '../../constants';
import { getThemeAgnosticIconPath } from '../../constants';
import { DocDBCollectionTreeItem } from './DocDBCollectionTreeItem';
import { DocDBDocumentTreeItem } from './DocDBDocumentTreeItem';
import { DocDBTreeItemBase } from './DocDBTreeItemBase';
@ -26,10 +25,7 @@ export class DocDBDocumentsTreeItem extends DocDBTreeItemBase<RetrievedDocument>
}
public get iconPath(): string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri } {
return {
light: path.join(resourcesPath, 'icons', 'theme-agnostic', 'Collection.svg'),
dark: path.join(resourcesPath, 'icons', 'theme-agnostic', 'Collection.svg')
};
return getThemeAgnosticIconPath('Collection.svg');
}
public get id(): string {

Просмотреть файл

@ -4,10 +4,9 @@
*--------------------------------------------------------------------------------------------*/
import { ProcedureMeta } from 'documentdb';
import * as path from 'path';
import * as vscode from "vscode";
import { AzureTreeItem, DialogResponses, UserCancelledError } from 'vscode-azureextensionui';
import { resourcesPath } from '../../constants';
import { getThemedIconPath } from '../../constants';
import { DocDBStoredProceduresTreeItem } from './DocDBStoredProceduresTreeItem';
import { IDocDBTreeRoot } from './IDocDBTreeRoot';
@ -52,10 +51,7 @@ export class DocDBStoredProcedureTreeItem extends AzureTreeItem<IDocDBTreeRoot>
}
public get iconPath(): string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri } {
return {
light: path.join(resourcesPath, 'icons', 'light', 'Process_16x.svg'),
dark: path.join(resourcesPath, 'icons', 'dark', 'Process_16x.svg')
};
return getThemedIconPath('Process_16x.svg');
}
public async deleteTreeItemImpl(): Promise<void> {

Просмотреть файл

@ -4,10 +4,9 @@
*--------------------------------------------------------------------------------------------*/
import { DocumentClient, FeedOptions, ProcedureMeta, QueryIterator } from 'documentdb';
import * as path from 'path';
import * as vscode from "vscode";
import { ICreateChildImplContext, UserCancelledError } from 'vscode-azureextensionui';
import { defaultStoredProcedure, resourcesPath } from '../../constants';
import { defaultStoredProcedure, getThemeAgnosticIconPath } from '../../constants';
import { GraphCollectionTreeItem } from '../../graph/tree/GraphCollectionTreeItem';
import { DocDBCollectionTreeItem } from './DocDBCollectionTreeItem';
import { DocDBStoredProcedureTreeItem } from './DocDBStoredProcedureTreeItem';
@ -31,10 +30,7 @@ export class DocDBStoredProceduresTreeItem extends DocDBTreeItemBase<ProcedureMe
}
public get iconPath(): string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri } {
return {
light: path.join(resourcesPath, 'icons', 'theme-agnostic', 'stored procedures.svg'),
dark: path.join(resourcesPath, 'icons', 'theme-agnostic', 'stored procedures.svg')
};
return getThemeAgnosticIconPath('stored procedures.svg');
}
public async createChildImpl(context: ICreateChildImplContext): Promise<DocDBStoredProcedureTreeItem> {

Просмотреть файл

@ -7,7 +7,7 @@ import * as fse from 'fs-extra';
import * as path from "path";
import * as vscode from 'vscode';
import { parseError } from 'vscode-azureextensionui';
import { resourcesPath } from '../constants';
import { getResourcesPath } from '../constants';
import { ext } from '../extensionVariables';
import { areConfigsEqual, GraphConfiguration } from './GraphConfiguration';
import { GraphViewServer } from './GraphViewServer';
@ -107,7 +107,7 @@ class WebviewContentProvider {
}
private async _graphClientHtmlAsString(port: number): Promise<string> {
const graphClientAbsolutePath = path.join(resourcesPath, 'graphClient', 'graphClient.html');
const graphClientAbsolutePath = path.join(getResourcesPath(), 'graphClient', 'graphClient.html');
let htmlContents: string = await fse.readFile(graphClientAbsolutePath, 'utf8');
const portPlaceholder: RegExp = /\$CLIENTPORT/g;
htmlContents = htmlContents.replace(portPlaceholder, String(port));

Просмотреть файл

@ -4,10 +4,9 @@
*--------------------------------------------------------------------------------------------*/
import { CollectionMeta } from 'documentdb';
import * as path from 'path';
import * as vscode from 'vscode';
import { AzureParentTreeItem, AzureTreeItem, DialogResponses, UserCancelledError } from 'vscode-azureextensionui';
import { resourcesPath } from '../../constants';
import { getThemeAgnosticIconPath } from '../../constants';
import { DocDBStoredProceduresTreeItem } from '../../docdb/tree/DocDBStoredProceduresTreeItem';
import { DocDBStoredProcedureTreeItem } from '../../docdb/tree/DocDBStoredProcedureTreeItem';
import { IDocDBTreeRoot } from '../../docdb/tree/IDocDBTreeRoot';
@ -44,10 +43,7 @@ export class GraphCollectionTreeItem extends AzureParentTreeItem<IDocDBTreeRoot>
}
public get iconPath(): string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri } {
return {
light: path.join(resourcesPath, 'icons', 'theme-agnostic', 'Collection.svg'),
dark: path.join(resourcesPath, 'icons', 'theme-agnostic', 'Collection.svg')
};
return getThemeAgnosticIconPath('Collection.svg');
}
public async loadMoreChildrenImpl(_clearCache: boolean): Promise<AzureTreeItem<IDocDBTreeRoot>[]> {

Просмотреть файл

@ -4,10 +4,9 @@
*--------------------------------------------------------------------------------------------*/
import { CollectionMeta } from 'documentdb';
import * as path from 'path';
import * as vscode from 'vscode';
import { AzureTreeItem } from 'vscode-azureextensionui';
import { resourcesPath } from '../../constants';
import { getThemeAgnosticIconPath } from '../../constants';
import { IDocDBTreeRoot } from '../../docdb/tree/IDocDBTreeRoot';
import { GraphConfiguration } from '../GraphConfiguration';
import { GraphViewsManager } from '../GraphViewsManager';
@ -40,10 +39,7 @@ export class GraphTreeItem extends AzureTreeItem<IDocDBTreeRoot> {
}
public get iconPath(): string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri } {
return {
light: path.join(resourcesPath, 'icons', 'theme-agnostic', 'Collection.svg'),
dark: path.join(resourcesPath, 'icons', 'theme-agnostic', 'Collection.svg')
};
return getThemeAgnosticIconPath('Collection.svg');
}
public async showExplorer(graphViewsManager: GraphViewsManager): Promise<void> {

Просмотреть файл

@ -16,7 +16,10 @@ export class MongoDBLanguageClient {
constructor() {
// The server is implemented in node
let serverModule = ext.context.asAbsolutePath(path.join('dist', 'mongo-languageServer.bundle.js'));
const ignoreBundle = !/^(false|0)?$/i.test(process.env.AZCODE_COSMOSDB_IGNORE_BUNDLE || '');
let serverModule = ignoreBundle ?
ext.context.asAbsolutePath(path.join('out', 'src', 'mongo', 'languageServer.js')) :
ext.context.asAbsolutePath(path.join('dist', 'mongo-languageServer.bundle.js'));
// The debug options for the server
let debugOptions = { execArgv: ['--nolazy', '--debug=6005', '--inspect'] };

Просмотреть файл

@ -5,11 +5,10 @@
import { DatabaseAccount } from 'azure-arm-cosmosdb/lib/models';
import { Db } from 'mongodb';
import * as path from 'path';
import * as vscode from 'vscode';
import { appendExtensionUserAgent, AzureParentTreeItem, AzureTreeItem, ICreateChildImplContext, parseError } from 'vscode-azureextensionui';
import { deleteCosmosDBAccount } from '../../commands/deleteCosmosDBAccount';
import { resourcesPath } from '../../constants';
import { getThemedIconPath } from '../../constants';
import { ext } from '../../extensionVariables';
import { connectToMongoClient } from '../connectToMongoClient';
import { getDatabaseNameFromConnectionString } from '../mongoConnectionStrings';
@ -42,10 +41,7 @@ export class MongoAccountTreeItem extends AzureParentTreeItem<IMongoTreeRoot> {
}
public get iconPath(): string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri } {
return {
light: path.join(resourcesPath, 'icons', 'light', 'CosmosDBAccount.svg'),
dark: path.join(resourcesPath, 'icons', 'dark', 'CosmosDBAccount.svg')
};
return getThemedIconPath('CosmosDBAccount.svg');
}
public hasMoreChildrenImpl(): boolean {

Просмотреть файл

@ -5,11 +5,10 @@
import * as assert from 'assert';
import { BulkWriteOpResultObject, Collection, CollectionInsertManyOptions, Cursor, DeleteWriteOpResultObject, InsertOneWriteOpResult, InsertWriteOpResult, MongoCountPreferences } from 'mongodb';
import * as path from 'path';
import * as _ from 'underscore';
import * as vscode from 'vscode';
import { AzureParentTreeItem, DialogResponses, ICreateChildImplContext, UserCancelledError } from 'vscode-azureextensionui';
import { defaultBatchSize, resourcesPath } from '../../constants';
import { defaultBatchSize, getThemeAgnosticIconPath } from '../../constants';
import { ext } from '../../extensionVariables';
import { IMongoTreeRoot } from './IMongoTreeRoot';
import { IMongoDocument, MongoDocumentTreeItem } from './MongoDocumentTreeItem';
@ -68,10 +67,7 @@ export class MongoCollectionTreeItem extends AzureParentTreeItem<IMongoTreeRoot>
}
public get iconPath(): string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri } {
return {
light: path.join(resourcesPath, 'icons', 'theme-agnostic', 'Collection.svg'),
dark: path.join(resourcesPath, 'icons', 'theme-agnostic', 'Collection.svg')
};
return getThemeAgnosticIconPath('Collection.svg');
}
public hasMoreChildrenImpl(): boolean {

Просмотреть файл

@ -9,7 +9,7 @@ import * as path from 'path';
import * as process from 'process';
import * as vscode from 'vscode';
import { appendExtensionUserAgent, AzureParentTreeItem, DialogResponses, IActionContext, ICreateChildImplContext, UserCancelledError } from 'vscode-azureextensionui';
import { resourcesPath } from '../../constants';
import { getThemeAgnosticIconPath } from '../../constants';
import { ext } from '../../extensionVariables';
import * as cpUtils from '../../utils/cp';
import { connectToMongoClient } from '../connectToMongoClient';
@ -52,10 +52,7 @@ export class MongoDatabaseTreeItem extends AzureParentTreeItem<IMongoTreeRoot> {
}
public get iconPath(): string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri } {
return {
light: path.join(resourcesPath, 'icons', 'theme-agnostic', 'Database.svg'),
dark: path.join(resourcesPath, 'icons', 'theme-agnostic', 'Database.svg')
};
return getThemeAgnosticIconPath('Database.svg');
}
public hasMoreChildrenImpl(): boolean {

Просмотреть файл

@ -4,11 +4,10 @@
*--------------------------------------------------------------------------------------------*/
import { Collection, DeleteWriteOpResultObject, ObjectID, UpdateWriteOpResult } from 'mongodb';
import * as path from 'path';
import * as _ from 'underscore';
import * as vscode from 'vscode';
import { AzureTreeItem, DialogResponses, UserCancelledError } from 'vscode-azureextensionui';
import { resourcesPath } from '../../constants';
import { getThemeAgnosticIconPath } from '../../constants';
import { getDocumentTreeItemLabel } from '../../utils/vscodeUtils';
import { IMongoTreeRoot } from './IMongoTreeRoot';
import { MongoCollectionTreeItem } from './MongoCollectionTreeItem';
@ -50,10 +49,7 @@ export class MongoDocumentTreeItem extends AzureTreeItem<IMongoTreeRoot> {
}
public get iconPath(): string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri } {
return {
light: path.join(resourcesPath, 'icons', 'theme-agnostic', 'Document.svg'),
dark: path.join(resourcesPath, 'icons', 'theme-agnostic', 'Document.svg')
};
return getThemeAgnosticIconPath('Document.svg');
}
public async deleteTreeItemImpl(): Promise<void> {

Просмотреть файл

@ -5,11 +5,10 @@
import { ServiceClientCredentials } from 'ms-rest';
import { AzureEnvironment } from 'ms-rest-azure';
import * as path from 'path';
import * as vscode from 'vscode';
import { appendExtensionUserAgent, AzExtParentTreeItem, AzExtTreeItem, AzureParentTreeItem, AzureTreeItem, GenericTreeItem, ISubscriptionContext, UserCancelledError } from 'vscode-azureextensionui';
import { removeTreeItemFromCache } from '../commands/api/apiCache';
import { emulatorPassword, resourcesPath } from '../constants';
import { emulatorPassword, getThemedIconPath } from '../constants';
import { parseDocDBConnectionString } from '../docdb/docDBConnectionStrings';
import { DocDBAccountTreeItem } from '../docdb/tree/DocDBAccountTreeItem';
import { DocDBAccountTreeItemBase } from '../docdb/tree/DocDBAccountTreeItemBase';
@ -74,10 +73,7 @@ export class AttachedAccountsTreeItem extends AzureParentTreeItem {
}
public get iconPath(): string | vscode.Uri | { light: string | vscode.Uri; dark: string | vscode.Uri } {
return {
light: path.join(resourcesPath, 'icons', 'light', 'ConnectPlugged.svg'),
dark: path.join(resourcesPath, 'icons', 'dark', 'ConnectPlugged.svg')
};
return getThemedIconPath('ConnectPlugged.svg');
}
public hasMoreChildrenImpl(): boolean {

Просмотреть файл

@ -3,31 +3,24 @@
* Licensed under the MIT License. See LICENSE.md in the project root for license information.
*--------------------------------------------------------------------------------------------*/
"use strict";
// Our util/getCoreNodeModule.js file uses a dynamic require that depends on the environment and so has to be excluded
// from webpack'ing, and we'll just copy it to the distribution folder.
//
// Since webpack shouldn't have to depend on npm build to transpile .ts -> .js, we keep this file in .js.
Object.defineProperty(exports, "__esModule", { value: true });
const vscode = require("vscode");
import * as vscode from 'vscode';
/**
* Returns a node module installed with VSCode, or undefined if it fails.
*/
function getCoreNodeModule(moduleName) {
export function getCoreNodeModule<T>(moduleName: string): T | undefined {
try {
// tslint:disable-next-line:non-literal-require no-unsafe-any
return require(`${vscode.env.appRoot}/node_modules.asar/${moduleName}`);
} catch (err) {
// ignore
}
catch (err) { }
try {
// tslint:disable-next-line:non-literal-require no-unsafe-any
return require(`${vscode.env.appRoot}/node_modules/${moduleName}`);
} catch (err) {
// ignore
}
catch (err) { }
return undefined;
}
exports.getCoreNodeModule = getCoreNodeModule;

Просмотреть файл

@ -58,7 +58,7 @@ let config = dev.getDefaultWebpackConfig({
// Fix "module not found" error in node_modules/es6-promise/dist/es6-promise.js
'vertx': 'commonjs vertx',
// ./getCoreNodeModule.js (path from keytar.ts) uses a dynamic require which can't be webpacked
// ./getCoreNodeModule.js (path from keytar.ts) uses a dynamic require which can't be webpacked // ./getCoreNodeModule.js (path from keytar.ts) uses a dynamic require which can't be webpacked
'./getCoreNodeModule': 'commonjs getCoreNodeModule',
}, // end of externals
@ -120,7 +120,7 @@ let config = dev.getDefaultWebpackConfig({
// Copy files to dist folder where the runtime can find them
new CopyWebpackPlugin([
// getCoreNodeModule.js -> dist/node_modules/getCoreNodeModule.js
{ from: './src/utils/getCoreNodeModule.js', to: 'node_modules' },
{ from: './out/src/utils/getCoreNodeModule.js', to: 'node_modules' },
// graphClient.js -> dist, which is used by graphClient.html
{ from: './out/src/graph/client/graphClient.js', to: 'graphClient.js' }