@jsarc/initiator 0.0.1-beta.0.1 → 0.0.1-beta.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/js/provider.js +4 -20
- package/package.json +1 -1
- package/provider.ts +4 -20
package/js/provider.js
CHANGED
|
@@ -216,20 +216,8 @@ export class ProviderGenerator {
|
|
|
216
216
|
}
|
|
217
217
|
});
|
|
218
218
|
const imports = [
|
|
219
|
-
`import React, {
|
|
220
|
-
`import { Suspense } from 'react';`,
|
|
219
|
+
`import React, { lazy } from 'react';`,
|
|
221
220
|
``,
|
|
222
|
-
`// Loading fallback component`,
|
|
223
|
-
`const LoadingFallback = ({ children }: { children: ReactNode }) => (`,
|
|
224
|
-
` <div style={{`,
|
|
225
|
-
` display: 'flex',`,
|
|
226
|
-
` justifyContent: 'center',`,
|
|
227
|
-
` alignItems: 'center',`,
|
|
228
|
-
` minHeight: '100vh'`,
|
|
229
|
-
` }}>`,
|
|
230
|
-
` <div>Loading...</div>`,
|
|
231
|
-
` </div>`,
|
|
232
|
-
`);`,
|
|
233
221
|
``
|
|
234
222
|
];
|
|
235
223
|
const allProviders = [...globalProviders, ...Object.values(providersByModule).flat()];
|
|
@@ -248,7 +236,7 @@ export class ProviderGenerator {
|
|
|
248
236
|
sortedModuleProviders.forEach(provider => {
|
|
249
237
|
nestedJSX = `<${provider.componentName}>\n ${nestedJSX}\n </${provider.componentName}>`;
|
|
250
238
|
});
|
|
251
|
-
moduleComponents.push(`const ${componentName} = ({ children }
|
|
239
|
+
moduleComponents.push(`const ${componentName} = ({ children }) => (
|
|
252
240
|
${nestedJSX}
|
|
253
241
|
);`);
|
|
254
242
|
moduleComponents.push(``);
|
|
@@ -258,7 +246,7 @@ export class ProviderGenerator {
|
|
|
258
246
|
sortedGlobalProviders.forEach(provider => {
|
|
259
247
|
globalNestedJSX = `<${provider.componentName}>\n ${globalNestedJSX}\n </${provider.componentName}>`;
|
|
260
248
|
});
|
|
261
|
-
moduleComponents.push(`const GlobalProviders = ({ children }
|
|
249
|
+
moduleComponents.push(`const GlobalProviders = ({ children }) => (
|
|
262
250
|
${globalNestedJSX}
|
|
263
251
|
);`);
|
|
264
252
|
moduleComponents.push(``);
|
|
@@ -270,11 +258,7 @@ export class ProviderGenerator {
|
|
|
270
258
|
mainNestedJSX = `<${componentName}>\n ${mainNestedJSX}\n </${componentName}>`;
|
|
271
259
|
});
|
|
272
260
|
mainNestedJSX = `<GlobalProviders>\n ${mainNestedJSX}\n</GlobalProviders>`;
|
|
273
|
-
moduleComponents.push(`export const AppProvider = ({ children }
|
|
274
|
-
<Suspense fallback={<LoadingFallback>{children}</LoadingFallback>}>
|
|
275
|
-
${mainNestedJSX}
|
|
276
|
-
</Suspense>
|
|
277
|
-
);`);
|
|
261
|
+
moduleComponents.push(`export const AppProvider = ({ children }) => (<>${mainNestedJSX}</>);`);
|
|
278
262
|
moduleComponents.push(``);
|
|
279
263
|
moduleComponents.push(`export default AppProvider;`);
|
|
280
264
|
return [
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.0.1-beta.0.
|
|
6
|
+
"version": "0.0.1-beta.0.2",
|
|
7
7
|
"description": "INITIATOR est un plugin d'initialisation intelligent pour les applications React avec TypeScript/Javascript. Il génère automatiquement les fichiers de configuration, de routage et d'internationalisation basés sur la structure de votre projet.",
|
|
8
8
|
"main": "index.ts",
|
|
9
9
|
"keywords": [],
|
package/provider.ts
CHANGED
|
@@ -289,20 +289,8 @@ export class ProviderGenerator {
|
|
|
289
289
|
});
|
|
290
290
|
|
|
291
291
|
const imports: string[] = [
|
|
292
|
-
`import React, {
|
|
293
|
-
`import { Suspense } from 'react';`,
|
|
292
|
+
`import React, { lazy } from 'react';`,
|
|
294
293
|
``,
|
|
295
|
-
`// Loading fallback component`,
|
|
296
|
-
`const LoadingFallback = ({ children }: { children: ReactNode }) => (`,
|
|
297
|
-
` <div style={{`,
|
|
298
|
-
` display: 'flex',`,
|
|
299
|
-
` justifyContent: 'center',`,
|
|
300
|
-
` alignItems: 'center',`,
|
|
301
|
-
` minHeight: '100vh'`,
|
|
302
|
-
` }}>`,
|
|
303
|
-
` <div>Loading...</div>`,
|
|
304
|
-
` </div>`,
|
|
305
|
-
`);`,
|
|
306
294
|
``
|
|
307
295
|
];
|
|
308
296
|
|
|
@@ -330,7 +318,7 @@ export class ProviderGenerator {
|
|
|
330
318
|
nestedJSX = `<${provider.componentName}>\n ${nestedJSX}\n </${provider.componentName}>`;
|
|
331
319
|
});
|
|
332
320
|
|
|
333
|
-
moduleComponents.push(`const ${componentName} = ({ children }
|
|
321
|
+
moduleComponents.push(`const ${componentName} = ({ children }) => (
|
|
334
322
|
${nestedJSX}
|
|
335
323
|
);`);
|
|
336
324
|
|
|
@@ -343,7 +331,7 @@ export class ProviderGenerator {
|
|
|
343
331
|
globalNestedJSX = `<${provider.componentName}>\n ${globalNestedJSX}\n </${provider.componentName}>`;
|
|
344
332
|
});
|
|
345
333
|
|
|
346
|
-
moduleComponents.push(`const GlobalProviders = ({ children }
|
|
334
|
+
moduleComponents.push(`const GlobalProviders = ({ children }) => (
|
|
347
335
|
${globalNestedJSX}
|
|
348
336
|
);`);
|
|
349
337
|
moduleComponents.push(``);
|
|
@@ -360,11 +348,7 @@ export class ProviderGenerator {
|
|
|
360
348
|
|
|
361
349
|
mainNestedJSX = `<GlobalProviders>\n ${mainNestedJSX}\n</GlobalProviders>`;
|
|
362
350
|
|
|
363
|
-
moduleComponents.push(`export const AppProvider = ({ children }
|
|
364
|
-
<Suspense fallback={<LoadingFallback>{children}</LoadingFallback>}>
|
|
365
|
-
${mainNestedJSX}
|
|
366
|
-
</Suspense>
|
|
367
|
-
);`);
|
|
351
|
+
moduleComponents.push(`export const AppProvider = ({ children }) => (<>${mainNestedJSX}</>);`);
|
|
368
352
|
|
|
369
353
|
moduleComponents.push(``);
|
|
370
354
|
moduleComponents.push(`export default AppProvider;`);
|