@flexireact/core 1.0.2 → 2.0.0
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/README.md +112 -112
- package/bin/flexireact.js +23 -0
- package/cli/index.ts +9 -21
- package/core/cli/{logger.js → logger.ts} +8 -2
- package/core/client/{hydration.js → hydration.ts} +10 -0
- package/core/client/{islands.js → islands.ts} +6 -1
- package/core/client/{navigation.js → navigation.ts} +10 -2
- package/core/client/{runtime.js → runtime.ts} +16 -0
- package/core/{index.js → index.ts} +2 -1
- package/core/islands/{index.js → index.ts} +16 -4
- package/core/{logger.js → logger.ts} +1 -1
- package/core/middleware/{index.js → index.ts} +32 -9
- package/core/plugins/{index.js → index.ts} +9 -6
- package/core/render/index.ts +1069 -0
- package/core/{render.js → render.ts} +7 -5
- package/core/router/index.ts +543 -0
- package/core/rsc/{index.js → index.ts} +6 -5
- package/core/server/{index.js → index.ts} +25 -6
- package/core/{server.js → server.ts} +8 -2
- package/core/ssg/{index.js → index.ts} +30 -5
- package/core/start-dev.ts +6 -0
- package/core/start-prod.ts +6 -0
- package/core/tsconfig.json +28 -0
- package/core/types.ts +239 -0
- package/package.json +19 -14
- package/cli/index.js +0 -992
- package/core/render/index.js +0 -773
- package/core/router/index.js +0 -296
- /package/core/{api.js → api.ts} +0 -0
- /package/core/build/{index.js → index.ts} +0 -0
- /package/core/client/{index.js → index.ts} +0 -0
- /package/core/{config.js → config.ts} +0 -0
- /package/core/{context.js → context.ts} +0 -0
- /package/core/{dev.js → dev.ts} +0 -0
- /package/core/{loader.js → loader.ts} +0 -0
- /package/core/{router.js → router.ts} +0 -0
- /package/core/{utils.js → utils.ts} +0 -0
|
@@ -65,13 +65,16 @@ export const PluginHooks = {
|
|
|
65
65
|
* Plugin manager class
|
|
66
66
|
*/
|
|
67
67
|
export class PluginManager {
|
|
68
|
+
plugins: any[];
|
|
69
|
+
hooks: Map<string, any[]>;
|
|
70
|
+
|
|
68
71
|
constructor() {
|
|
69
72
|
this.plugins = [];
|
|
70
73
|
this.hooks = new Map();
|
|
71
74
|
|
|
72
75
|
// Initialize hook arrays
|
|
73
76
|
for (const hook of Object.values(PluginHooks)) {
|
|
74
|
-
this.hooks.set(hook, []);
|
|
77
|
+
this.hooks.set(hook as string, []);
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
|
|
@@ -248,7 +251,7 @@ export const builtinPlugins = {
|
|
|
248
251
|
/**
|
|
249
252
|
* Analytics plugin
|
|
250
253
|
*/
|
|
251
|
-
analytics(options = {}) {
|
|
254
|
+
analytics(options: { trackingId?: string } = {}) {
|
|
252
255
|
const { trackingId } = options;
|
|
253
256
|
|
|
254
257
|
return definePlugin({
|
|
@@ -275,7 +278,7 @@ export const builtinPlugins = {
|
|
|
275
278
|
/**
|
|
276
279
|
* PWA plugin
|
|
277
280
|
*/
|
|
278
|
-
pwa(options = {}) {
|
|
281
|
+
pwa(options: { manifest?: string; serviceWorker?: string } = {}) {
|
|
279
282
|
const { manifest = '/manifest.json', serviceWorker = '/sw.js' } = options;
|
|
280
283
|
|
|
281
284
|
return definePlugin({
|
|
@@ -299,7 +302,7 @@ export const builtinPlugins = {
|
|
|
299
302
|
/**
|
|
300
303
|
* SEO plugin
|
|
301
304
|
*/
|
|
302
|
-
seo(options = {}) {
|
|
305
|
+
seo(options: { defaultTitle?: string; titleTemplate?: string; defaultDescription?: string } = {}) {
|
|
303
306
|
const { defaultTitle, titleTemplate = '%s', defaultDescription } = options;
|
|
304
307
|
|
|
305
308
|
return definePlugin({
|
|
@@ -339,8 +342,8 @@ export const builtinPlugins = {
|
|
|
339
342
|
/**
|
|
340
343
|
* Security headers plugin
|
|
341
344
|
*/
|
|
342
|
-
securityHeaders(options = {}) {
|
|
343
|
-
const headers = {
|
|
345
|
+
securityHeaders(options: { headers?: Record<string, string> } = {}) {
|
|
346
|
+
const headers: Record<string, string> = {
|
|
344
347
|
'X-Content-Type-Options': 'nosniff',
|
|
345
348
|
'X-Frame-Options': 'DENY',
|
|
346
349
|
'X-XSS-Protection': '1; mode=block',
|