Skip to content

Commit cc2e0ce

Browse files
committed
chore: rename to noBundledConfig
1 parent fd8d987 commit cc2e0ce

File tree

9 files changed

+33
-33
lines changed

9 files changed

+33
-33
lines changed

app-config-esbuild/src/__snapshots__/index.test.ts.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ exports[`loads validation function 1`] = `
1515
"
1616
`;
1717

18-
exports[`loads with doNotLoadConfig 1`] = `
18+
exports[`loads with noBundledConfig 1`] = `
1919
"(()=>{var v=(typeof window==\\"undefined\\"?globalThis:window)||{},i=v._appConfig;if(typeof i==\\"undefined\\")throw new Error(\\"Config is not loaded in _appConfig\\");function m(){let s={};return function(p){\\"use strict\\";p.exports=n,p.exports.default=n;var P={type:\\"object\\",additionalProperties:!1,properties:{foo:{type:\\"string\\"}},$schema:\\"http://json-schema.org/draft-07/schema#\\"};function n(o,t){\\"use strict\\";if(t)var r=t.dataPath,h=t.parentData,g=t.parentDataProperty,y=t.rootData;else var r=\\"\\",h=void 0,g=void 0,y=o;var e=null,a=0;if(o&&typeof o==\\"object\\"&&!Array.isArray(o)){for(var f in o)if(f!==\\"foo\\"){var d={keyword:\\"additionalProperties\\",dataPath:r,schemaPath:\\"#/additionalProperties\\",params:{additionalProperty:f},message:\\"should NOT have additional properties\\"};e===null?e=[d]:e.push(d),a++}if(o.foo!==void 0&&typeof o.foo!=\\"string\\"){var l={keyword:\\"type\\",dataPath:r+\\"/foo\\",schemaPath:\\"#/properties/foo/type\\",params:{type:\\"string\\"},message:\\"should be string\\"};e===null?e=[l]:e.push(l),a++}}else{var u={keyword:\\"type\\",dataPath:r,schemaPath:\\"#/type\\",params:{type:\\"object\\"},message:\\"should be object\\"};e===null?e=[u]:e.push(u),a++}return n.errors=e,a===0}}(s),s.exports}var c=m();c(i);})();
2020
"
2121
`;
2222

23-
exports[`loads with doNotLoadConfig and no validation function 1`] = `
23+
exports[`loads with noBundledConfig and no validation function 1`] = `
2424
"(()=>{var o=(typeof window==\\"undefined\\"?globalThis:window)||{},n=o._appConfig;if(typeof n==\\"undefined\\")throw new Error(\\"Config is not loaded in _appConfig\\");console.log(n);})();
2525
"
2626
`;

app-config-esbuild/src/index.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ it('loads currentEnvironment', () =>
122122
},
123123
));
124124

