Sitelet https://github.com/limitless-angular/limitless-angular/pull/71/files
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/sanity/image-loader/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { provideSanityLoader } from './loader';
export { SanityImage } from './sanity-image.directive';
export type { SanityImageSource } from './types';
export type { SanityImageSource } from '@sanity/image-url';
4 changes: 2 additions & 2 deletions packages/sanity/image-loader/src/loader.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { inject, Provider } from '@angular/core';
import { IMAGE_LOADER, ImageLoaderConfig } from '@angular/common';

import imageUrlBuilder from '@sanity/image-url';
import { createImageUrlBuilder } from '@sanity/image-url';

import {
SANITY_CONFIG,
Expand All @@ -16,7 +16,7 @@ export function sanityImageLoader(config?: SanityConfig | null) {
try {
url = new url(/sitelet?url=https%3A%2F%2Fgithub.com%2Flimitless-angular%2Flimitless-angular%2Fpull%2F71%2Fsrc);
} catch {
const builder = imageUrlBuilder(config ?? undefined);
const builder = createImageUrlBuilder(config ?? undefined);
url = new url(/sitelet?url=https%3A%2F%2Fgithub.com%2Flimitless-angular%2Flimitless-angular%2Fpull%2F71%2Fbuilder.image%28src).withOptions(options).url());
}

Expand Down
11 changes: 7 additions & 4 deletions packages/sanity/image-loader/src/sanity-image.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ import {
NgOptimizedImage,
} from '@angular/common';

import imageUrlBuilder from '@sanity/image-url';
import { createImageUrlBuilder } from '@sanity/image-url';
import type {
ImageUrlBuilderOptionsWithAliases,
SanityImageSource,
} from '@sanity/image-url';

import {
SANITY_CONFIG,
type SanityConfig,
} from '@limitless-angular/sanity/shared';
import { sanityImageLoader } from './loader';
import type { ImageUrlBuilderOptions, SanityImageSource } from './types';

type LoaderParams = Omit<ImageUrlBuilderOptions, 'quality'>;
type LoaderParams = Omit<ImageUrlBuilderOptionsWithAliases, 'quality'>;

function getNoopImageLoader() {
return (
Expand Down Expand Up @@ -72,7 +75,7 @@ export class SanityImage extends NgOptimizedImage implements OnInit, OnChanges {

private imageUrl = computed(() => {
const url = new URL(
imageUrlBuilder(this.sanityConfig)
createImageUrlBuilder(this.sanityConfig)
.image(this.sanityImage())
.withOptions(this._loaderParams)
.url(),
Expand Down
108 changes: 0 additions & 108 deletions packages/sanity/image-loader/src/types.ts

This file was deleted.

8 changes: 4 additions & 4 deletions packages/sanity/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@angular/common": "^19.0.0 || ^20.0.0 || ^21.0.0",
"@angular/core": "^19.0.0 || ^20.0.0 || ^21.0.0",
"@angular/router": "^19.0.0 || ^20.0.0 || ^21.0.0",
"@sanity/client": "^6.28.0 || ^7.0.0",
"@sanity/client": "^7.0.0",
"rxjs": "^7.8.0"
},
"peerDependenciesMeta": {
Expand All @@ -41,10 +41,10 @@
}
},
"dependencies": {
"@portabletext/toolkit": "^2.0.15 || ^3.0.0 || ^4.0.0 || ^5.0.0",
"@portabletext/types": "^2.0.13 || ^3.0.0 || ^4.0.0",
"@portabletext/toolkit": "^5.0.0",
"@portabletext/types": "^4.0.0",
"@sanity/comlink": "^4.0.1",
"@sanity/image-url": "^1.0.2 || ^2.0.2",
"@sanity/image-url": "^2.0.2",
"@sanity/mutate": "0.18.0",
"@sanity/presentation-comlink": "^2.1.0",
"@sanity/visual-editing": "5.4.3",
Expand Down
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions tools/angular-compat/package-manifest-policy.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ const bundledFeatureDependencies = [
'@portabletext/types',
'@sanity/image-url',
];
const supportedSanityDependencyRanges = {
peerDependencies: {
'@sanity/client': '^7.0.0',
},
dependencies: {
'@portabletext/toolkit': '^5.0.0',
'@portabletext/types': '^4.0.0',
'@sanity/image-url': '^2.0.2',
},
};

test('@limitless-angular/sanity keeps framework and client packages peer-owned', () => {
const dependencies = dependencyNames('dependencies');
Expand Down Expand Up @@ -91,6 +101,16 @@ test('@limitless-angular/sanity avoids dependency bucket duplication', () => {
}
});

test('@limitless-angular/sanity only supports current Sanity dependency majors', () => {
for (const [section, ranges] of Object.entries(
supportedSanityDependencyRanges,
)) {
for (const [dependency, range] of Object.entries(ranges)) {
assert.equal(sanityPackageJson[section]?.[dependency], range);
}
}
});

function dependencyNames(section) {
return new Set(Object.keys(sanityPackageJson[section] ?? {}));
}
Loading