Skip to content

Commit

Permalink
provide fully synced compilation to custom loader script and resource…
Browse files Browse the repository at this point in the history
… plugins
  • Loading branch information
thescientist13 committed Sep 5, 2024
1 parent 16c2a99 commit 23131fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/cli/src/lifecycles/compile.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { checkResourceExists } from '../lib/resource-utils.js';
import { generateGraph } from './graph.js';
import { initContext } from './context.js';
import { readAndMergeConfig } from './config.js';
import fs from 'fs/promises';
import { readAndMergeConfig as initConfig } from './config.js';

const generateCompilation = () => {
return new Promise(async (resolve, reject) => {
Expand All @@ -20,7 +20,7 @@ const generateCompilation = () => {
};

console.info('Initializing project config');
compilation.config = await initConfig();
compilation.config = await readAndMergeConfig();

// determine whether to use default layout or user detected workspace
console.info('Initializing project workspace contexts');
Expand Down
17 changes: 7 additions & 10 deletions packages/cli/src/loader.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import { readAndMergeConfig as initConfig } from './lifecycles/config.js';
import { readAndMergeConfig } from './lifecycles/config.js';
import { initContext } from './lifecycles/context.js';
import { mergeResponse } from './lib/resource-utils.js';

const config = await initConfig();
const config = await readAndMergeConfig();
const context = await initContext({ config });

const resourcePlugins = config.plugins
.filter(plugin => plugin.type === 'resource')
.filter(plugin => plugin.name !== 'plugin-node-modules:resource' && plugin.name !== 'plugin-user-workspace')
.map(plugin => plugin.provider({
context: {
outputDir: new URL(`file://${process.cwd()}/public`),
projectDirectory: new URL(`file://${process.cwd()}/`),
scratchDir: new URL(`file://${process.cwd()}/.greenwood/`)
},
config: {
devServer: {}
},
context,
config,
graph: []
}));

Expand Down

0 comments on commit 23131fa

Please sign in to comment.