125-
it('loads with doNotLoadConfig', () =>
125+
it('loads with noBundledConfig', () =>
126126
withTempFiles(
127127
{
128128
'.app-config.schema.yml': `
@@ -141,7 +141,7 @@ it('loads with doNotLoadConfig', () =>
141141
const res = await build({
142142
entryPoints: [inDir('a.js')],
143143
plugins: [
144-
createPlugin({ schemaLoadingOptions: { directory: inDir('.') }, doNotLoadConfig: true }),
144+
createPlugin({ schemaLoadingOptions: { directory: inDir('.') }, noBundledConfig: true }),
145145
],
146146
bundle: true,
147147
minify: true,
@@ -152,7 +152,7 @@ it('loads with doNotLoadConfig', () =>
152152
},
153153
));
154154

155-
it('loads with doNotLoadConfig and no validation function', () =>
155+
it('loads with noBundledConfig and no validation function', () =>
156156
withTempFiles(
157157
{
158158
'.app-config.schema.yml': `
@@ -173,7 +173,7 @@ it('loads with doNotLoadConfig and no validation function', () =>
173173
plugins: [
174174
createPlugin({
175175
schemaLoadingOptions: { directory: inDir('.') },
176-
doNotLoadConfig: true,
176+
noBundledConfig: true,
177177
injectValidationFunction: false,
178178
}),
179179
],

app-config-esbuild/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ export interface Options {
99
loadingOptions?: ConfigLoadingOptions;
1010
schemaLoadingOptions?: SchemaLoadingOptions;
1111
injectValidationFunction?: boolean;
12-
doNotLoadConfig?: boolean;
12+
noBundledConfig?: boolean;
1313
}
1414

1515
export const createPlugin = ({
1616
useGlobalNamespace = true,
1717
loadingOptions,
1818
schemaLoadingOptions,
1919
injectValidationFunction = true,
20-
doNotLoadConfig = false,
20+
noBundledConfig = false,
2121
}: Options = {}): Plugin => ({
2222
name: '@app-config/esbuild',
2323
setup(build) {
@@ -27,7 +27,7 @@ export const createPlugin = ({
2727
}));
2828

2929
build.onLoad({ filter: /.*/, namespace: '@app-config/esbuild' }, async () => {
30-
if (doNotLoadConfig) {
30+
if (noBundledConfig) {
3131
const { validationFunctionCode } = await loadSchema(schemaLoadingOptions);
3232

3333
const code = generateModuleText('no-config', {

app-config-rollup/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export interface Options {
88
loadingOptions?: ConfigLoadingOptions;
99
schemaLoadingOptions?: SchemaLoadingOptions;
1010
injectValidationFunction?: boolean;
11-
doNotLoadConfig?: boolean;
11+
noBundledConfig?: boolean;
1212

1313
/** @deprecated use useGlobalNamespace instead */
1414
readGlobal?: boolean;
@@ -22,7 +22,7 @@ export default function appConfigRollup({
2222
loadingOptions,
2323
schemaLoadingOptions,
2424
injectValidationFunction,
25-
doNotLoadConfig = false,
25+
noBundledConfig = false,
2626

2727
readGlobal,
2828
}: Options = {}): Plugin & { currentFilePaths?: string[] } {
@@ -40,7 +40,7 @@ export default function appConfigRollup({
4040
},
4141
async load(id) {
4242
if (packageNameRegex.exec(id) || appConfigImportRegex.exec(id)) {
43-
if (doNotLoadConfig) {
43+
if (noBundledConfig) {
4444
const { validationFunctionCode } = await loadSchema(schemaLoadingOptions);
4545

4646
return generateModuleText('no-config', {

app-config-utils/src/__snapshots__/index.test.ts.snap

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ exports[`generateModuleText creates config module 1`] = `
66
77
export { config };
88
export default config;
9-
9+
1010
export function currentEnvironment() {
1111
return \\"test\\";
1212
}
1313
"
1414
`;
1515

16-
exports[`generateModuleText creates config module with doNotLoadConfig 1`] = `
16+
exports[`generateModuleText creates config module with noBundledConfig 1`] = `
1717
"
1818
const globalNamespace = (typeof window === 'undefined' ? globalThis : window) || {};
1919
@@ -25,7 +25,7 @@ exports[`generateModuleText creates config module with doNotLoadConfig 1`] = `
2525
2626
export { config };
2727
export default config;
28-
28+
2929
export function currentEnvironment() {
3030
return globalNamespace._appConfigEnvironment || \\"test\\";
3131
}
@@ -51,19 +51,19 @@ exports[`generateModuleText creates config module with esm validation function 1
5151
5252
export { config };
5353
export default config;
54-
54+
5555
const foo = 'bar';
5656
57-
57+
5858
function genValidateConfig(){
5959
const validateConfigModule = {};
6060
(function(module){import foo from \\"bar\\";})(validateConfigModule);
6161
return validateConfigModule.exports;
6262
}
6363
64-
64+
6565
export const validateConfig = /*#__PURE__*/ genValidateConfig();
66-
66+
6767
export function currentEnvironment() {
6868
return globalNamespace._appConfigEnvironment || \\"test\\";
6969
}
@@ -89,7 +89,7 @@ exports[`generateModuleText creates config module with global namespace 1`] = `
8989
9090
export { config };
9191
export default config;
92-
92+
9393
export function currentEnvironment() {
9494
return globalNamespace._appConfigEnvironment || \\"test\\";
9595
}
@@ -115,8 +115,8 @@ exports[`generateModuleText creates config module with validation function 1`] =
115115
116116
export { config };
117117
export default config;
118-
119-
118+
119+
120120
function genValidateConfig(){
121121
const validateConfigModule = {};
122122
(function(module){
@@ -125,9 +125,9 @@ exports[`generateModuleText creates config module with validation function 1`] =
125125
return validateConfigModule.exports;
126126
}
127127
128-
128+
129129
export const validateConfig = /*#__PURE__*/ genValidateConfig();
130-
130+
131131
export function currentEnvironment() {
132132
return globalNamespace._appConfigEnvironment || \\"test\\";
133133
}

app-config-utils/src/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('generateModuleText', () => {
5959
).toMatchSnapshot();
6060
});
6161

62-
it('creates config module with doNotLoadConfig', () => {
62+
it('creates config module with noBundledConfig', () => {
6363
expect(
6464
generateModuleText('no-config', {
6565
environment: 'test',

app-config-webpack/src/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,12 @@ describe('frontend-webpack-project example', () => {
285285
});
286286
});
287287

288-
it('builds the project with doNotLoadConfig', async () => {
288+
it('builds the project with noBundledConfig', async () => {
289289
process.env.APP_CONFIG = 'null';
290290
process.env.APP_CONFIG_ENV = 'test';
291291

292292
await new Promise<void>((done, reject) => {
293-
webpack([createOptions({ doNotLoadConfig: true })], (err, stats) => {
293+
webpack([createOptions({ noBundledConfig: true })], (err, stats) => {
294294
if (err) return reject(err);
295295
if (!stats) return reject(new Error('no stats'));
296296
if (stats.hasErrors()) reject(stats.toString());

app-config-webpack/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export interface Options {
1515
schemaLoadingOptions?: SchemaLoadingOptions;
1616
intercept?: RegExp;
1717
injectValidationFunction?: boolean;
18-
doNotLoadConfig?: boolean;
18+
noBundledConfig?: boolean;
1919

2020
/** @deprecated use useGlobalNamespace instead */
2121
noGlobal?: boolean;
@@ -31,7 +31,7 @@ export default class AppConfigPlugin implements Options {
3131
loadingOptions?: ConfigLoadingOptions;
3232
schemaLoadingOptions?: SchemaLoadingOptions;
3333
injectValidationFunction: boolean;
34-
doNotLoadConfig: boolean;
34+
noBundledConfig: boolean;
3535
intercept: RegExp;
3636

3737
constructor(options: Options = {}) {
@@ -40,7 +40,7 @@ export default class AppConfigPlugin implements Options {
4040
this.loadingOptions = options.loadingOptions ?? options.loading;
4141
this.schemaLoadingOptions = options.schemaLoadingOptions ?? options.schemaLoading;
4242
this.injectValidationFunction = options.injectValidationFunction ?? true;
43-
this.doNotLoadConfig = options.doNotLoadConfig ?? false;
43+
this.noBundledConfig = options.noBundledConfig ?? false;
4444
this.intercept = options.intercept ?? AppConfigPlugin.regex;
4545
}
4646

@@ -69,7 +69,7 @@ export default class AppConfigPlugin implements Options {
6969
loadingOptions: this.loadingOptions,
7070
schemaLoadingOptions: this.schemaLoadingOptions,
7171
injectValidationFunction: this.injectValidationFunction,
72-
doNotLoadConfig: this.doNotLoadConfig,
72+
noBundledConfig: this.noBundledConfig,
7373

7474
// deprecated options
7575
noGlobal: !this.useGlobalNamespace,

app-config-webpack/src/loader.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ const loader = function AppConfigLoader(this: Loader) {
2020
const loadingOptions = options.loadingOptions ?? options.loading ?? {};
2121
const schemaLoadingOptions = options.schemaLoadingOptions ?? options.schemaLoading;
2222
const injectValidationFunction = options.injectValidationFunction ?? true;
23-
const doNotLoadConfig = options.doNotLoadConfig ?? false;
23+
const noBundledConfig = options.noBundledConfig ?? false;
2424

25-
if (doNotLoadConfig) {
25+
if (noBundledConfig) {
2626
loadSchema(schemaLoadingOptions)
2727
.then(({ validationFunctionCode }) => {
2828
callback(

0 commit comments

Comments
 (0)