Skip to content

Commit

Permalink
Merge pull request #27 from imgeng/renovate/vite-plugin-dts-3.x
Browse files Browse the repository at this point in the history
chore(deps): update dependency vite-plugin-dts to v3
  • Loading branch information
ssrbloginsoft authored Oct 3, 2023
2 parents 3bc0d51 + e8793eb commit 7a8f82a
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 135 deletions.
20 changes: 10 additions & 10 deletions dist/index.d.ts → dist/main.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { AllowedComponentProps } from 'vue';
import type { ComponentCustomProps } from 'vue';
import type { ComponentOptionsMixin } from 'vue';
import type { DefineComponent } from 'vue';
import type { ExtractPropTypes } from 'vue';
import { AllowedComponentProps } from 'vue';
import { ComponentCustomProps } from 'vue';
import { ComponentOptionsMixin } from 'vue';
import { DefineComponent } from 'vue';
import { ExtractPropTypes } from 'vue';
import { IEDirectives } from '@imageengine/imageengine-helpers';
import type { Ref } from 'vue';
import type { VNodeProps } from 'vue';
import { Ref } from 'vue';
import { VNodeProps } from 'vue';

declare const Image_2: DefineComponent<{
src: {
Expand Down Expand Up @@ -52,7 +52,7 @@ declare const Image_2: DefineComponent<{
}>>, {
directives: IEDirectives;
srcSet: TSrcSet;
}>;
}, {}>;
export { Image_2 as Image }

export declare const ImageEngineProvider: DefineComponent<{
Expand All @@ -71,7 +71,7 @@ export declare const ImageEngineProvider: DefineComponent<{
stripFromSrc: {
type: StringConstructor;
};
}>>, {}>;
}>>, {}, {}>;

export declare const Source: DefineComponent<{
srcSet: {
Expand All @@ -95,7 +95,7 @@ export declare const Source: DefineComponent<{
attributes: {
type: ObjectConstructor;
};
}>>, {}>;
}>>, {}, {}>;

declare type TSrcSet = Array<{
src: string;
Expand Down
42 changes: 22 additions & 20 deletions dist/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineComponent as p, inject as l, ref as y, openBlock as f, createElementBlock as m, mergeProps as v, provide as g, renderSlot as O } from "vue";
var a = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, b = {}, E = {};
import { defineComponent as p, inject as l, ref as v, openBlock as f, createElementBlock as m, mergeProps as y, provide as g, renderSlot as O } from "vue";
var u = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, b = {}, E = {};
(function(e) {
Object.defineProperty(e, "__esModule", { value: !0 }), e.maybe_create_directive = e.build_IE_query_string = e.build_IE_directives = e.build_IE_url = e.OBJECT_TO_DIRECTIVES_MAP = void 0, e.OBJECT_TO_DIRECTIVES_MAP = {
width: "w",
Expand All @@ -21,40 +21,42 @@ var a = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : ty
keep_meta: "meta",
noOptimization: "pass",
no_optimization: "pass",
force_download: "dl"
force_download: "dl",
max_device_pixel_ratio: "maxdpr",
maxDevicePixelRatio: "maxdpr"
};
function c(r, t, u) {
var o = i(t, u), d = n(o, u), _ = d === "" ? "" : r.includes("?") ? "&" : "?";
return "" + r + _ + d;
function c(r, t, d) {
var o = i(t, d), a = n(o, d), _ = a === "" ? "" : r.includes("?") ? "&" : "?";
return "" + r + _ + a;
}
e.build_IE_url = c;
function i(r, t) {
return Object.entries(r).reduce(function(u, o) {
var d = o[0], _ = o[1];
return u + s(d, _, t);
return Object.entries(r).reduce(function(d, o) {
var a = o[0], _ = o[1];
return d + s(a, _, t);
}, "");
}
e.build_IE_directives = i;
function n(r, t) {
return r && r !== "" ? "imgeng=" + r : (t && console.warn("build_IE_query_string called with an empty directives_string."), "");
}
e.build_IE_query_string = n;
function s(r, t, u) {
function s(r, t, d) {
var o = e.OBJECT_TO_DIRECTIVES_MAP[r];
return o && (t || t === 0) ? "/" + o + "_" + t : o ? (u && console.warn("Directive '" + r + "' has an invalid value " + t + "."), "") : (u && console.warn("Directive '" + r + "' isn't recognized and won't be applied to the image."), "");
return o && (t || t === 0) ? "/" + o + "_" + t : o ? (d && console.warn("Directive '" + r + "' has an invalid value " + t + "."), "") : (d && console.warn("Directive '" + r + "' isn't recognized and won't be applied to the image."), "");
}
e.maybe_create_directive = s;
})(E);
var w = {};
Object.defineProperty(w, "__esModule", { value: !0 });
(function(e) {
var c = a && a.__createBinding || (Object.create ? function(n, s, r, t) {
var c = u && u.__createBinding || (Object.create ? function(n, s, r, t) {
t === void 0 && (t = r), Object.defineProperty(n, t, { enumerable: !0, get: function() {
return s[r];
} });
} : function(n, s, r, t) {
t === void 0 && (t = r), n[t] = s[r];
}), i = a && a.__exportStar || function(n, s) {
}), i = u && u.__exportStar || function(n, s) {
for (var r in n)
r !== "default" && !Object.prototype.hasOwnProperty.call(s, r) && c(s, n, r);
};
Expand Down Expand Up @@ -115,7 +117,7 @@ const S = [
);
const c = l("deliveryAddress"), i = l("stripFromSrc");
return {
count: y(0),
count: v(0),
deliveryAddress: c,
stripFromSrc: i
};
Expand Down Expand Up @@ -153,7 +155,7 @@ const S = [
return i;
}, A = ["src", "srcSet"];
function T(e, c, i, n, s, r) {
return f(), m("img", v({
return f(), m("img", y({
src: e.computedDirectives,
srcSet: e.srcSetString
}, e.attributes), null, 16, A);
Expand All @@ -162,7 +164,7 @@ const B = /* @__PURE__ */ h(j, [["render", T]]), F = p({
setup() {
const e = l("deliveryAddress"), c = l("stripFromSrc");
return {
count: y(0),
count: v(0),
deliveryAddress: e,
stripFromSrc: c
};
Expand All @@ -188,10 +190,10 @@ const B = /* @__PURE__ */ h(j, [["render", T]]), F = p({
}
}
}), P = ["srcSet"];
function q(e, c, i, n, s, r) {
return f(), m("source", v({ srcSet: e.srcSetString }, e.attributes), null, 16, P);
function D(e, c, i, n, s, r) {
return f(), m("source", y({ srcSet: e.srcSetString }, e.attributes), null, 16, P);
}
const U = /* @__PURE__ */ h(F, [["render", q]]), D = p({
const U = /* @__PURE__ */ h(F, [["render", D]]), q = p({
props: {
deliveryAddress: {
type: String,
Expand All @@ -210,7 +212,7 @@ function C(e, c, i, n, s, r) {
O(e.$slots, "default")
]);
}
const z = /* @__PURE__ */ h(D, [["render", C]]);
const z = /* @__PURE__ */ h(q, [["render", C]]);
export {
B as Image,
z as ImageEngineProvider,
Expand Down
9 changes: 0 additions & 9 deletions dist/shims-vue.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion dist/vite-env.d.ts

This file was deleted.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
"version": "0.0.5",
"author": "Siva Sankar Reddy Bogala",
"private": false,
"repository": "https://github.com/imgeng/imageengine-vue3",
"type": "module",
"files": [
"dist"
],
"main": "./dist/main.js",
"module": "./dist/main.js",
"types": "./dist/index.d.ts",
"types": "./dist/main.d.ts",
"exports": {
".": {
"import": "./dist/main.js",
Expand Down Expand Up @@ -46,7 +47,7 @@
"prettier": "^3.0.0",
"tslib": "2.6.2",
"vite": "4.4.9",
"vite-plugin-dts": "1.7.3",
"vite-plugin-dts": "3.6.0",
"vitest": "^0.34.0",
"vue-tsc": "1.8.15"
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Image.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default defineComponent({
setup(props) {
if (!props.src) {
throw new Error(
`Please ensure that the image component has an 'src' prop.`
`Please ensure that the image component has an 'src' prop.`,
);
}

Expand Down Expand Up @@ -88,12 +88,12 @@ export default defineComponent({
created() {
if (
!ALLOWED_INPUT_EXTENSIONS.includes(
this.imageExtension.toLowerCase() as IEFormat
this.imageExtension.toLowerCase() as IEFormat,
)
) {
console.warn(
`The following image's extension doesn't match any of the allowed types and won't be optimized: ${this.src}.`,
`List of supported extensions: ${ALLOWED_INPUT_EXTENSIONS.join(", ")}.`
`List of supported extensions: ${ALLOWED_INPUT_EXTENSIONS.join(", ")}.`,
);
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/Source.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default defineComponent({
src: image.src.replace(this.stripFromSrc, ""),
}))
: this.srcSet,
this.deliveryAddress
this.deliveryAddress,
);
},
},
Expand Down
6 changes: 3 additions & 3 deletions src/components/__tests__/Image.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe("Image component", () => {

const img = wrapper.get("img");
expect(img.attributes("src")).toBe(
"https://blazing-fast-pics.cdn.imgeng.in/images/pic_1_variation_1.jpg?imgeng=/cmpr_0"
"https://blazing-fast-pics.cdn.imgeng.in/images/pic_1_variation_1.jpg?imgeng=/cmpr_0",
);
});

Expand Down Expand Up @@ -65,11 +65,11 @@ describe("Image component", () => {
const srcSetStringComputed = wrapper.vm.srcSetString;
expect(srcSetStringComputed).toEqual(
`https://blazing-fast-pics.cdn.imgeng.in/images/pic.jpg?imgeng=/w_400 400w,\n` +
`https://blazing-fast-pics.cdn.imgeng.in/images/pic.jpg?imgeng=/w_800 800w,\n`
`https://blazing-fast-pics.cdn.imgeng.in/images/pic.jpg?imgeng=/w_800 800w,\n`,
);
expect(imageExtensionComputed).toEqual("jpg");
expect(imageUrlComputed).toEqual(
"https://blazing-fast-pics.cdn.imgeng.in/images/pic.jpg"
"https://blazing-fast-pics.cdn.imgeng.in/images/pic.jpg",
);
});
});
2 changes: 1 addition & 1 deletion src/components/__tests__/Source.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe("Source Component", () => {
});

expect(wrapper.vm.srcSetString).toEqual(
`https://blazing-fast-pics.cdn.imgeng.in/images/pic_2.jpg?imgeng=/f_webp/r_60/w_300 300w,\n`
`https://blazing-fast-pics.cdn.imgeng.in/images/pic_2.jpg?imgeng=/f_webp/r_60/w_300 300w,\n`,
);
});
});
6 changes: 3 additions & 3 deletions src/components/__tests__/service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ describe("service", () => {
];
it("generate string url", () => {
expect(
generateSrcSetString(srcset, "https://blazing-fast-pics.cdn.imgeng.in")
generateSrcSetString(srcset, "https://blazing-fast-pics.cdn.imgeng.in"),
).toBe(
"https://blazing-fast-pics.cdn.imgeng.in/images/pic_1_variation_2.jpg?imgeng=/cmpr_0/w_900 900w," +
`\n`
`\n`,
);
});
});
Expand Down Expand Up @@ -51,7 +51,7 @@ describe("generateSrcSetString", () => {

const result = generateSrcSetString(
srcSet,
"https://blazing-fast-pics.cdn.imgeng.in"
"https://blazing-fast-pics.cdn.imgeng.in",
);

const expected =
Expand Down
4 changes: 2 additions & 2 deletions src/utils/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function constructUrl(src: string, directives: IEDirectives): string {

export function generateSrcSetString(
srcSet: TSrcSet,
deliveryAddress: string
deliveryAddress: string,
): string {
return srcSet.reduce((result, { src, width, directives }) => {
// Extract width directive and always apply it to the image as
Expand All @@ -22,7 +22,7 @@ export function generateSrcSetString(
...directives,
...widthDirective,
}
: widthDirective
: widthDirective,
);
const entry = `${fullImageUrl} ${width},\n`;
result += entry;
Expand Down
10 changes: 4 additions & 6 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,13 @@ export default defineConfig({
},
plugins: [
dts({
outputDir: ["dist"],
// include: ['src/index.ts'],
exclude: ["src/ignore"],
// aliasesExclude: [/^@components/],
outDir: ["dist"],
exclude: ["src/index.ts"],
staticImport: true,
skipDiagnostics: false,
logDiagnostics: true,
rollupTypes: true,
insertTypesEntry: true,
copyDtsFiles: true,
strictOutput: true,
}),
vue(),
vueJsx(),
Expand Down
Loading

0 comments on commit 7a8f82a

Please sign in to comment.