@keycloakify/svelte 0.2.5 → 0.2.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.
@@ -1,5 +1,5 @@
1
- export const id = 135;
2
- export const ids = [135];
1
+ export const id = 343;
2
+ export const ids = [343];
3
3
  export const modules = {
4
4
 
5
5
  /***/ 94:
@@ -29,7 +29,7 @@ function symToStr(wrap) {
29
29
 
30
30
  /***/ }),
31
31
 
32
- /***/ 535:
32
+ /***/ 455:
33
33
  /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
34
34
 
35
35
 
@@ -750,11 +750,7 @@ function flattenError(error, mapper = (issue) => issue.message) {
750
750
  }
751
751
  return { formErrors, fieldErrors };
752
752
  }
753
- function formatError(error, _mapper) {
754
- const mapper = _mapper ||
755
- function (issue) {
756
- return issue.message;
757
- };
753
+ function formatError(error, mapper = (issue) => issue.message) {
758
754
  const fieldErrors = { _errors: [] };
759
755
  const processError = (error) => {
760
756
  for (const issue of error.issues) {
@@ -792,11 +788,7 @@ function formatError(error, _mapper) {
792
788
  processError(error);
793
789
  return fieldErrors;
794
790
  }
795
- function treeifyError(error, _mapper) {
796
- const mapper = _mapper ||
797
- function (issue) {
798
- return issue.message;
799
- };
791
+ function treeifyError(error, mapper = (issue) => issue.message) {
800
792
  const result = { errors: [] };
801
793
  const processError = (error, path = []) => {
802
794
  var _a, _b;
@@ -1743,7 +1735,7 @@ class Doc {
1743
1735
  const version = {
1744
1736
  major: 4,
1745
1737
  minor: 1,
1746
- patch: 8,
1738
+ patch: 12,
1747
1739
  };
1748
1740
 
1749
1741
  ;// CONCATENATED MODULE: ./node_modules/zod/v4/core/schemas.js
@@ -2518,6 +2510,20 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
2518
2510
  const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
2519
2511
  // requires cast because technically $ZodObject doesn't extend
2520
2512
  $ZodType.init(inst, def);
2513
+ // const sh = def.shape;
2514
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
2515
+ if (!desc?.get) {
2516
+ const sh = def.shape;
2517
+ Object.defineProperty(def, "shape", {
2518
+ get: () => {
2519
+ const newSh = { ...sh };
2520
+ Object.defineProperty(def, "shape", {
2521
+ value: newSh,
2522
+ });
2523
+ return newSh;
2524
+ },
2525
+ });
2526
+ }
2521
2527
  const _normalized = cached(() => normalizeDef(def));
2522
2528
  defineLazy(inst._zod, "propValues", () => {
2523
2529
  const shape = def.shape;
@@ -4090,6 +4096,136 @@ const be_error = () => {
4090
4096
  };
4091
4097
  }
4092
4098
 
4099
+ ;// CONCATENATED MODULE: ./node_modules/zod/v4/locales/bg.js
4100
+
4101
+ const parsedType = (data) => {
4102
+ const t = typeof data;
4103
+ switch (t) {
4104
+ case "number": {
4105
+ return Number.isNaN(data) ? "NaN" : "число";
4106
+ }
4107
+ case "object": {
4108
+ if (Array.isArray(data)) {
4109
+ return "масив";
4110
+ }
4111
+ if (data === null) {
4112
+ return "null";
4113
+ }
4114
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
4115
+ return data.constructor.name;
4116
+ }
4117
+ }
4118
+ }
4119
+ return t;
4120
+ };
4121
+ const bg_error = () => {
4122
+ const Sizable = {
4123
+ string: { unit: "символа", verb: "да съдържа" },
4124
+ file: { unit: "байта", verb: "да съдържа" },
4125
+ array: { unit: "елемента", verb: "да съдържа" },
4126
+ set: { unit: "елемента", verb: "да съдържа" },
4127
+ };
4128
+ function getSizing(origin) {
4129
+ return Sizable[origin] ?? null;
4130
+ }
4131
+ const Nouns = {
4132
+ regex: "вход",
4133
+ email: "имейл адрес",
4134
+ url: "URL",
4135
+ emoji: "емоджи",
4136
+ uuid: "UUID",
4137
+ uuidv4: "UUIDv4",
4138
+ uuidv6: "UUIDv6",
4139
+ nanoid: "nanoid",
4140
+ guid: "GUID",
4141
+ cuid: "cuid",
4142
+ cuid2: "cuid2",
4143
+ ulid: "ULID",
4144
+ xid: "XID",
4145
+ ksuid: "KSUID",
4146
+ datetime: "ISO време",
4147
+ date: "ISO дата",
4148
+ time: "ISO време",
4149
+ duration: "ISO продължителност",
4150
+ ipv4: "IPv4 адрес",
4151
+ ipv6: "IPv6 адрес",
4152
+ cidrv4: "IPv4 диапазон",
4153
+ cidrv6: "IPv6 диапазон",
4154
+ base64: "base64-кодиран низ",
4155
+ base64url: "base64url-кодиран низ",
4156
+ json_string: "JSON низ",
4157
+ e164: "E.164 номер",
4158
+ jwt: "JWT",
4159
+ template_literal: "вход",
4160
+ };
4161
+ return (issue) => {
4162
+ switch (issue.code) {
4163
+ case "invalid_type":
4164
+ return `Невалиден вход: очакван ${issue.expected}, получен ${parsedType(issue.input)}`;
4165
+ case "invalid_value":
4166
+ if (issue.values.length === 1)
4167
+ return `Невалиден вход: очакван ${util.stringifyPrimitive(issue.values[0])}`;
4168
+ return `Невалидна опция: очаквано едно от ${util.joinValues(issue.values, "|")}`;
4169
+ case "too_big": {
4170
+ const adj = issue.inclusive ? "<=" : "<";
4171
+ const sizing = getSizing(issue.origin);
4172
+ if (sizing)
4173
+ return `Твърде голямо: очаква се ${issue.origin ?? "стойност"} да съдържа ${adj}${issue.maximum.toString()} ${sizing.unit ?? "елемента"}`;
4174
+ return `Твърде голямо: очаква се ${issue.origin ?? "стойност"} да бъде ${adj}${issue.maximum.toString()}`;
4175
+ }
4176
+ case "too_small": {
4177
+ const adj = issue.inclusive ? ">=" : ">";
4178
+ const sizing = getSizing(issue.origin);
4179
+ if (sizing) {
4180
+ return `Твърде малко: очаква се ${issue.origin} да съдържа ${adj}${issue.minimum.toString()} ${sizing.unit}`;
4181
+ }
4182
+ return `Твърде малко: очаква се ${issue.origin} да бъде ${adj}${issue.minimum.toString()}`;
4183
+ }
4184
+ case "invalid_format": {
4185
+ const _issue = issue;
4186
+ if (_issue.format === "starts_with") {
4187
+ return `Невалиден низ: трябва да започва с "${_issue.prefix}"`;
4188
+ }
4189
+ if (_issue.format === "ends_with")
4190
+ return `Невалиден низ: трябва да завършва с "${_issue.suffix}"`;
4191
+ if (_issue.format === "includes")
4192
+ return `Невалиден низ: трябва да включва "${_issue.includes}"`;
4193
+ if (_issue.format === "regex")
4194
+ return `Невалиден низ: трябва да съвпада с ${_issue.pattern}`;
4195
+ let invalid_adj = "Невалиден";
4196
+ if (_issue.format === "emoji")
4197
+ invalid_adj = "Невалидно";
4198
+ if (_issue.format === "datetime")
4199
+ invalid_adj = "Невалидно";
4200
+ if (_issue.format === "date")
4201
+ invalid_adj = "Невалидна";
4202
+ if (_issue.format === "time")
4203
+ invalid_adj = "Невалидно";
4204
+ if (_issue.format === "duration")
4205
+ invalid_adj = "Невалидна";
4206
+ return `${invalid_adj} ${Nouns[_issue.format] ?? issue.format}`;
4207
+ }
4208
+ case "not_multiple_of":
4209
+ return `Невалидно число: трябва да бъде кратно на ${issue.divisor}`;
4210
+ case "unrecognized_keys":
4211
+ return `Неразпознат${issue.keys.length > 1 ? "и" : ""} ключ${issue.keys.length > 1 ? "ове" : ""}: ${util.joinValues(issue.keys, ", ")}`;
4212
+ case "invalid_key":
4213
+ return `Невалиден ключ в ${issue.origin}`;
4214
+ case "invalid_union":
4215
+ return "Невалиден вход";
4216
+ case "invalid_element":
4217
+ return `Невалидна стойност в ${issue.origin}`;
4218
+ default:
4219
+ return `Невалиден вход`;
4220
+ }
4221
+ };
4222
+ };
4223
+ /* harmony default export */ function bg() {
4224
+ return {
4225
+ localeError: bg_error(),
4226
+ };
4227
+ }
4228
+
4093
4229
  ;// CONCATENATED MODULE: ./node_modules/zod/v4/locales/ca.js
4094
4230
 
4095
4231
  const ca_error = () => {
@@ -4600,7 +4736,7 @@ const de_error = () => {
4600
4736
 
4601
4737
  ;// CONCATENATED MODULE: ./node_modules/zod/v4/locales/en.js
4602
4738
 
4603
- const parsedType = (data) => {
4739
+ const en_parsedType = (data) => {
4604
4740
  const t = typeof data;
4605
4741
  switch (t) {
4606
4742
  case "number": {
@@ -4663,7 +4799,7 @@ const en_error = () => {
4663
4799
  return (issue) => {
4664
4800
  switch (issue.code) {
4665
4801
  case "invalid_type":
4666
- return `Invalid input: expected ${issue.expected}, received ${parsedType(issue.input)}`;
4802
+ return `Invalid input: expected ${issue.expected}, received ${en_parsedType(issue.input)}`;
4667
4803
  case "invalid_value":
4668
4804
  if (issue.values.length === 1)
4669
4805
  return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
@@ -9268,6 +9404,7 @@ const yo_error = () => {
9268
9404
 
9269
9405
 
9270
9406
 
9407
+
9271
9408
 
9272
9409
 
9273
9410
  ;// CONCATENATED MODULE: ./node_modules/zod/v4/core/registries.js
@@ -11295,15 +11432,12 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
11295
11432
  Object.defineProperty(inst, "_def", { value: def });
11296
11433
  // base methods
11297
11434
  inst.check = (...checks) => {
11298
- return inst.clone({
11299
- ...def,
11435
+ return inst.clone(mergeDefs(def, {
11300
11436
  checks: [
11301
11437
  ...(def.checks ?? []),
11302
11438
  ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
11303
11439
  ],
11304
- }
11305
- // { parent: true }
11306
- );
11440
+ }));
11307
11441
  };
11308
11442
  inst.clone = (def, params) => clone(inst, def, params);
11309
11443
  inst.brand = () => inst;
@@ -11802,7 +11936,9 @@ function keyof(schema) {
11802
11936
  const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
11803
11937
  $ZodObjectJIT.init(inst, def);
11804
11938
  ZodType.init(inst, def);
11805
- defineLazy(inst, "shape", () => def.shape);
11939
+ defineLazy(inst, "shape", () => {
11940
+ return def.shape;
11941
+ });
11806
11942
  inst.keyof = () => schemas_enum(Object.keys(inst._zod.def.shape));
11807
11943
  inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall: catchall });
11808
11944
  inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
@@ -11824,10 +11960,7 @@ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
11824
11960
  function object(shape, params) {
11825
11961
  const def = {
11826
11962
  type: "object",
11827
- get shape() {
11828
- assignProp(this, "shape", shape ? objectClone(shape) : {});
11829
- return this.shape;
11830
- },
11963
+ shape: shape ?? {},
11831
11964
  ...normalizeParams(params),
11832
11965
  };
11833
11966
  return new ZodObject(def);
@@ -11836,10 +11969,7 @@ function object(shape, params) {
11836
11969
  function strictObject(shape, params) {
11837
11970
  return new ZodObject({
11838
11971
  type: "object",
11839
- get shape() {
11840
- util.assignProp(this, "shape", util.objectClone(shape));
11841
- return this.shape;
11842
- },
11972
+ shape,
11843
11973
  catchall: never(),
11844
11974
  ...util.normalizeParams(params),
11845
11975
  });
@@ -11848,10 +11978,7 @@ function strictObject(shape, params) {
11848
11978
  function looseObject(shape, params) {
11849
11979
  return new ZodObject({
11850
11980
  type: "object",
11851
- get shape() {
11852
- util.assignProp(this, "shape", util.objectClone(shape));
11853
- return this.shape;
11854
- },
11981
+ shape,
11855
11982
  catchall: unknown(),
11856
11983
  ...util.normalizeParams(params),
11857
11984
  });
@@ -29,8 +29,8 @@ var update_kc_gen = __webpack_require__(819);
29
29
  var assert = __webpack_require__(966);
30
30
  // EXTERNAL MODULE: ./node_modules/tsafe/esm/id.mjs
31
31
  var id = __webpack_require__(94);
32
- // EXTERNAL MODULE: ./node_modules/zod/v4/classic/external.js + 67 modules
33
- var external = __webpack_require__(535);
32
+ // EXTERNAL MODULE: ./node_modules/zod/v4/classic/external.js + 68 modules
33
+ var external = __webpack_require__(455);
34
34
  ;// CONCATENATED MODULE: ./dist/keycloakify-svelte/bin/initialize-account-theme/updateAccountThemeImplementationInConfig.ts
35
35
 
36
36
 
@@ -145,7 +145,8 @@ async function command(params) {
145
145
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
146
146
 
147
147
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
148
- /* harmony export */ J: () => (/* binding */ getThisCodebaseRootDirPath)
148
+ /* harmony export */ J: () => (/* binding */ getThisCodebaseRootDirPath),
149
+ /* harmony export */ x: () => (/* binding */ getNearestPackageJsonDirPath)
149
150
  /* harmony export */ });
150
151
  /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
151
152
  /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
@@ -170,6 +171,12 @@ function getThisCodebaseRootDirPath() {
170
171
  }
171
172
  return (result = getThisCodebaseRootDirPath_rec(__dirname));
172
173
  }
174
+ function getNearestPackageJsonDirPath(dirPath) {
175
+ if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(path__WEBPACK_IMPORTED_MODULE_1__.join(dirPath, 'package.json'))) {
176
+ return dirPath;
177
+ }
178
+ return getNearestPackageJsonDirPath(path__WEBPACK_IMPORTED_MODULE_1__.join(dirPath, '..'));
179
+ }
173
180
 
174
181
 
175
182
  /***/ }),
@@ -182,13 +189,35 @@ function getThisCodebaseRootDirPath() {
182
189
  /* harmony export */ });
183
190
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(928);
184
191
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
192
+ /* harmony import */ var _getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(697);
193
+
185
194
 
186
195
  let cache = undefined;
196
+ /** NOTE: Careful, this function can fail when the binary
197
+ * Used is not in the node_modules directory of the project
198
+ * (for example when running tests with vscode extension we'll get
199
+ * '/Users/dylan/.vscode/extensions/vitest.explorer-1.16.0/dist/worker.js'
200
+ *
201
+ * instead of
202
+ * '/Users/joseph/.nvm/versions/node/v22.12.0/bin/node'
203
+ * or
204
+ * '/Users/joseph/github/keycloakify-starter/node_modules/.bin/vite'
205
+ *
206
+ * as the value of process.argv[1]
207
+ */
187
208
  function getNodeModulesBinDirPath() {
188
209
  if (cache !== undefined) {
189
210
  return cache;
190
211
  }
191
212
  const binPath = process.argv[1];
213
+ special_case_running_not_from_distribution: {
214
+ if (!binPath.endsWith('.ts')) {
215
+ break special_case_running_not_from_distribution;
216
+ }
217
+ const packageJsonDirPath = (0,_getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_1__/* .getNearestPackageJsonDirPath */ .x)((0,path__WEBPACK_IMPORTED_MODULE_0__.dirname)(binPath));
218
+ const nodeModulesBinDirPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(packageJsonDirPath, 'node_modules', '.bin');
219
+ return nodeModulesBinDirPath;
220
+ }
192
221
  const segments = ['.bin'];
193
222
  let foundNodeModules = false;
194
223
  for (const segment of binPath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep).reverse()) {
@@ -204,42 +233,15 @@ function getNodeModulesBinDirPath() {
204
233
  }
205
234
  segments.unshift(segment);
206
235
  }
236
+ if (!foundNodeModules) {
237
+ throw new Error(`Could not find node_modules in path ${binPath}`);
238
+ }
207
239
  const nodeModulesBinDirPath = segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep);
208
240
  cache = nodeModulesBinDirPath;
209
241
  return nodeModulesBinDirPath;
210
242
  }
211
243
 
212
244
 
213
- /***/ }),
214
-
215
- /***/ 704:
216
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
217
-
218
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
219
- /* harmony export */ M: () => (/* binding */ readThisNpmPackageVersion)
220
- /* harmony export */ });
221
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
222
- /* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
223
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
224
- /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
225
- /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(966);
226
- /* harmony import */ var _getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(697);
227
-
228
-
229
-
230
-
231
- let cache = undefined;
232
- function readThisNpmPackageVersion() {
233
- if (cache !== undefined) {
234
- return cache;
235
- }
236
- const version = JSON.parse(fs__WEBPACK_IMPORTED_MODULE_0__.readFileSync((0,path__WEBPACK_IMPORTED_MODULE_1__.join)((0,_getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_2__/* .getThisCodebaseRootDirPath */ .J)(), 'package.json')).toString('utf8'))['version'];
237
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .v)(typeof version === 'string');
238
- cache = version;
239
- return version;
240
- }
241
-
242
-
243
245
  /***/ }),
244
246
 
245
247
  /***/ 479:
@@ -260,9 +262,8 @@ function readThisNpmPackageVersion() {
260
262
  /* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);
261
263
  /* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(966);
262
264
  /* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(94);
263
- /* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(886);
265
+ /* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(886);
264
266
  /* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(399);
265
- /* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(704);
266
267
  /* module decorator */ module = __webpack_require__.hmd(module);
267
268
 
268
269
 
@@ -272,8 +273,6 @@ function readThisNpmPackageVersion() {
272
273
 
273
274
 
274
275
 
275
-
276
-
277
276
  getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_4__.id)(undefined);
278
277
  async function getIsPrettierAvailable() {
279
278
  var _a;
@@ -295,36 +294,32 @@ async function getPrettier() {
295
294
  }
296
295
  let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_4__.id)(undefined);
297
296
  import_prettier: {
298
- // NOTE: When module is linked we want to make sure we import the correct version
299
- // of prettier, that is the one of the project, not the one of this repo.
300
- // So we do a sketchy eval to bypass ncc.
301
- // We make sure to only do that when linking, otherwise we import properly.
302
- if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_7__/* .readThisNpmPackageVersion */ .M)().startsWith('0.0.0')) {
303
- const prettierDirPath = (0,path__WEBPACK_IMPORTED_MODULE_3__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_3__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_5__/* .getNodeModulesBinDirPath */ .p)(), '..', 'prettier'));
304
- const isCJS = true && module.exports;
305
- if (isCJS) {
306
- eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__/* .symToStr */ .I)({ prettier })} = require("${prettierDirPath}")`);
307
- }
308
- else {
309
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
310
- prettier = await new Promise((_resolve) => {
311
- eval(`import("file:///${(0,path__WEBPACK_IMPORTED_MODULE_3__.join)(prettierDirPath, 'index.mjs').replace(/\\/g, '/')}").then(prettier => _resolve(prettier))`);
312
- });
313
- }
314
- (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_6__/* .assert */ .v)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_6__.is)(prettier));
315
- break import_prettier;
297
+ const prettierDirPath = (0,path__WEBPACK_IMPORTED_MODULE_3__.resolve)((0,path__WEBPACK_IMPORTED_MODULE_3__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_5__/* .getNodeModulesBinDirPath */ .p)(), '..', 'prettier'));
298
+ const isCJS = true && module.exports;
299
+ if (isCJS) {
300
+ eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_7__/* .symToStr */ .I)({ prettier })} = require("${prettierDirPath}")`);
316
301
  }
317
- prettier = await Promise.resolve(/* import() */).then(__webpack_require__.bind(__webpack_require__, 261));
302
+ else {
303
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
304
+ prettier = await new Promise((_resolve) => {
305
+ eval(`import("file:///${(0,path__WEBPACK_IMPORTED_MODULE_3__.join)(prettierDirPath, 'index.mjs').replace(/\\/g, '/')}").then(prettier => _resolve(prettier))`);
306
+ });
307
+ }
308
+ (0,tsafe_assert__WEBPACK_IMPORTED_MODULE_6__/* .assert */ .v)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_6__.is)(prettier));
309
+ break import_prettier;
318
310
  }
