mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
This reverts commit 6bd0a17d3c.
This commit is contained in:
@@ -15,7 +15,7 @@ interface IPosition {
|
||||
interface IBuildModuleInfo {
|
||||
id: string;
|
||||
path: string;
|
||||
defineLocation: IPosition | null;
|
||||
defineLocation: IPosition;
|
||||
dependencies: string[];
|
||||
shim: string;
|
||||
exports: any;
|
||||
@@ -42,17 +42,12 @@ interface ILoaderPluginReqFunc {
|
||||
toUrl(something: string): string;
|
||||
}
|
||||
|
||||
export interface IExtraFile {
|
||||
path: string;
|
||||
amdModuleId?: string;
|
||||
}
|
||||
|
||||
export interface IEntryPoint {
|
||||
name: string;
|
||||
include?: string[];
|
||||
exclude?: string[];
|
||||
prepend?: IExtraFile[];
|
||||
append?: IExtraFile[];
|
||||
prepend?: string[];
|
||||
append?: string[];
|
||||
dest?: string;
|
||||
}
|
||||
|
||||
@@ -97,13 +92,6 @@ interface IPartialBundleResult {
|
||||
export interface ILoaderConfig {
|
||||
isBuild?: boolean;
|
||||
paths?: { [path: string]: any };
|
||||
/*
|
||||
* Normally, during a build, no module factories are invoked. This can be used
|
||||
* to forcefully execute a module's factory.
|
||||
*/
|
||||
buildForceInvokeFactory: {
|
||||
[moduleId: string]: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,21 +132,15 @@ export function bundle(entryPoints: IEntryPoint[], config: ILoaderConfig, callba
|
||||
if (!config.paths['vs/css']) {
|
||||
config.paths['vs/css'] = 'out-build/vs/css.build';
|
||||
}
|
||||
config.buildForceInvokeFactory = config.buildForceInvokeFactory || {};
|
||||
config.buildForceInvokeFactory['vs/nls'] = true;
|
||||
config.buildForceInvokeFactory['vs/css'] = true;
|
||||
loader.config(config);
|
||||
|
||||
loader(['require'], (localRequire: any) => {
|
||||
const resolvePath = (entry: IExtraFile) => {
|
||||
let r = localRequire.toUrl(entry.path);
|
||||
if (!r.endsWith('.js')) {
|
||||
r += '.js';
|
||||
const resolvePath = (path: string) => {
|
||||
const r = localRequire.toUrl(path);
|
||||
if (!/\.js/.test(r)) {
|
||||
return r + '.js';
|
||||
}
|
||||
// avoid packaging the build version of plugins:
|
||||
r = r.replace('vs/nls.build.js', 'vs/nls.js');
|
||||
r = r.replace('vs/css.build.js', 'vs/css.js');
|
||||
return { path: r, amdModuleId: entry.amdModuleId };
|
||||
return r;
|
||||
};
|
||||
for (const moduleId in entryPointsMap) {
|
||||
const entryPoint = entryPointsMap[moduleId];
|
||||
@@ -421,8 +403,8 @@ function emitEntryPoint(
|
||||
deps: IGraph,
|
||||
entryPoint: string,
|
||||
includedModules: string[],
|
||||
prepend: IExtraFile[],
|
||||
append: IExtraFile[],
|
||||
prepend: string[],
|
||||
append: string[],
|
||||
dest: string | undefined
|
||||
): IEmitEntryPointResult {
|
||||
if (!dest) {
|
||||
@@ -462,16 +444,8 @@ function emitEntryPoint(
|
||||
|
||||
if (module.shim) {
|
||||
mainResult.sources.push(emitShimmedModule(c, deps[c], module.shim, module.path, contents));
|
||||
} else if (module.defineLocation) {
|
||||
mainResult.sources.push(emitNamedModule(c, module.defineLocation, module.path, contents));
|
||||
} else {
|
||||
const moduleCopy = {
|
||||
id: module.id,
|
||||
path: module.path,
|
||||
defineLocation: module.defineLocation,
|
||||
dependencies: module.dependencies
|
||||
};
|
||||
throw new Error(`Cannot bundle module '${module.id}' for entry point '${entryPoint}' because it has no shim and it lacks a defineLocation: ${JSON.stringify(moduleCopy)}`);
|
||||
mainResult.sources.push(emitNamedModule(c, module.defineLocation, module.path, contents));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -496,13 +470,10 @@ function emitEntryPoint(
|
||||
}
|
||||
});
|
||||
|
||||
const toIFile = (entry: IExtraFile): IFile => {
|
||||
let contents = readFileAndRemoveBOM(entry.path);
|
||||
if (entry.amdModuleId) {
|
||||
contents = contents.replace(/^define\(/m, `define("${entry.amdModuleId}",`);
|
||||
}
|
||||
const toIFile = (path: string): IFile => {
|
||||
const contents = readFileAndRemoveBOM(path);
|
||||
return {
|
||||
path: entry.path,
|
||||
path: path,
|
||||
contents: contents
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user