Commit 664db15a authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Merge branch 'ide' of gitlab.com:gitlab-org/gitlab-ce into ide

parents 8cceeb8b 6a1fadae
/* eslint-disable no-underscore-dangle, camelcase */
/* global __webpack_public_path__ */
import monacoContext from 'monaco-editor/dev/vs/loader';
monacoContext.require.config({
paths: {
vs: `${__webpack_public_path__}monaco-editor/vs`,
},
});
window.__monaco_context__ = monacoContext;
export default monacoContext.require;
......@@ -2,6 +2,7 @@
import Vue from 'vue';
import Store from './repo_store';
import Helper from './repo_helper';
import monacoLoader from './monaco_loader';
export default class RepoEditor {
constructor() {
......@@ -19,8 +20,7 @@ export default class RepoEditor {
}
initMonaco() {
window.require.config({ paths: { vs: '/assets/webpack/vs' } });
window.require(['vs/editor/editor.main'], () => {
monacoLoader(['vs/editor/editor.main'], () => {
this.monacoEditor = monaco.editor
.create(
document.getElementById('ide'), {
......@@ -115,7 +115,7 @@ export default class RepoEditor {
Helper
.getLanguageForFile(
this.activeFile,
monaco.languages.getLanguages()
monaco.languages.getLanguages(),
),
),
);
......
......@@ -7,10 +7,4 @@ module JavascriptHelper
def page_specific_javascript_bundle_tag(bundle)
webpack_bundle_tag(bundle)
end
def repo_bundle_tags
return unless body_data_page =~ /projects\:(tree|blob)\:show/
javascript_include_tag('/assets/webpack/vs/loader') + webpack_bundle_tag('repo')
end
end
......@@ -40,8 +40,6 @@
= webpack_bundle_tag "test" if Rails.env.test?
= webpack_bundle_tag 'peek' if peek_enabled?
= repo_bundle_tags
- if content_for?(:page_specific_javascripts)
= yield :page_specific_javascripts
......
......@@ -4,7 +4,9 @@
= render "projects/commits/head"
- content_for :page_specific_javascripts do
= page_specific_javascript_bundle_tag('blob')
= webpack_bundle_tag 'blob'
= webpack_bundle_tag 'common_vue'
= webpack_bundle_tag 'repo'
= render 'projects/last_push'
......
......@@ -3,6 +3,11 @@
- page_title @path.presence || _("Files"), @ref
= content_for :meta_tags do
= auto_discovery_link_tag(:atom, namespace_project_commits_url(@project.namespace, @project, @ref, rss_url_options), title: "#{@project.name}:#{@ref} commits")
- content_for :page_specific_javascripts do
= webpack_bundle_tag 'common_vue'
= webpack_bundle_tag 'repo'
= render "projects/commits/head"
= render 'projects/last_push'
......
......@@ -4,11 +4,11 @@ var fs = require('fs');
var path = require('path');
var webpack = require('webpack');
var StatsPlugin = require('stats-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var CompressionPlugin = require('compression-webpack-plugin');
var NameAllModulesPlugin = require('name-all-modules-plugin');
var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
var WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var ROOT_PATH = path.resolve(__dirname, '..');
var IS_PRODUCTION = process.env.NODE_ENV === 'production';
......@@ -58,7 +58,7 @@ var config = {
profile: './profile/profile_bundle.js',
protected_branches: './protected_branches/protected_branches_bundle.js',
protected_tags: './protected_tags',
repo: './repo/repo_bundle',
repo: './repo/index.js',
sidebar: './sidebar/sidebar_bundle.js',
schedule_form: './pipeline_schedules/pipeline_schedule_form_bundle.js',
schedules_index: './pipeline_schedules/pipeline_schedules_index_bundle.js',
......@@ -110,7 +110,16 @@ var config = {
test: /locale\/\w+\/(.*)\.js$/,
loader: 'exports-loader?locales',
},
]
{
test: /monaco-editor\/\w+\/vs\/loader\.js$/,
use: [
{ loader: 'exports-loader', options: 'l.global' },
{ loader: 'imports-loader', options: 'l=>{},this=>l,AMDLoader=>this,module=>undefined' },
],
}
],
noParse: [/monaco-editor\/\w+\/vs\//],
},
plugins: [
......@@ -168,6 +177,7 @@ var config = {
'pdf_viewer',
'pipelines',
'pipelines_details',
'repo',
'schedule_form',
'schedules_index',
'sidebar',
......@@ -193,10 +203,22 @@ var config = {
names: ['main', 'locale', 'common', 'runtime'],
}),
// copy pre-compiled vendor libraries verbatim
new CopyWebpackPlugin([
{
from: `../../../node_modules/monaco-editor/${IS_PRODUCTION ? 'min' : 'dev'}/vs`,
to: 'vs'
from: path.join(ROOT_PATH, `node_modules/monaco-editor/${IS_PRODUCTION ? 'min' : 'dev'}/vs`),
to: 'monaco-editor/vs',
transform: function(content, path) {
if (/\.js$/.test(path)) {
return (
'(function(){\n' +
'var define = this.define, require = this.require;\n' +
content +
'\n}.call(window.__monaco_context__ || (window.__monaco_context__ = {})));'
);
}
return content;
}
}
]),
],
......
......@@ -2764,6 +2764,13 @@ immediate@~3.0.5:
version "3.0.6"
resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.0.6.tgz#9db1dbd0faf8de6fbe0f5dd5e56bb606280de69b"
imports-loader@^0.7.1:
version "0.7.1"
resolved "https://registry.yarnpkg.com/imports-loader/-/imports-loader-0.7.1.tgz#f204b5f34702a32c1db7d48d89d5e867a0441253"
dependencies:
loader-utils "^1.0.2"
source-map "^0.5.6"
imurmurhash@^0.1.4:
version "0.1.4"
resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment