mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
Merge pull request #15120 from overleaf/jpa-mj-val-loader
[web] migrate modules-ide/modules-main from val-loader to babel macro GitOrigin-RevId: 5114dab96d5bf34285ae42f539fed78e2f068a12
This commit is contained in:
@@ -1,25 +1,3 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
import importOverleafModules from '../frontend/macros/import-overleaf-module.macro'
|
||||
|
||||
const MODULES_PATH = path.join(__dirname, './')
|
||||
|
||||
const entryPoints = []
|
||||
if (fs.existsSync(MODULES_PATH)) {
|
||||
fs.readdirSync(MODULES_PATH).reduce((acc, module) => {
|
||||
const entryPath = path.join(
|
||||
MODULES_PATH,
|
||||
module,
|
||||
'/frontend/js/ide/index.js'
|
||||
)
|
||||
if (fs.existsSync(entryPath)) {
|
||||
acc.push(entryPath)
|
||||
}
|
||||
return acc
|
||||
}, entryPoints)
|
||||
}
|
||||
|
||||
module.exports = function () {
|
||||
return {
|
||||
code: entryPoints.map(entryPoint => `import '${entryPoint}'`).join('\n'),
|
||||
}
|
||||
}
|
||||
export default importOverleafModules('entryPointsIde')
|
||||
|
||||
@@ -1,25 +1,3 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
import importOverleafModules from '../frontend/macros/import-overleaf-module.macro'
|
||||
|
||||
const MODULES_PATH = path.join(__dirname, './')
|
||||
|
||||
const entryPoints = []
|
||||
if (fs.existsSync(MODULES_PATH)) {
|
||||
fs.readdirSync(MODULES_PATH).reduce((acc, module) => {
|
||||
const entryPath = path.join(
|
||||
MODULES_PATH,
|
||||
module,
|
||||
'/frontend/js/main/index.js'
|
||||
)
|
||||
if (fs.existsSync(entryPath)) {
|
||||
acc.push(entryPath)
|
||||
}
|
||||
return acc
|
||||
}, entryPoints)
|
||||
}
|
||||
|
||||
module.exports = function () {
|
||||
return {
|
||||
code: entryPoints.map(entryPoint => `import '${entryPoint}'`).join('\n'),
|
||||
}
|
||||
}
|
||||
export default importOverleafModules('entryPointsMain')
|
||||
|
||||
Reference in New Issue
Block a user