@djangocfg/ext-base 1.0.5 → 1.0.7

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/dist/api.js CHANGED
@@ -1,2 +1,2 @@
1
- export { createExtensionAPI, getSharedAuthStorage } from './chunk-NXFE5CDE.js';
1
+ export { createExtensionAPI, getSharedAuthStorage } from './chunk-ZUKKEJUN.js';
2
2
  import './chunk-3RG5ZIWI.js';
@@ -1,4 +1,4 @@
1
- import { package_default } from './chunk-NXFE5CDE.js';
1
+ import { package_default } from './chunk-ZUKKEJUN.js';
2
2
  import { createConsola } from 'consola';
3
3
 
4
4
  // src/types/context.ts
@@ -3,7 +3,7 @@ import { __require } from './chunk-3RG5ZIWI.js';
3
3
  // package.json
4
4
  var package_default = {
5
5
  name: "@djangocfg/ext-base",
6
- version: "1.0.5",
6
+ version: "1.0.6",
7
7
  description: "Base utilities and common code for DjangoCFG extensions",
8
8
  keywords: [
9
9
  "django",
package/dist/cli.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { consola } from 'consola';
3
2
  import chalk from 'chalk';
4
- import prompts from 'prompts';
3
+ import { execSync } from 'child_process';
4
+ import { consola } from 'consola';
5
5
  import { existsSync, readdirSync, readFileSync, writeFileSync, statSync, mkdirSync } from 'fs';
6
6
  import { dirname, join } from 'path';
7
+ import prompts from 'prompts';
7
8
  import { fileURLToPath } from 'url';
8
- import { execSync } from 'child_process';
9
9
 
10
10
  // src/types/context.ts
11
11
  var EXTENSION_CATEGORIES = [
package/dist/hooks.cjs CHANGED
@@ -30,57 +30,10 @@ var EXTENSION_CATEGORIES = [
30
30
  { title: "Other", value: "other" }
31
31
  ];
32
32
 
33
- // src/utils/createExtensionConfig.ts
34
- function replaceWorkspaceDeps(deps) {
35
- if (!deps) return void 0;
36
- const result = {};
37
- for (const [key, value] of Object.entries(deps)) {
38
- result[key] = value === "workspace:*" ? "latest" : value;
39
- }
40
- return result;
41
- }
42
- function createExtensionConfig(packageJson, config) {
43
- const author = typeof packageJson.author === "string" ? packageJson.author : packageJson.author?.name || "Unknown";
44
- const githubUrl = typeof packageJson.repository === "string" ? packageJson.repository : packageJson.repository?.url;
45
- const packageNameWithoutScope = packageJson.name.split("/").pop() || packageJson.name;
46
- const downloadUrl = `https://registry.npmjs.org/${packageJson.name}/-/${packageNameWithoutScope}-${packageJson.version}.tgz`;
47
- const marketplaceId = packageJson.name.replace("@", "").replace("/", "-");
48
- return {
49
- // From package.json
50
- name: config.name,
51
- version: packageJson.version,
52
- author,
53
- description: packageJson.description,
54
- keywords: packageJson.keywords,
55
- license: packageJson.license,
56
- homepage: packageJson.homepage,
57
- githubUrl,
58
- packageDependencies: replaceWorkspaceDeps(packageJson.dependencies),
59
- packagePeerDependencies: replaceWorkspaceDeps(packageJson.peerDependencies),
60
- packageDevDependencies: replaceWorkspaceDeps(packageJson.devDependencies),
61
- // From manual config
62
- displayName: config.displayName,
63
- category: config.category,
64
- features: config.features,
65
- examples: config.examples,
66
- minVersion: config.minVersion,
67
- githubStars: config.githubStars,
68
- // Auto-generated
69
- npmUrl: `https://www.npmjs.com/package/${packageJson.name}`,
70
- marketplaceId,
71
- // Only generate marketplace URL for official @djangocfg extensions
72
- marketplaceUrl: packageJson.name.startsWith("@djangocfg/ext-") ? `https://hub.djangocfg.com/extensions/${marketplaceId}` : void 0,
73
- installCommand: `pnpm add ${packageJson.name}`,
74
- downloadUrl,
75
- tags: packageJson.keywords,
76
- preview: `https://unpkg.com/${packageJson.name}@latest/preview.png`
77
- };
78
- }
79
-
80
33
  // package.json
81
34
  var package_default = {
82
35
  name: "@djangocfg/ext-base",
83
- version: "1.0.5",
36
+ version: "1.0.6",
84
37
  description: "Base utilities and common code for DjangoCFG extensions",
85
38
  keywords: [
86
39
  "django",
@@ -128,6 +81,53 @@ var package_default = {
128
81
  }
129
82
  };
130
83
 
84
+ // src/utils/createExtensionConfig.ts
85
+ function replaceWorkspaceDeps(deps) {
86
+ if (!deps) return void 0;
87
+ const result = {};
88
+ for (const [key, value] of Object.entries(deps)) {
89
+ result[key] = value === "workspace:*" ? "latest" : value;
90
+ }
91
+ return result;
92
+ }
93
+ function createExtensionConfig(packageJson, config) {
94
+ const author = typeof packageJson.author === "string" ? packageJson.author : packageJson.author?.name || "Unknown";
95
+ const githubUrl = typeof packageJson.repository === "string" ? packageJson.repository : packageJson.repository?.url;
96
+ const packageNameWithoutScope = packageJson.name.split("/").pop() || packageJson.name;
97
+ const downloadUrl = `https://registry.npmjs.org/${packageJson.name}/-/${packageNameWithoutScope}-${packageJson.version}.tgz`;
98
+ const marketplaceId = packageJson.name.replace("@", "").replace("/", "-");
99
+ return {
100
+ // From package.json
101
+ name: config.name,
102
+ version: packageJson.version,
103
+ author,
104
+ description: packageJson.description,
105
+ keywords: packageJson.keywords,
106
+ license: packageJson.license,
107
+ homepage: packageJson.homepage,
108
+ githubUrl,
109
+ packageDependencies: replaceWorkspaceDeps(packageJson.dependencies),
110
+ packagePeerDependencies: replaceWorkspaceDeps(packageJson.peerDependencies),
111
+ packageDevDependencies: replaceWorkspaceDeps(packageJson.devDependencies),
112
+ // From manual config
113
+ displayName: config.displayName,
114
+ category: config.category,
115
+ features: config.features,
116
+ examples: config.examples,
117
+ minVersion: config.minVersion,
118
+ githubStars: config.githubStars,
119
+ // Auto-generated
120
+ npmUrl: `https://www.npmjs.com/package/${packageJson.name}`,
121
+ marketplaceId,
122
+ // Only generate marketplace URL for official @djangocfg extensions
123
+ marketplaceUrl: packageJson.name.startsWith("@djangocfg/ext-") ? `https://hub.djangocfg.com/extensions/${marketplaceId}` : void 0,
124
+ installCommand: `pnpm add ${packageJson.name}`,
125
+ downloadUrl,
126
+ tags: packageJson.keywords,
127
+ preview: `https://unpkg.com/${packageJson.name}@latest/preview.png`
128
+ };
129
+ }
130
+
131
131
  // src/extensionConfig.ts
132
132
  var extensionConfig = createExtensionConfig(package_default, {
133
133
  name: "base",
@@ -340,13 +340,13 @@ function createExtensionContext({
340
340
  displayName,
341
341
  errorMessage
342
342
  }) {
343
- const Context = React.createContext(void 0);
344
- Context.displayName = displayName;
343
+ const Context2 = React.createContext(void 0);
344
+ Context2.displayName = displayName;
345
345
  const Provider = ({ value, children }) => {
346
- return /* @__PURE__ */ jsxRuntime.jsx(Context.Provider, { value, children });
346
+ return /* @__PURE__ */ jsxRuntime.jsx(Context2.Provider, { value, children });
347
347
  };
348
348
  const useContextHook = () => {
349
- const context = React.useContext(Context);
349
+ const context = React.useContext(Context2);
350
350
  if (context === void 0) {
351
351
  throw new Error(
352
352
  errorMessage || `use${displayName} must be used within ${displayName}Provider`
@@ -355,7 +355,7 @@ function createExtensionContext({
355
355
  return context;
356
356
  };
357
357
  return {
358
- Context,
358
+ Context: Context2,
359
359
  Provider,
360
360
  useContext: useContextHook
361
361
  };
package/dist/hooks.js CHANGED
@@ -1,25 +1,25 @@
1
- import { createExtensionLogger } from './chunk-2CHOCDMY.js';
2
- export { EXTENSION_CATEGORIES, createExtensionConfig, createExtensionError, createExtensionLogger, extensionConfig, formatErrorMessage, handleExtensionError, isExtensionError } from './chunk-2CHOCDMY.js';
3
- import { isDevelopment } from './chunk-NXFE5CDE.js';
4
- export { createExtensionAPI, getApiUrl, getSharedAuthStorage, isDevelopment, isProduction, isStaticBuild } from './chunk-NXFE5CDE.js';
1
+ import { createExtensionLogger } from './chunk-2BEEQFEX.js';
2
+ export { EXTENSION_CATEGORIES, createExtensionConfig, createExtensionError, createExtensionLogger, extensionConfig, formatErrorMessage, handleExtensionError, isExtensionError } from './chunk-2BEEQFEX.js';
3
+ import { isDevelopment } from './chunk-ZUKKEJUN.js';
4
+ export { createExtensionAPI, getApiUrl, getSharedAuthStorage, isDevelopment, isProduction, isStaticBuild } from './chunk-ZUKKEJUN.js';
5
5
  import './chunk-3RG5ZIWI.js';
6
6
  import React, { createContext, useEffect, useContext } from 'react';
7
7
  import { jsx, Fragment } from 'react/jsx-runtime';
8
+ import { consola } from 'consola';
8
9
  import { SWRConfig } from 'swr';
9
10
  import { AuthProvider, useAuth } from '@djangocfg/api/auth';
10
- import { consola } from 'consola';
11
11
 
12
12
  function createExtensionContext({
13
13
  displayName,
14
14
  errorMessage
15
15
  }) {
16
- const Context = createContext(void 0);
17
- Context.displayName = displayName;
16
+ const Context2 = createContext(void 0);
17
+ Context2.displayName = displayName;
18
18
  const Provider = ({ value, children }) => {
19
- return /* @__PURE__ */ jsx(Context.Provider, { value, children });
19
+ return /* @__PURE__ */ jsx(Context2.Provider, { value, children });
20
20
  };
21
21
  const useContextHook = () => {
22
- const context = useContext(Context);
22
+ const context = useContext(Context2);
23
23
  if (context === void 0) {
24
24
  throw new Error(
25
25
  errorMessage || `use${displayName} must be used within ${displayName}Provider`
@@ -28,7 +28,7 @@ function createExtensionContext({
28
28
  return context;
29
29
  };
30
30
  return {
31
- Context,
31
+ Context: Context2,
32
32
  Provider,
33
33
  useContext: useContextHook
34
34
  };
package/dist/index.cjs CHANGED
@@ -22,57 +22,10 @@ var EXTENSION_CATEGORIES = [
22
22
  { title: "Other", value: "other" }
23
23
  ];
24
24
 
25
- // src/utils/createExtensionConfig.ts
26
- function replaceWorkspaceDeps(deps) {
27
- if (!deps) return void 0;
28
- const result = {};
29
- for (const [key, value] of Object.entries(deps)) {
30
- result[key] = value === "workspace:*" ? "latest" : value;
31
- }
32
- return result;
33
- }
34
- function createExtensionConfig(packageJson, config) {
35
- const author = typeof packageJson.author === "string" ? packageJson.author : packageJson.author?.name || "Unknown";
36
- const githubUrl = typeof packageJson.repository === "string" ? packageJson.repository : packageJson.repository?.url;
37
- const packageNameWithoutScope = packageJson.name.split("/").pop() || packageJson.name;
38
- const downloadUrl = `https://registry.npmjs.org/${packageJson.name}/-/${packageNameWithoutScope}-${packageJson.version}.tgz`;
39
- const marketplaceId = packageJson.name.replace("@", "").replace("/", "-");
40
- return {
41
- // From package.json
42
- name: config.name,
43
- version: packageJson.version,
44
- author,
45
- description: packageJson.description,
46
- keywords: packageJson.keywords,
47
- license: packageJson.license,
48
- homepage: packageJson.homepage,
49
- githubUrl,
50
- packageDependencies: replaceWorkspaceDeps(packageJson.dependencies),
51
- packagePeerDependencies: replaceWorkspaceDeps(packageJson.peerDependencies),
52
- packageDevDependencies: replaceWorkspaceDeps(packageJson.devDependencies),
53
- // From manual config
54
- displayName: config.displayName,
55
- category: config.category,
56
- features: config.features,
57
- examples: config.examples,
58
- minVersion: config.minVersion,
59
- githubStars: config.githubStars,
60
- // Auto-generated
61
- npmUrl: `https://www.npmjs.com/package/${packageJson.name}`,
62
- marketplaceId,
63
- // Only generate marketplace URL for official @djangocfg extensions
64
- marketplaceUrl: packageJson.name.startsWith("@djangocfg/ext-") ? `https://hub.djangocfg.com/extensions/${marketplaceId}` : void 0,
65
- installCommand: `pnpm add ${packageJson.name}`,
66
- downloadUrl,
67
- tags: packageJson.keywords,
68
- preview: `https://unpkg.com/${packageJson.name}@latest/preview.png`
69
- };
70
- }
71
-
72
25
  // package.json
73
26
  var package_default = {
74
27
  name: "@djangocfg/ext-base",
75
- version: "1.0.5",
28
+ version: "1.0.6",
76
29
  description: "Base utilities and common code for DjangoCFG extensions",
77
30
  keywords: [
78
31
  "django",
@@ -120,6 +73,53 @@ var package_default = {
120
73
  }
121
74
  };
122
75
 
76
+ // src/utils/createExtensionConfig.ts
77
+ function replaceWorkspaceDeps(deps) {
78
+ if (!deps) return void 0;
79
+ const result = {};
80
+ for (const [key, value] of Object.entries(deps)) {
81
+ result[key] = value === "workspace:*" ? "latest" : value;
82
+ }
83
+ return result;
84
+ }
85
+ function createExtensionConfig(packageJson, config) {
86
+ const author = typeof packageJson.author === "string" ? packageJson.author : packageJson.author?.name || "Unknown";
87
+ const githubUrl = typeof packageJson.repository === "string" ? packageJson.repository : packageJson.repository?.url;
88
+ const packageNameWithoutScope = packageJson.name.split("/").pop() || packageJson.name;
89
+ const downloadUrl = `https://registry.npmjs.org/${packageJson.name}/-/${packageNameWithoutScope}-${packageJson.version}.tgz`;
90
+ const marketplaceId = packageJson.name.replace("@", "").replace("/", "-");
91
+ return {
92
+ // From package.json
93
+ name: config.name,
94
+ version: packageJson.version,
95
+ author,
96
+ description: packageJson.description,
97
+ keywords: packageJson.keywords,
98
+ license: packageJson.license,
99
+ homepage: packageJson.homepage,
100
+ githubUrl,
101
+ packageDependencies: replaceWorkspaceDeps(packageJson.dependencies),
102
+ packagePeerDependencies: replaceWorkspaceDeps(packageJson.peerDependencies),
103
+ packageDevDependencies: replaceWorkspaceDeps(packageJson.devDependencies),
104
+ // From manual config
105
+ displayName: config.displayName,
106
+ category: config.category,
107
+ features: config.features,
108
+ examples: config.examples,
109
+ minVersion: config.minVersion,
110
+ githubStars: config.githubStars,
111
+ // Auto-generated
112
+ npmUrl: `https://www.npmjs.com/package/${packageJson.name}`,
113
+ marketplaceId,
114
+ // Only generate marketplace URL for official @djangocfg extensions
115
+ marketplaceUrl: packageJson.name.startsWith("@djangocfg/ext-") ? `https://hub.djangocfg.com/extensions/${marketplaceId}` : void 0,
116
+ installCommand: `pnpm add ${packageJson.name}`,
117
+ downloadUrl,
118
+ tags: packageJson.keywords,
119
+ preview: `https://unpkg.com/${packageJson.name}@latest/preview.png`
120
+ };
121
+ }
122
+
123
123
  // src/extensionConfig.ts
124
124
  var extensionConfig = createExtensionConfig(package_default, {
125
125
  name: "base",
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { EXTENSION_CATEGORIES, createExtensionConfig, createExtensionError, createExtensionLogger, extensionConfig, formatErrorMessage, handleExtensionError, isExtensionError } from './chunk-2CHOCDMY.js';
2
- export { createExtensionAPI, getApiUrl, getSharedAuthStorage, isDevelopment, isProduction, isStaticBuild } from './chunk-NXFE5CDE.js';
1
+ export { EXTENSION_CATEGORIES, createExtensionConfig, createExtensionError, createExtensionLogger, extensionConfig, formatErrorMessage, handleExtensionError, isExtensionError } from './chunk-2BEEQFEX.js';
2
+ export { createExtensionAPI, getApiUrl, getSharedAuthStorage, isDevelopment, isProduction, isStaticBuild } from './chunk-ZUKKEJUN.js';
3
3
  import './chunk-3RG5ZIWI.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/ext-base",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Base utilities and common code for DjangoCFG extensions",
5
5
  "keywords": [
6
6
  "django",
@@ -73,7 +73,7 @@
73
73
  "cli:info": "tsx src/cli/index.ts info"
74
74
  },
75
75
  "peerDependencies": {
76
- "@djangocfg/api": "^2.1.16",
76
+ "@djangocfg/api": "^2.1.43",
77
77
  "consola": "^3.4.2",
78
78
  "react": "^18 || ^19",
79
79
  "react-dom": "^18 || ^19",
@@ -86,8 +86,8 @@
86
86
  "prompts": "^2.4.2"
87
87
  },
88
88
  "devDependencies": {
89
- "@djangocfg/api": "^2.1.16",
90
- "@djangocfg/typescript-config": "^2.1.16",
89
+ "@djangocfg/api": "^2.1.43",
90
+ "@djangocfg/typescript-config": "^2.1.43",
91
91
  "@types/node": "^24.7.2",
92
92
  "@types/prompts": "^2.4.9",
93
93
  "@types/react": "^19.0.0",
@@ -4,7 +4,7 @@
4
4
  * Provides consistent API setup across all extensions with shared authentication
5
5
  */
6
6
 
7
- import { isStaticBuild, getApiUrl } from '../config';
7
+ import { getApiUrl, isStaticBuild } from '../config';
8
8
 
9
9
  /**
10
10
  * Creates an extension API instance with shared authentication storage
package/src/cli/index.ts CHANGED
@@ -4,13 +4,14 @@
4
4
  * Interactive CLI for managing DjangoCFG extensions
5
5
  */
6
6
 
7
- import { consola } from 'consola';
8
7
  import chalk from 'chalk';
8
+ import { execSync } from 'child_process';
9
+ import { consola } from 'consola';
10
+ import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from 'fs';
11
+ import { dirname, join } from 'path';
9
12
  import prompts from 'prompts';
10
- import { readFileSync, writeFileSync, mkdirSync, existsSync, readdirSync, statSync } from 'fs';
11
- import { join, dirname } from 'path';
12
13
  import { fileURLToPath } from 'url';
13
- import { execSync } from 'child_process';
14
+
14
15
  import { EXTENSION_CATEGORIES } from '../types/context';
15
16
 
16
17
  const __dirname = dirname(fileURLToPath(import.meta.url));
@@ -4,14 +4,16 @@
4
4
 
5
5
  'use client';
6
6
 
7
- import React, { useEffect, ReactNode } from 'react';
7
+ import { consola } from 'consola';
8
+ import React, { ReactNode, useEffect } from 'react';
8
9
  import { SWRConfig } from 'swr';
10
+
9
11
  import { AuthProvider, useAuth } from '@djangocfg/api/auth';
10
- import { consola } from 'consola';
11
- import type { ExtensionContextOptions, ExtensionProviderProps } from '../types';
12
- import { createExtensionLogger } from '../logger';
12
+
13
13
  import { isDevelopment } from '../config';
14
+ import { createExtensionLogger } from '../logger';
14
15
 
16
+ import type { ExtensionContextOptions, ExtensionProviderProps } from '../types';
15
17
  const DEFAULT_OPTIONS: ExtensionContextOptions = {
16
18
  revalidateOnFocus: false,
17
19
  revalidateOnReconnect: false,
@@ -4,7 +4,7 @@
4
4
 
5
5
  'use client';
6
6
 
7
- import { createContext, useContext, type Context, type ReactNode, type ReactElement } from 'react';
7
+ import { Context, createContext, ReactElement, ReactNode, useContext } from 'react';
8
8
 
9
9
  export interface CreateExtensionContextOptions<T> {
10
10
  /** Display name for the context (for debugging) */
@@ -2,8 +2,8 @@
2
2
  * Base extension configuration
3
3
  */
4
4
 
5
- import { createExtensionConfig } from './utils/createExtensionConfig';
6
5
  import packageJson from '../package.json';
6
+ import { createExtensionConfig } from './utils/createExtensionConfig';
7
7
 
8
8
  export const extensionConfig = createExtensionConfig(packageJson, {
9
9
  name: 'base',
@@ -6,6 +6,7 @@
6
6
  'use client';
7
7
 
8
8
  import useSWRInfinite from 'swr/infinite';
9
+
9
10
  import type {
10
11
  PaginatedResponse,
11
12
  InfinitePaginationReturn,
@@ -5,8 +5,9 @@
5
5
 
6
6
  'use client';
7
7
 
8
- import { useState, useCallback } from 'react';
8
+ import { useCallback, useState } from 'react';
9
9
  import useSWR from 'swr';
10
+
10
11
  import type { PaginatedResponse, PaginationParams, PaginationState } from '../types';
11
12
 
12
13
  const DEFAULT_PAGE_SIZE = 20;
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import { createConsola } from 'consola';
6
+
6
7
  import type { ExtensionLogger, LoggerOptions } from '../types';
7
8
 
8
9
  const isDevelopment = process.env.NODE_ENV === 'development';
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import { createExtensionConfig } from '@djangocfg/ext-base';
6
+
6
7
  import packageJson from '../package.json';
7
8
 
8
9
  export const extensionConfig = createExtensionConfig(packageJson, {
@@ -4,7 +4,7 @@
4
4
  * Main __DISPLAY_NAME__ Context
5
5
  */
6
6
 
7
- import React, { createContext, useContext, type ReactNode } from 'react';
7
+ import React, { createContext, ReactNode, useContext } from 'react';
8
8
 
9
9
  interface __PROVIDER_NAME__ContextValue {
10
10
  // Add your context values here
@@ -8,7 +8,9 @@
8
8
 
9
9
  import type { ReactNode } from 'react';
10
10
  import React from 'react';
11
+
11
12
  import { ExtensionProvider } from '@djangocfg/ext-base/hooks';
13
+
12
14
  import { extensionConfig } from '../config';
13
15
  import { __PROVIDER_NAME__Provider } from './__PROVIDER_NAME__Context';
14
16
 
@@ -22,9 +22,10 @@
22
22
 
23
23
  'use client';
24
24
 
25
- import React, { type ComponentType, type ReactNode } from 'react';
26
- import { __PROVIDER_NAME__ExtensionProvider } from '../contexts/__PROVIDER_NAME__ExtensionProvider';
25
+ import React, { ComponentType, ReactNode } from 'react';
26
+
27
27
  import { use__PROVIDER_NAME__Optional } from '../contexts/__PROVIDER_NAME__Context';
28
+ import { __PROVIDER_NAME__ExtensionProvider } from '../contexts/__PROVIDER_NAME__ExtensionProvider';
28
29
 
29
30
  /**
30
31
  * HOC that wraps a component with smart provider detection