Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master' into pr/jimmydief/81
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdima committed Dec 18, 2019
2 parents e7551d3 + e76c706 commit da92d8f
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 256 deletions.
41 changes: 0 additions & 41 deletions features.js
@@ -1,169 +1,128 @@
module.exports = {
accessibilityHelp: {
entry: 'vs/editor/standalone/browser/accessibilityHelp/accessibilityHelp',
worker: undefined,
},
bracketMatching: {
entry: 'vs/editor/contrib/bracketMatching/bracketMatching',
worker: undefined,
},
caretOperations: {
entry: 'vs/editor/contrib/caretOperations/caretOperations',
worker: undefined,
},
clipboard: {
entry: 'vs/editor/contrib/clipboard/clipboard',
worker: undefined,
},
codeAction: {
entry: 'vs/editor/contrib/codeAction/codeActionContributions',
worker: undefined,
},
codelens: {
entry: 'vs/editor/contrib/codelens/codelensController',
worker: undefined,
},
colorDetector: {
entry: 'vs/editor/contrib/colorPicker/colorDetector',
worker: undefined,
},
comment: {
entry: 'vs/editor/contrib/comment/comment',
worker: undefined,
},
contextmenu: {
entry: 'vs/editor/contrib/contextmenu/contextmenu',
worker: undefined,
},
coreCommands: {
entry: 'vs/editor/browser/controller/coreCommands',
worker: undefined,
},
cursorUndo: {
entry: 'vs/editor/contrib/cursorUndo/cursorUndo',
worker: undefined,
},
dnd: {
entry: 'vs/editor/contrib/dnd/dnd',
worker: undefined,
},
find: {
entry: 'vs/editor/contrib/find/findController',
worker: undefined,
},
folding: {
entry: 'vs/editor/contrib/folding/folding',
worker: undefined,
},
fontZoom: {
entry: 'vs/editor/contrib/fontZoom/fontZoom',
worker: undefined,
},
format: {
entry: 'vs/editor/contrib/format/formatActions',
worker: undefined,
},
goToDefinitionCommands: {
entry: 'vs/editor/contrib/goToDefinition/goToDefinitionCommands',
worker: undefined,
},
goToDefinitionMouse: {
entry: 'vs/editor/contrib/goToDefinition/goToDefinitionMouse',
worker: undefined,
},
gotoError: {
entry: 'vs/editor/contrib/gotoError/gotoError',
worker: undefined,
},
gotoLine: {
entry: 'vs/editor/standalone/browser/quickOpen/gotoLine',
worker: undefined,
},
hover: {
entry: 'vs/editor/contrib/hover/hover',
worker: undefined,
},
inPlaceReplace: {
entry: 'vs/editor/contrib/inPlaceReplace/inPlaceReplace',
worker: undefined,
},
inspectTokens: {
entry: 'vs/editor/standalone/browser/inspectTokens/inspectTokens',
worker: undefined,
},
iPadShowKeyboard: {
entry: 'vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard',
worker: undefined,
},
linesOperations: {
entry: 'vs/editor/contrib/linesOperations/linesOperations',
worker: undefined,
},
links: {
entry: 'vs/editor/contrib/links/links',
worker: undefined,
},
multicursor: {
entry: 'vs/editor/contrib/multicursor/multicursor',
worker: undefined,
},
parameterHints: {
entry: 'vs/editor/contrib/parameterHints/parameterHints',
worker: undefined,
},
quickCommand: {
entry: 'vs/editor/standalone/browser/quickOpen/quickCommand',
worker: undefined,
},
quickOutline: {
entry: 'vs/editor/standalone/browser/quickOpen/quickOutline',
worker: undefined,
},
referenceSearch: {
entry: [
'vs/editor/contrib/referenceSearch/referenceSearch',
'vs/editor/standalone/browser/referenceSearch/standaloneReferenceSearch',
],
worker: undefined,
},
rename: {
entry: 'vs/editor/contrib/rename/rename',
worker: undefined,
},
smartSelect: {
entry: 'vs/editor/contrib/smartSelect/smartSelect',
worker: undefined,
},
snippets: {
entry: 'vs/editor/contrib/snippet/snippetController2',
worker: undefined,
},
suggest: {
entry: 'vs/editor/contrib/suggest/suggestController',
worker: undefined,
},
toggleHighContrast: {
entry: 'vs/editor/standalone/browser/toggleHighContrast/toggleHighContrast',
worker: undefined,
},
toggleTabFocusMode: {
entry: 'vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode',
worker: undefined,
},
transpose: {
entry: 'vs/editor/contrib/caretOperations/transpose',
worker: undefined,
},
wordHighlighter: {
entry: 'vs/editor/contrib/wordHighlighter/wordHighlighter',
worker: undefined,
},
wordOperations: {
entry: 'vs/editor/contrib/wordOperations/wordOperations',
worker: undefined,
},
wordPartOperations: {
entry: 'vs/editor/contrib/wordPartOperations/wordPartOperations',
worker: undefined,
},
};
17 changes: 2 additions & 15 deletions index.js
Expand Up @@ -12,7 +12,6 @@ const EDITOR_MODULE = {
output: 'editor.worker.js',
fallback: undefined
},
alias: undefined,
};
const LANGUAGES = require('./languages');
const FEATURES = require('./features');
Expand All @@ -21,11 +20,7 @@ function resolveMonacoPath(filePath) {
return require.resolve(path.join('monaco-editor/esm', filePath));
}

const languagesById = fromPairs(
flatMap(toPairs(LANGUAGES), ([id, language]) =>
[id].concat(language.alias || []).map((label) => [label, mixin({ label }, language)])
)
);
const languagesById = mapValues(LANGUAGES, (language, id) => mixin({ label: id }, language));
const featuresById = mapValues(FEATURES, (feature, key) => mixin({ label: key }, feature))

function getFeaturesIds(userFeatures, predefinedFeaturesById) {
Expand Down Expand Up @@ -66,7 +61,7 @@ class MonacoWebpackPlugin {
const compilationPublicPath = getCompilationPublicPath(compiler);
const modules = [EDITOR_MODULE].concat(languages).concat(features);
const workers = modules.map(
({ label, alias, worker }) => worker && (mixin({ label, alias }, worker))
({ label, worker }) => worker && (mixin({ label }, worker))
).filter(Boolean);
const rules = createLoaderRules(languages, features, workers, output, publicPath, compilationPublicPath);
const plugins = createPlugins(workers, output);
Expand Down Expand Up @@ -166,10 +161,6 @@ function createPlugins(workers, outputPath) {
);
}

function flatMap(items, iteratee) {
return items.map(iteratee).reduce((acc, item) => [].concat(acc).concat(item), []);
}

function flatArr(items) {
return items.reduce((acc, item) => {
if (Array.isArray(item)) {
Expand All @@ -179,10 +170,6 @@ function flatArr(items) {
}, []);
}

function toPairs(object) {
return Object.keys(object).map((key) => [key, object[key]]);
}

function fromPairs(values) {
return values.reduce((acc, [key, value]) => Object.assign(acc, { [key]: value }), {});
}
Expand Down

0 comments on commit da92d8f

Please sign in to comment.