File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed
Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 11import type { Plugin } from 'esbuild' ;
22import path from 'path' ;
33import { ConfigLoadingOptions , loadValidatedConfig } from '@app-config/config' ;
4- import { generateModuleText , packageNameRegex } from '@app-config/utils' ;
4+ import { appConfigImportRegex , generateModuleText , packageNameRegex } from '@app-config/utils' ;
55import type { SchemaLoadingOptions } from '@app-config/schema' ;
66
77export interface Options {
@@ -24,6 +24,11 @@ export const createPlugin = ({
2424 namespace : '@app-config/esbuild' ,
2525 } ) ) ;
2626
27+ build . onResolve ( { filter : appConfigImportRegex } , ( args ) => ( {
28+ path : args . path ,
29+ namespace : '@app-config/esbuild' ,
30+ } ) ) ;
31+
2732 build . onLoad ( { filter : / .* / , namespace : '@app-config/esbuild' } , async ( ) => {
2833 const { fullConfig, environment, validationFunctionCode, filePaths } =
2934 await loadValidatedConfig ( loadingOptions , schemaLoadingOptions ) ;
Original file line number Diff line number Diff line change 11import type { Plugin } from 'rollup' ;
2- import { generateModuleText , packageNameRegex } from '@app-config/utils' ;
2+ import { appConfigImportRegex , generateModuleText , packageNameRegex } from '@app-config/utils' ;
33import { ConfigLoadingOptions , loadValidatedConfig } from '@app-config/config' ;
44import type { SchemaLoadingOptions } from '@app-config/schema' ;
55
@@ -13,10 +13,6 @@ export interface Options {
1313 readGlobal ?: boolean ;
1414}
1515
16- // vite resolves first before passing to the rollup plugin
17- export const appConfigImportRegex =
18- / ( a p p - c o n f i g | a p p - c o n f i g - m a i n | @ a p p - c o n f i g \/ m a i n ) \/ d i s t ( \/ e s ) ? \/ i n d e x \. j s / ;
19-
2016export default function appConfigRollup (
2117 options : Options = { } ,
2218) : Plugin & { currentFilePaths ?: string [ ] } {
Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ export const isWindows = isNode && /^win/.test(process.platform);
77export const packageNameRegex =
88 / ( ^ @ ( l c d e v | s e r v a l l ) \/ a p p - c o n f i g ) | ( ^ @ a p p - c o n f i g \/ m a i n ) | ( \. ? a p p - c o n f i g ( \. \w + ) ? \. ( t o m l | y m l | y a m l | j s o n | j s o n 5 ) ) | ( \. c o n f i g - p l a c e h o l d e r ) / ;
99
10+ export const appConfigImportRegex =
11+ / ( a p p - c o n f i g | a p p - c o n f i g - m a i n | @ a p p - c o n f i g \/ m a i n ) \/ d i s t ( \/ e s ) ? \/ i n d e x \. j s / ;
12+
1013export type JsonPrimitive = number | string | boolean | null ;
1114
1215export interface JsonObject {
You can’t perform that action at this time.
0 commit comments