mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Update static/index to match what we do on master
This commit is contained in:
@@ -27,8 +27,8 @@ function buildBundledPackagesMetadata () {
|
||||
const packagePath = path.join(CONFIG.intermediateAppPath, 'node_modules', packageName)
|
||||
const packageMetadataPath = path.join(packagePath, 'package.json')
|
||||
const packageMetadata = JSON.parse(fs.readFileSync(packageMetadataPath, 'utf8'))
|
||||
normalizePackageData(packageMetadata, () => {
|
||||
throw new Error(`Invalid package metadata. ${metadata.name}: ${msg}`)
|
||||
normalizePackageData(packageMetadata, (msg) => {
|
||||
console.warn(`Invalid package metadata. ${packageMetadata.name}: ${msg}`)
|
||||
}, true)
|
||||
if (packageMetadata.repository && packageMetadata.repository.url && packageMetadata.repository.type === 'git') {
|
||||
packageMetadata.repository.url = packageMetadata.repository.url.replace(/^git\+/, '')
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
const Module = require('module')
|
||||
const Path = require('path')
|
||||
const vm = require('vm')
|
||||
const {remote, ipcRenderer} = require('electron')
|
||||
|
||||
if (typeof snapshotResult !== 'undefined') {
|
||||
window.onload = function () {
|
||||
@@ -11,8 +12,17 @@
|
||||
console.error('Unhandled promise rejection %o with error: %o', promise, error)
|
||||
})
|
||||
|
||||
parseLoadSettings()
|
||||
setupAtomHome()
|
||||
loadSettings = remote.getCurrentWindow().loadSettings
|
||||
|
||||
if (!process.env.ATOM_HOME) {
|
||||
// Ensure ATOM_HOME is always set before anything else is required
|
||||
// This is because of a difference in Linux not inherited between browser and render processes
|
||||
// https://github.com/atom/atom/issues/5412
|
||||
if (loadSettings && loadSettings.atomHome) {
|
||||
process.env.ATOM_HOME = loadSettings.atomHome
|
||||
}
|
||||
}
|
||||
|
||||
require('../src/crash-reporter-start')({_version: loadSettings.appVersion})
|
||||
|
||||
const entryPointDirPath = __dirname
|
||||
@@ -32,70 +42,7 @@
|
||||
CompileCache.setAtomHomeDirectory(process.env.ATOM_HOME)
|
||||
|
||||
const initialize = snapshotResult.customRequire('../src/initialize-application-window.js')
|
||||
initialize()
|
||||
}
|
||||
}
|
||||
|
||||
function setupVmCompatibility () {
|
||||
var vm = require('vm')
|
||||
if (!vm.Script.createContext) {
|
||||
vm.Script.createContext = vm.createContext
|
||||
}
|
||||
}
|
||||
|
||||
function setupDeprecatedPackages () {
|
||||
var metadata = require('../package.json')
|
||||
if (!metadata._deprecatedPackages) {
|
||||
try {
|
||||
metadata._deprecatedPackages = require('../script/deprecated-packages.json')
|
||||
} catch (requireError) {
|
||||
console.error('Failed to setup deprecated packages list', requireError.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function profileStartup (loadSettings, initialTime) {
|
||||
function profile () {
|
||||
console.profile('startup')
|
||||
var startTime = Date.now()
|
||||
setupWindow(loadSettings).then(function () {
|
||||
setLoadTime(Date.now() - startTime + initialTime)
|
||||
console.profileEnd('startup')
|
||||
console.log('Switch to the Profiles tab to view the created startup profile')
|
||||
})
|
||||
}
|
||||
|
||||
var currentWindow = require('electron').remote.getCurrentWindow()
|
||||
if (currentWindow.devToolsWebContents) {
|
||||
profile()
|
||||
} else {
|
||||
currentWindow.openDevTools()
|
||||
currentWindow.once('devtools-opened', function () {
|
||||
setTimeout(profile, 1000)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function parseLoadSettings () {
|
||||
var rawLoadSettings = decodeURIComponent(window.location.hash.substr(1))
|
||||
try {
|
||||
loadSettings = JSON.parse(rawLoadSettings)
|
||||
} catch (error) {
|
||||
console.error('Failed to parse load settings: ' + rawLoadSettings)
|
||||
loadSettingsError = error
|
||||
}
|
||||
}
|
||||
|
||||
var setupAtomHome = function () {
|
||||
if (process.env.ATOM_HOME) {
|
||||
return
|
||||
}
|
||||
|
||||
// Ensure ATOM_HOME is always set before anything else is required
|
||||
// This is because of a difference in Linux not inherited between browser and render processes
|
||||
// https://github.com/atom/atom/issues/5412
|
||||
if (loadSettings && loadSettings.atomHome) {
|
||||
process.env.ATOM_HOME = loadSettings.atomHome
|
||||
initialize().then(() => { ipcRenderer.send('window-command', 'window:loaded') })
|
||||
}
|
||||
}
|
||||
})()
|
||||
|
||||
Reference in New Issue
Block a user