319
311
  const configHash = await (async () => {
320
- const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_3__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_5__/* .getNodeModulesBinDirPath */ .p)(), '..'));
312
+ const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_3__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_5__/* .getNodeModulesBinDirPath */ .p)(), '..', '..'));
321
313
  if (configFilePath === null) {
322
314
  return '';
323
315
  }
324
316
  const data = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.readFile(configFilePath);
325
317
  return crypto__WEBPACK_IMPORTED_MODULE_1__.createHash('sha256').update(data).digest('hex');
326
318
  })();
327
- const prettierAndConfig = { prettier, configHash };
319
+ const prettierAndConfig = {
320
+ prettier,
321
+ configHash,
322
+ };
328
323
  getPrettier.cache = prettierAndConfig;
329
324
  return prettierAndConfig;
330
325
  }
@@ -333,18 +328,20 @@ async function runPrettier(params) {
333
328
  let formattedSourceCode;
334
329
  try {
335
330
  const { prettier } = await getPrettier();
336
- const { ignored, inferredParser } = await prettier.getFileInfo(filePath, { resolveConfig: true });
337
- if (ignored) {
331
+ const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
332
+ resolveConfig: true,
333
+ });
334
+ if (ignored || inferredParser === null) {
338
335
  return sourceCode;
339
336
  }
340
337
  const config = await prettier.resolveConfig(filePath);
341
- formattedSourceCode = await prettier.format(sourceCode, Object.assign(Object.assign({}, config), { filePath, parser: inferredParser !== null && inferredParser !== void 0 ? inferredParser : undefined }));
338
+ formattedSourceCode = await prettier.format(typeof sourceCode === 'string' ? sourceCode : sourceCode.toString('utf8'), Object.assign(Object.assign({}, config), { filePath, parser: inferredParser }));
342
339
  }
343
340
  catch (error) {
344
341
  console.log(chalk__WEBPACK_IMPORTED_MODULE_0___default().red(`You probably need to upgrade the version of prettier in your project`));
345
342
  throw error;
346
343
  }
347
- return formattedSourceCode;
344
+ return typeof sourceCode === 'string' ? formattedSourceCode : Buffer.from(formattedSourceCode, 'utf8');
348
345
  }
349
346
 
350
347