@jchat/addon-sdk 1.0.0-alpha.33 → 1.0.0-alpha.34

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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @jchat/addon-sdk
2
2
 
3
+ ## 1.0.0-alpha.34
4
+
5
+ ### Patch Changes
6
+
7
+ - Clean up obsolete CSS minification replacement rules
8
+
9
+ - Consolidate manifest compatibility contract to single semver range string
10
+
11
+ - Bumped `@jchat/*` dependencies:
12
+ - [`ui@1.0.0-alpha.30`](https://github.com/jchatcloud/jchat/releases/tag/ui@v1.0.0-alpha.30)
13
+
3
14
  ## 1.0.0-alpha.33
4
15
 
5
16
  ### Patch Changes
package/README.md CHANGED
@@ -61,10 +61,7 @@ export default defineAddonManifest({
61
61
  description: "Search and insert animated GIFs directly into chat messages.",
62
62
  author: "JChat Ecosystem Team",
63
63
  publisher: { id: "jchat" },
64
- compatibility: {
65
- jchat: ">=1.0.0-alpha.0 <2.0.0",
66
- addonSdk: "^1.0.0"
67
- },
64
+ compatibility: ">=1.0.0-alpha.0 <2.0.0",
68
65
  locales: [
69
66
  "ar",
70
67
  "bg",
@@ -104,13 +104,11 @@ interface AddonManifest {
104
104
  locales?: string[];
105
105
  /** Default fallback language code (e.g. "en") */
106
106
  defaultLocale?: string;
107
- /** Host and SDK versions this directly executed plugin was built and tested against */
108
- compatibility: {
109
- /** Supported JChat versions as a semantic-version range, for example `^1.0.0` */
110
- jchat: string;
111
- /** Supported `@jchat/addon-sdk` versions as a semantic-version range */
112
- addonSdk: string;
113
- };
107
+ /**
108
+ * Supported JChat versions as a semantic-version range, for example `^1.0.0` or `>=1.0.0-alpha.0
109
+ * <2.0.0`
110
+ */
111
+ compatibility: string;
114
112
  /** Identity of the trusted publisher that signed this package. Required when migrations exist */
115
113
  publisher?: {
116
114
  id: string;
@@ -65,4 +65,14 @@ export declare function diagnoseAddonPackage(options: AddonPackageDiagnosticOpti
65
65
  * @returns `true` if at least one check has `status === "error"`, otherwise `false`.
66
66
  */
67
67
  export declare function hasAddonDiagnosticErrors(diagnostics: readonly AddonPackageDiagnostic[]): boolean;
68
+ /**
69
+ * Evaluates semantic version compatibility between a target version and a semver range string.
70
+ *
71
+ * @param id - Diagnostic check identifier.
72
+ * @param label - Diagnostic check label.
73
+ * @param version - Environment component version string.
74
+ * @param range - Expected semver range string from manifest compatibility declarations.
75
+ * @returns An {@link AddonPackageDiagnostic} result object.
76
+ */
77
+ export declare function isVersionCompatible(version: string, range: string): boolean;
68
78
  //#endregion
@@ -39,7 +39,7 @@ function createCompatibleMajorRange(version) {
39
39
  function diagnoseAddonPackage(options) {
40
40
  const { buildDir, manifest } = options;
41
41
  const diagnostics = [];
42
- diagnostics.push(compatibilityDiagnostic("jchat", "JChat compatibility", options.jchatVersion, manifest.compatibility?.jchat), compatibilityDiagnostic("addon-sdk", "Addon SDK compatibility", options.addonSdkVersion, manifest.compatibility?.addonSdk));
42
+ diagnostics.push(compatibilityDiagnostic("jchat", "JChat compatibility", options.jchatVersion, manifest.compatibility));
43
43
  const references = [
44
44
  [
45
45
  "frontend-bundle",
@@ -135,8 +135,20 @@ function hasAddonDiagnosticErrors(diagnostics) {
135
135
  * @param range - Expected semver range string from manifest compatibility declarations.
136
136
  * @returns An {@link AddonPackageDiagnostic} result object.
137
137
  */
138
+ function isVersionCompatible(version, range) {
139
+ if (Bun.semver.satisfies(version, range)) return true;
140
+ if (version.includes("-")) {
141
+ const prereleaseRange = range.replace(/(\d+\.\d+\.\d+)(?![\w.-])/g, (m) => `${m}-0`);
142
+ try {
143
+ return Boolean(Bun.semver.satisfies(version, prereleaseRange));
144
+ } catch {
145
+ return false;
146
+ }
147
+ }
148
+ return false;
149
+ }
138
150
  function compatibilityDiagnostic(id, label, version, range) {
139
- const compatible = Boolean(range && Bun.semver.satisfies(version, range));
151
+ const compatible = Boolean(range && isVersionCompatible(version, range));
140
152
  return {
141
153
  id,
142
154
  label,
@@ -172,4 +184,4 @@ function listRegularFiles(root) {
172
184
  }).filter((entry) => entry.isFile()).map((entry) => path$1.join(entry.parentPath, entry.name));
173
185
  }
174
186
  //#endregion
175
- export { createCompatibleMajorRange, diagnoseAddonPackage, hasAddonDiagnosticErrors };
187
+ export { createCompatibleMajorRange, diagnoseAddonPackage, hasAddonDiagnosticErrors, isVersionCompatible };
package/dist/signing.mjs CHANGED
@@ -101,7 +101,7 @@ function validateAddonManifest(manifest) {
101
101
  if (!manifest.id || manifest.id.length > 40 || !ADDON_ID_PATTERN.test(manifest.id)) throw new Error("Manifest id must contain only lowercase letters, numbers, and hyphens");
102
102
  if (!manifest.name || manifest.name.length > 120) throw new Error("Manifest name is invalid");
103
103
  if (!manifest.version || String(manifest.version).length > 64) throw new Error("Manifest version is invalid");
104
- if (!isCompatibilityRange(manifest.compatibility?.jchat) || !isCompatibilityRange(manifest.compatibility?.addonSdk)) throw new Error("Manifest must declare valid JChat and addon SDK compatibility ranges");
104
+ if (!isCompatibilityRange(manifest.compatibility)) throw new Error("Manifest must declare a valid JChat compatibility range");
105
105
  if (manifest.distribution !== void 0 && manifest.distribution !== "free" && manifest.distribution !== "commercial") throw new Error("Manifest distribution must be either 'free' or 'commercial'");
106
106
  if (!manifest.logo || typeof manifest.logo !== "string" || !manifest.logo.trim()) throw new Error("Manifest logo is required");
107
107
  const cleanLogo = manifest.logo.replace(/^\.\//, "");
package/dist/src.mjs CHANGED
@@ -2,7 +2,7 @@ import "./i18n.mjs";
2
2
  import { AbilityBuilder, createMongoAbility, subject } from "@casl/ability";
3
3
  import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
4
4
  //#region package.json
5
- var version = "1.0.0-alpha.33";
5
+ var version = "1.0.0-alpha.34";
6
6
  //#endregion
7
7
  //#region src/permissions.ts
8
8
  /**
package/dist/vite.mjs CHANGED
@@ -270,9 +270,6 @@ function embedCssIntoBundle(buildDir) {
270
270
  css = css.replace(/@keyframes\s+wave-dots\s*\{[\s\S]*?\n\}/g, "");
271
271
  css = css.replace(/@keyframes\s+gradient-border\s*\{[\s\S]*?\n\}/g, "");
272
272
  css = css.replace(/\.animate-gradient(?:-border|-text)?\s*\{[^}]+\}/g, "");
273
- css = css.replace(/\.me\s*\{[^}]+\}/g, "");
274
- css = css.replace(/\.user-border\s*\{[^}]+\}/g, "");
275
- css = css.replace(/\.scrollbar-hide[^{]*\{[^}]+\}/g, "");
276
273
  css = css.replace(/@layer\s+components(?:\s*\{[^}]*\}|;)/g, "");
277
274
  css = minifyCss(css);
278
275
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jchat/addon-sdk",
3
- "version": "1.0.0-alpha.33",
3
+ "version": "1.0.0-alpha.34",
4
4
  "private": false,
5
5
  "description": "JChat Addon SDK for building JChat addons.",
6
6
  "keywords": [
@@ -46,10 +46,7 @@ export default defineAddonManifest({
46
46
  version: "1.0.0",
47
47
  description: "Create and vote on live interactive polls in chat rooms.",
48
48
  author: "JChat Ecosystem Team",
49
- compatibility: {
50
- jchat: ">=1.0.0-alpha.0 <2.0.0",
51
- addonSdk: ">=1.0.0-alpha.0 <2.0.0"
52
- },
49
+ compatibility: ">=1.0.0-alpha.0 <2.0.0",
53
50
  locales: [
54
51
  "ar",
55
52
  "bg",