@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.
- package/keycloakify-svelte/bin/200.index.js +57 -60
- package/keycloakify-svelte/bin/266.index.js +57 -60
- package/keycloakify-svelte/bin/{135.index.js → 343.index.js} +161 -34
- package/keycloakify-svelte/bin/709.index.js +59 -62
- package/keycloakify-svelte/bin/818.index.js +57 -60
- package/keycloakify-svelte/bin/index.js +3 -10
- package/package.json +21 -21
- package/src/bin/tools/getThisCodebaseRootDirPath.ts +7 -0
- package/src/bin/tools/nodeModulesBinDirPath.ts +30 -1
- package/src/bin/tools/runPrettier.ts +42 -39
- package/src/bin/tools/readThisNpmPackageVersion.ts +0 -22
|
@@ -6,7 +6,8 @@ export const modules = {
|
|
|
6
6
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
7
7
|
|
|
8
8
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
9
|
-
/* harmony export */ J: () => (/* binding */ getThisCodebaseRootDirPath)
|
|
9
|
+
/* harmony export */ J: () => (/* binding */ getThisCodebaseRootDirPath),
|
|
10
|
+
/* harmony export */ x: () => (/* binding */ getNearestPackageJsonDirPath)
|
|
10
11
|
/* harmony export */ });
|
|
11
12
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
|
|
12
13
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
|
|
@@ -31,6 +32,12 @@ function getThisCodebaseRootDirPath() {
|
|
|
31
32
|
}
|
|
32
33
|
return (result = getThisCodebaseRootDirPath_rec(__dirname));
|
|
33
34
|
}
|
|
35
|
+
function getNearestPackageJsonDirPath(dirPath) {
|
|
36
|
+
if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(path__WEBPACK_IMPORTED_MODULE_1__.join(dirPath, 'package.json'))) {
|
|
37
|
+
return dirPath;
|
|
38
|
+
}
|
|
39
|
+
return getNearestPackageJsonDirPath(path__WEBPACK_IMPORTED_MODULE_1__.join(dirPath, '..'));
|
|
40
|
+
}
|
|
34
41
|
|
|
35
42
|
|
|
36
43
|
/***/ }),
|
|
@@ -43,13 +50,35 @@ function getThisCodebaseRootDirPath() {
|
|
|
43
50
|
/* harmony export */ });
|
|
44
51
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(928);
|
|
45
52
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
|
|
53
|
+
/* harmony import */ var _getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(697);
|
|
54
|
+
|
|
46
55
|
|
|
47
56
|
let cache = undefined;
|
|
57
|
+
/** NOTE: Careful, this function can fail when the binary
|
|
58
|
+
* Used is not in the node_modules directory of the project
|
|
59
|
+
* (for example when running tests with vscode extension we'll get
|
|
60
|
+
* '/Users/dylan/.vscode/extensions/vitest.explorer-1.16.0/dist/worker.js'
|
|
61
|
+
*
|
|
62
|
+
* instead of
|
|
63
|
+
* '/Users/joseph/.nvm/versions/node/v22.12.0/bin/node'
|
|
64
|
+
* or
|
|
65
|
+
* '/Users/joseph/github/keycloakify-starter/node_modules/.bin/vite'
|
|
66
|
+
*
|
|
67
|
+
* as the value of process.argv[1]
|
|
68
|
+
*/
|
|
48
69
|
function getNodeModulesBinDirPath() {
|
|
49
70
|
if (cache !== undefined) {
|
|
50
71
|
return cache;
|
|
51
72
|
}
|
|
52
73
|
const binPath = process.argv[1];
|
|
74
|
+
special_case_running_not_from_distribution: {
|
|
75
|
+
if (!binPath.endsWith('.ts')) {
|
|
76
|
+
break special_case_running_not_from_distribution;
|
|
77
|
+
}
|
|
78
|
+
const packageJsonDirPath = (0,_getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_1__/* .getNearestPackageJsonDirPath */ .x)((0,path__WEBPACK_IMPORTED_MODULE_0__.dirname)(binPath));
|
|
79
|
+
const nodeModulesBinDirPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(packageJsonDirPath, 'node_modules', '.bin');
|
|
80
|
+
return nodeModulesBinDirPath;
|
|
81
|
+
}
|
|
53
82
|
const segments = ['.bin'];
|
|
54
83
|
let foundNodeModules = false;
|
|
55
84
|
for (const segment of binPath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep).reverse()) {
|
|
@@ -65,42 +94,15 @@ function getNodeModulesBinDirPath() {
|
|
|
65
94
|
}
|
|
66
95
|
segments.unshift(segment);
|
|
67
96
|
}
|
|
97
|
+
if (!foundNodeModules) {
|
|
98
|
+
throw new Error(`Could not find node_modules in path ${binPath}`);
|
|
99
|
+
}
|
|
68
100
|
const nodeModulesBinDirPath = segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep);
|
|
69
101
|
cache = nodeModulesBinDirPath;
|
|
70
102
|
return nodeModulesBinDirPath;
|
|
71
103
|
}
|
|
72
104
|
|
|
73
105
|
|
|
74
|
-
/***/ }),
|
|
75
|
-
|
|
76
|
-
/***/ 704:
|
|
77
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
78
|
-
|
|
79
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
80
|
-
/* harmony export */ M: () => (/* binding */ readThisNpmPackageVersion)
|
|
81
|
-
/* harmony export */ });
|
|
82
|
-
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
|
|
83
|
-
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
|
|
84
|
-
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
|
|
85
|
-
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
|
|
86
|
-
/* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(966);
|
|
87
|
-
/* harmony import */ var _getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(697);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
let cache = undefined;
|
|
93
|
-
function readThisNpmPackageVersion() {
|
|
94
|
-
if (cache !== undefined) {
|
|
95
|
-
return cache;
|
|
96
|
-
}
|
|
97
|
-
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'];
|
|
98
|
-
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .v)(typeof version === 'string');
|
|
99
|
-
cache = version;
|
|
100
|
-
return version;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
|
|
104
106
|
/***/ }),
|
|
105
107
|
|
|
106
108
|
/***/ 479:
|
|
@@ -121,9 +123,8 @@ function readThisNpmPackageVersion() {
|
|
|
121
123
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);
|
|
122
124
|
/* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(966);
|
|
123
125
|
/* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(94);
|
|
124
|
-
/* harmony import */ var
|
|
126
|
+
/* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(886);
|
|
125
127
|
/* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(399);
|
|
126
|
-
/* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(704);
|
|
127
128
|
/* module decorator */ module = __webpack_require__.hmd(module);
|
|
128
129
|
|
|
129
130
|
|
|
@@ -133,8 +134,6 @@ function readThisNpmPackageVersion() {
|
|
|
133
134
|
|
|
134
135
|
|
|
135
136
|
|
|
136
|
-
|
|
137
|
-
|
|
138
137
|
getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_4__.id)(undefined);
|
|
139
138
|
async function getIsPrettierAvailable() {
|
|
140
139
|
var _a;
|
|
@@ -156,36 +155,32 @@ async function getPrettier() {
|
|
|
156
155
|
}
|
|
157
156
|
let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_4__.id)(undefined);
|
|
158
157
|
import_prettier: {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_7__/* .readThisNpmPackageVersion */ .M)().startsWith('0.0.0')) {
|
|
164
|
-
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'));
|
|
165
|
-
const isCJS = true && module.exports;
|
|
166
|
-
if (isCJS) {
|
|
167
|
-
eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__/* .symToStr */ .I)({ prettier })} = require("${prettierDirPath}")`);
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
171
|
-
prettier = await new Promise((_resolve) => {
|
|
172
|
-
eval(`import("file:///${(0,path__WEBPACK_IMPORTED_MODULE_3__.join)(prettierDirPath, 'index.mjs').replace(/\\/g, '/')}").then(prettier => _resolve(prettier))`);
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_6__/* .assert */ .v)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_6__.is)(prettier));
|
|
176
|
-
break import_prettier;
|
|
158
|
+
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'));
|
|
159
|
+
const isCJS = true && module.exports;
|
|
160
|
+
if (isCJS) {
|
|
161
|
+
eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_7__/* .symToStr */ .I)({ prettier })} = require("${prettierDirPath}")`);
|
|
177
162
|
}
|
|
178
|
-
|
|
163
|
+
else {
|
|
164
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
165
|
+
prettier = await new Promise((_resolve) => {
|
|
166
|
+
eval(`import("file:///${(0,path__WEBPACK_IMPORTED_MODULE_3__.join)(prettierDirPath, 'index.mjs').replace(/\\/g, '/')}").then(prettier => _resolve(prettier))`);
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_6__/* .assert */ .v)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_6__.is)(prettier));
|
|
170
|
+
break import_prettier;
|
|
179
171
|
}
|
|
180
172
|
const configHash = await (async () => {
|
|
181
|
-
const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_3__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_5__/* .getNodeModulesBinDirPath */ .p)(), '..'));
|
|
173
|
+
const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_3__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_5__/* .getNodeModulesBinDirPath */ .p)(), '..', '..'));
|
|
182
174
|
if (configFilePath === null) {
|
|
183
175
|
return '';
|
|
184
176
|
}
|
|
185
177
|
const data = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.readFile(configFilePath);
|
|
186
178
|
return crypto__WEBPACK_IMPORTED_MODULE_1__.createHash('sha256').update(data).digest('hex');
|
|
187
179
|
})();
|
|
188
|
-
const prettierAndConfig = {
|
|
180
|
+
const prettierAndConfig = {
|
|
181
|
+
prettier,
|
|
182
|
+
configHash,
|
|
183
|
+
};
|
|
189
184
|
getPrettier.cache = prettierAndConfig;
|
|
190
185
|
return prettierAndConfig;
|
|
191
186
|
}
|
|
@@ -194,18 +189,20 @@ async function runPrettier(params) {
|
|
|
194
189
|
let formattedSourceCode;
|
|
195
190
|
try {
|
|
196
191
|
const { prettier } = await getPrettier();
|
|
197
|
-
const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
|
|
198
|
-
|
|
192
|
+
const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
|
|
193
|
+
resolveConfig: true,
|
|
194
|
+
});
|
|
195
|
+
if (ignored || inferredParser === null) {
|
|
199
196
|
return sourceCode;
|
|
200
197
|
}
|
|
201
198
|
const config = await prettier.resolveConfig(filePath);
|
|
202
|
-
formattedSourceCode = await prettier.format(sourceCode, Object.assign(Object.assign({}, config), { filePath, parser: inferredParser
|
|
199
|
+
formattedSourceCode = await prettier.format(typeof sourceCode === 'string' ? sourceCode : sourceCode.toString('utf8'), Object.assign(Object.assign({}, config), { filePath, parser: inferredParser }));
|
|
203
200
|
}
|
|
204
201
|
catch (error) {
|
|
205
202
|
console.log(chalk__WEBPACK_IMPORTED_MODULE_0___default().red(`You probably need to upgrade the version of prettier in your project`));
|
|
206
203
|
throw error;
|
|
207
204
|
}
|
|
208
|
-
return formattedSourceCode;
|
|
205
|
+
return typeof sourceCode === 'string' ? formattedSourceCode : Buffer.from(formattedSourceCode, 'utf8');
|
|
209
206
|
}
|
|
210
207
|
|
|
211
208
|
|
|
@@ -682,7 +682,8 @@ async function command(params) {
|
|
|
682
682
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
683
683
|
|
|
684
684
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
685
|
-
/* harmony export */ J: () => (/* binding */ getThisCodebaseRootDirPath)
|
|
685
|
+
/* harmony export */ J: () => (/* binding */ getThisCodebaseRootDirPath),
|
|
686
|
+
/* harmony export */ x: () => (/* binding */ getNearestPackageJsonDirPath)
|
|
686
687
|
/* harmony export */ });
|
|
687
688
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
|
|
688
689
|
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
|
|
@@ -707,6 +708,12 @@ function getThisCodebaseRootDirPath() {
|
|
|
707
708
|
}
|
|
708
709
|
return (result = getThisCodebaseRootDirPath_rec(__dirname));
|
|
709
710
|
}
|
|
711
|
+
function getNearestPackageJsonDirPath(dirPath) {
|
|
712
|
+
if (fs__WEBPACK_IMPORTED_MODULE_0__.existsSync(path__WEBPACK_IMPORTED_MODULE_1__.join(dirPath, 'package.json'))) {
|
|
713
|
+
return dirPath;
|
|
714
|
+
}
|
|
715
|
+
return getNearestPackageJsonDirPath(path__WEBPACK_IMPORTED_MODULE_1__.join(dirPath, '..'));
|
|
716
|
+
}
|
|
710
717
|
|
|
711
718
|
|
|
712
719
|
/***/ }),
|
|
@@ -735,13 +742,35 @@ function kebabCaseToCamelCase(kebabCaseString) {
|
|
|
735
742
|
/* harmony export */ });
|
|
736
743
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(928);
|
|
737
744
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__);
|
|
745
|
+
/* harmony import */ var _getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(697);
|
|
746
|
+
|
|
738
747
|
|
|
739
748
|
let cache = undefined;
|
|
749
|
+
/** NOTE: Careful, this function can fail when the binary
|
|
750
|
+
* Used is not in the node_modules directory of the project
|
|
751
|
+
* (for example when running tests with vscode extension we'll get
|
|
752
|
+
* '/Users/dylan/.vscode/extensions/vitest.explorer-1.16.0/dist/worker.js'
|
|
753
|
+
*
|
|
754
|
+
* instead of
|
|
755
|
+
* '/Users/joseph/.nvm/versions/node/v22.12.0/bin/node'
|
|
756
|
+
* or
|
|
757
|
+
* '/Users/joseph/github/keycloakify-starter/node_modules/.bin/vite'
|
|
758
|
+
*
|
|
759
|
+
* as the value of process.argv[1]
|
|
760
|
+
*/
|
|
740
761
|
function getNodeModulesBinDirPath() {
|
|
741
762
|
if (cache !== undefined) {
|
|
742
763
|
return cache;
|
|
743
764
|
}
|
|
744
765
|
const binPath = process.argv[1];
|
|
766
|
+
special_case_running_not_from_distribution: {
|
|
767
|
+
if (!binPath.endsWith('.ts')) {
|
|
768
|
+
break special_case_running_not_from_distribution;
|
|
769
|
+
}
|
|
770
|
+
const packageJsonDirPath = (0,_getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_1__/* .getNearestPackageJsonDirPath */ .x)((0,path__WEBPACK_IMPORTED_MODULE_0__.dirname)(binPath));
|
|
771
|
+
const nodeModulesBinDirPath = (0,path__WEBPACK_IMPORTED_MODULE_0__.join)(packageJsonDirPath, 'node_modules', '.bin');
|
|
772
|
+
return nodeModulesBinDirPath;
|
|
773
|
+
}
|
|
745
774
|
const segments = ['.bin'];
|
|
746
775
|
let foundNodeModules = false;
|
|
747
776
|
for (const segment of binPath.split(path__WEBPACK_IMPORTED_MODULE_0__.sep).reverse()) {
|
|
@@ -757,42 +786,15 @@ function getNodeModulesBinDirPath() {
|
|
|
757
786
|
}
|
|
758
787
|
segments.unshift(segment);
|
|
759
788
|
}
|
|
789
|
+
if (!foundNodeModules) {
|
|
790
|
+
throw new Error(`Could not find node_modules in path ${binPath}`);
|
|
791
|
+
}
|
|
760
792
|
const nodeModulesBinDirPath = segments.join(path__WEBPACK_IMPORTED_MODULE_0__.sep);
|
|
761
793
|
cache = nodeModulesBinDirPath;
|
|
762
794
|
return nodeModulesBinDirPath;
|
|
763
795
|
}
|
|
764
796
|
|
|
765
797
|
|
|
766
|
-
/***/ }),
|
|
767
|
-
|
|
768
|
-
/***/ 704:
|
|
769
|
-
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
770
|
-
|
|
771
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
772
|
-
/* harmony export */ M: () => (/* binding */ readThisNpmPackageVersion)
|
|
773
|
-
/* harmony export */ });
|
|
774
|
-
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(896);
|
|
775
|
-
/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__);
|
|
776
|
-
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(928);
|
|
777
|
-
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_1__);
|
|
778
|
-
/* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(966);
|
|
779
|
-
/* harmony import */ var _getThisCodebaseRootDirPath__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(697);
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
let cache = undefined;
|
|
785
|
-
function readThisNpmPackageVersion() {
|
|
786
|
-
if (cache !== undefined) {
|
|
787
|
-
return cache;
|
|
788
|
-
}
|
|
789
|
-
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'];
|
|
790
|
-
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_3__/* .assert */ .v)(typeof version === 'string');
|
|
791
|
-
cache = version;
|
|
792
|
-
return version;
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
|
|
796
798
|
/***/ }),
|
|
797
799
|
|
|
798
800
|
/***/ 479:
|
|
@@ -813,9 +815,8 @@ function readThisNpmPackageVersion() {
|
|
|
813
815
|
/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_3__);
|
|
814
816
|
/* harmony import */ var tsafe_assert__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(966);
|
|
815
817
|
/* harmony import */ var tsafe_id__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(94);
|
|
816
|
-
/* harmony import */ var
|
|
818
|
+
/* harmony import */ var tsafe_symToStr__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(886);
|
|
817
819
|
/* harmony import */ var _nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(399);
|
|
818
|
-
/* harmony import */ var _readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(704);
|
|
819
820
|
/* module decorator */ module = __webpack_require__.hmd(module);
|
|
820
821
|
|
|
821
822
|
|
|
@@ -825,8 +826,6 @@ function readThisNpmPackageVersion() {
|
|
|
825
826
|
|
|
826
827
|
|
|
827
828
|
|
|
828
|
-
|
|
829
|
-
|
|
830
829
|
getIsPrettierAvailable.cache = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_4__.id)(undefined);
|
|
831
830
|
async function getIsPrettierAvailable() {
|
|
832
831
|
var _a;
|
|
@@ -848,36 +847,32 @@ async function getPrettier() {
|
|
|
848
847
|
}
|
|
849
848
|
let prettier = (0,tsafe_id__WEBPACK_IMPORTED_MODULE_4__.id)(undefined);
|
|
850
849
|
import_prettier: {
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
if ((0,_readThisNpmPackageVersion__WEBPACK_IMPORTED_MODULE_7__/* .readThisNpmPackageVersion */ .M)().startsWith('0.0.0')) {
|
|
856
|
-
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'));
|
|
857
|
-
const isCJS = true && module.exports;
|
|
858
|
-
if (isCJS) {
|
|
859
|
-
eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_8__/* .symToStr */ .I)({ prettier })} = require("${prettierDirPath}")`);
|
|
860
|
-
}
|
|
861
|
-
else {
|
|
862
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
863
|
-
prettier = await new Promise((_resolve) => {
|
|
864
|
-
eval(`import("file:///${(0,path__WEBPACK_IMPORTED_MODULE_3__.join)(prettierDirPath, 'index.mjs').replace(/\\/g, '/')}").then(prettier => _resolve(prettier))`);
|
|
865
|
-
});
|
|
866
|
-
}
|
|
867
|
-
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_6__/* .assert */ .v)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_6__.is)(prettier));
|
|
868
|
-
break import_prettier;
|
|
850
|
+
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'));
|
|
851
|
+
const isCJS = true && module.exports;
|
|
852
|
+
if (isCJS) {
|
|
853
|
+
eval(`${(0,tsafe_symToStr__WEBPACK_IMPORTED_MODULE_7__/* .symToStr */ .I)({ prettier })} = require("${prettierDirPath}")`);
|
|
869
854
|
}
|
|
870
|
-
|
|
855
|
+
else {
|
|
856
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
857
|
+
prettier = await new Promise((_resolve) => {
|
|
858
|
+
eval(`import("file:///${(0,path__WEBPACK_IMPORTED_MODULE_3__.join)(prettierDirPath, 'index.mjs').replace(/\\/g, '/')}").then(prettier => _resolve(prettier))`);
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_6__/* .assert */ .v)(!(0,tsafe_assert__WEBPACK_IMPORTED_MODULE_6__.is)(prettier));
|
|
862
|
+
break import_prettier;
|
|
871
863
|
}
|
|
872
864
|
const configHash = await (async () => {
|
|
873
|
-
const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_3__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_5__/* .getNodeModulesBinDirPath */ .p)(), '..'));
|
|
865
|
+
const configFilePath = await prettier.resolveConfigFile((0,path__WEBPACK_IMPORTED_MODULE_3__.join)((0,_nodeModulesBinDirPath__WEBPACK_IMPORTED_MODULE_5__/* .getNodeModulesBinDirPath */ .p)(), '..', '..'));
|
|
874
866
|
if (configFilePath === null) {
|
|
875
867
|
return '';
|
|
876
868
|
}
|
|
877
869
|
const data = await fs_promises__WEBPACK_IMPORTED_MODULE_2__.readFile(configFilePath);
|
|
878
870
|
return crypto__WEBPACK_IMPORTED_MODULE_1__.createHash('sha256').update(data).digest('hex');
|
|
879
871
|
})();
|
|
880
|
-
const prettierAndConfig = {
|
|
872
|
+
const prettierAndConfig = {
|
|
873
|
+
prettier,
|
|
874
|
+
configHash,
|
|
875
|
+
};
|
|
881
876
|
getPrettier.cache = prettierAndConfig;
|
|
882
877
|
return prettierAndConfig;
|
|
883
878
|
}
|
|
@@ -886,18 +881,20 @@ async function runPrettier(params) {
|
|
|
886
881
|
let formattedSourceCode;
|
|
887
882
|
try {
|
|
888
883
|
const { prettier } = await getPrettier();
|
|
889
|
-
const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
|
|
890
|
-
|
|
884
|
+
const { ignored, inferredParser } = await prettier.getFileInfo(filePath, {
|
|
885
|
+
resolveConfig: true,
|
|
886
|
+
});
|
|
887
|
+
if (ignored || inferredParser === null) {
|
|
891
888
|
return sourceCode;
|
|
892
889
|
}
|
|
893
890
|
const config = await prettier.resolveConfig(filePath);
|
|
894
|
-
formattedSourceCode = await prettier.format(sourceCode, Object.assign(Object.assign({}, config), { filePath, parser: inferredParser
|
|
891
|
+
formattedSourceCode = await prettier.format(typeof sourceCode === 'string' ? sourceCode : sourceCode.toString('utf8'), Object.assign(Object.assign({}, config), { filePath, parser: inferredParser }));
|
|
895
892
|
}
|
|
896
893
|
catch (error) {
|
|
897
894
|
console.log(chalk__WEBPACK_IMPORTED_MODULE_0___default().red(`You probably need to upgrade the version of prettier in your project`));
|
|
898
895
|
throw error;
|
|
899
896
|
}
|
|
900
|
-
return formattedSourceCode;
|
|
897
|
+
return typeof sourceCode === 'string' ? formattedSourceCode : Buffer.from(formattedSourceCode, 'utf8');
|
|
901
898
|
}
|
|
902
899
|
|
|
903
900
|
|