@skmtc/core 0.0.634 → 0.0.636
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/esm/context/CoreContext.js +1 -1
- package/esm/context/RenderContext.d.ts +2 -3
- package/esm/context/RenderContext.d.ts.map +1 -1
- package/esm/context/RenderContext.js +20 -21
- package/package.json +2 -2
- package/script/context/CoreContext.js +1 -1
- package/script/context/RenderContext.d.ts +2 -3
- package/script/context/RenderContext.d.ts.map +1 -1
- package/script/context/RenderContext.js +20 -21
|
@@ -180,7 +180,7 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
180
180
|
files,
|
|
181
181
|
previews,
|
|
182
182
|
schemaOptions,
|
|
183
|
-
prettier,
|
|
183
|
+
prettierConfig: prettier,
|
|
184
184
|
basePath,
|
|
185
185
|
logger: this.logger,
|
|
186
186
|
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
@@ -12,7 +12,7 @@ type ConstructorArgs = {
|
|
|
12
12
|
files: Map<string, File>;
|
|
13
13
|
previews: Record<string, Record<string, Preview>>;
|
|
14
14
|
schemaOptions: SchemaOption[];
|
|
15
|
-
|
|
15
|
+
prettierConfig?: PrettierConfigType;
|
|
16
16
|
basePath: string | undefined;
|
|
17
17
|
stackTrail: StackTrail;
|
|
18
18
|
logger: log.Logger;
|
|
@@ -23,11 +23,10 @@ export declare class RenderContext {
|
|
|
23
23
|
files: Map<string, File>;
|
|
24
24
|
previews: Record<string, Record<string, Preview>>;
|
|
25
25
|
schemaOptions: SchemaOption[];
|
|
26
|
-
private prettier?;
|
|
27
26
|
basePath: string | undefined;
|
|
28
27
|
logger: log.Logger;
|
|
29
28
|
captureCurrentResult: (result: ResultType) => void;
|
|
30
|
-
constructor({ files, previews, schemaOptions,
|
|
29
|
+
constructor({ files, previews, schemaOptions, prettierConfig, basePath, logger, stackTrail, captureCurrentResult }: ConstructorArgs);
|
|
31
30
|
render(): Omit<RenderResult, 'results'>;
|
|
32
31
|
private collate;
|
|
33
32
|
trace<T>(token: string | string[], fn: () => T): T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderContext.d.ts","sourceRoot":"","sources":["../../src/context/RenderContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEpE,OAAO,KAAK,EAAqB,YAAY,EAAE,MAAM,YAAY,CAAA;AAEjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAGrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,KAAK,GAAG,MAAM,wCAAwC,CAAA;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"RenderContext.d.ts","sourceRoot":"","sources":["../../src/context/RenderContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEpE,OAAO,KAAK,EAAqB,YAAY,EAAE,MAAM,YAAY,CAAA;AAEjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAGrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,KAAK,GAAG,MAAM,wCAAwC,C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,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;IAIlD,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAU/B,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS;CAG7D"}
|
|
@@ -9,17 +9,26 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _RenderContext_stackTrail;
|
|
12
|
+
var _RenderContext_prettierConfig, _RenderContext_stackTrail;
|
|
13
13
|
import * as Sentry from '@sentry/deno';
|
|
14
14
|
import invariant from 'tiny-invariant';
|
|
15
15
|
import { normalize } from '../deps/jsr.io/@std/path/1.0.6/mod.js';
|
|
16
16
|
import { toResolvedArtifactPath } from '../helpers/toResolvedArtifactPath.js';
|
|
17
17
|
import { tracer } from '../helpers/tracer.js';
|
|
18
|
-
import
|
|
18
|
+
import * as prettier from 'prettier';
|
|
19
19
|
import estree from 'prettier/plugins/estree';
|
|
20
20
|
import typescript from 'prettier/plugins/typescript';
|
|
21
|
+
import makeSynchronized from 'make-synchronized';
|
|
22
|
+
const formatSync = makeSynchronized(({ content, prettierConfig, path }) => {
|
|
23
|
+
return prettier.format(content, {
|
|
24
|
+
...prettierConfig,
|
|
25
|
+
parser: 'estree',
|
|
26
|
+
plugins: [estree, typescript],
|
|
27
|
+
filepath: path
|
|
28
|
+
});
|
|
29
|
+
});
|
|
21
30
|
export class RenderContext {
|
|
22
|
-
constructor({ files, previews, schemaOptions,
|
|
31
|
+
constructor({ files, previews, schemaOptions, prettierConfig, basePath, logger, stackTrail, captureCurrentResult }) {
|
|
23
32
|
Object.defineProperty(this, "files", {
|
|
24
33
|
enumerable: true,
|
|
25
34
|
configurable: true,
|
|
@@ -38,12 +47,7 @@ export class RenderContext {
|
|
|
38
47
|
writable: true,
|
|
39
48
|
value: void 0
|
|
40
49
|
});
|
|
41
|
-
|
|
42
|
-
enumerable: true,
|
|
43
|
-
configurable: true,
|
|
44
|
-
writable: true,
|
|
45
|
-
value: void 0
|
|
46
|
-
});
|
|
50
|
+
_RenderContext_prettierConfig.set(this, void 0);
|
|
47
51
|
Object.defineProperty(this, "basePath", {
|
|
48
52
|
enumerable: true,
|
|
49
53
|
configurable: true,
|
|
@@ -66,7 +70,7 @@ export class RenderContext {
|
|
|
66
70
|
this.files = files;
|
|
67
71
|
this.previews = previews;
|
|
68
72
|
this.schemaOptions = schemaOptions;
|
|
69
|
-
this
|
|
73
|
+
__classPrivateFieldSet(this, _RenderContext_prettierConfig, prettierConfig, "f");
|
|
70
74
|
this.basePath = basePath;
|
|
71
75
|
this.logger = logger;
|
|
72
76
|
__classPrivateFieldSet(this, _RenderContext_stackTrail, stackTrail, "f");
|
|
@@ -95,7 +99,7 @@ export class RenderContext {
|
|
|
95
99
|
content: file.toString(),
|
|
96
100
|
destinationPath,
|
|
97
101
|
basePath: this.basePath,
|
|
98
|
-
|
|
102
|
+
prettierConfig: __classPrivateFieldGet(this, _RenderContext_prettierConfig, "f")
|
|
99
103
|
});
|
|
100
104
|
this.captureCurrentResult('success');
|
|
101
105
|
return renderedFile;
|
|
@@ -132,18 +136,13 @@ export class RenderContext {
|
|
|
132
136
|
return this.getFile(exportPath).definitions.get(name);
|
|
133
137
|
}
|
|
134
138
|
}
|
|
135
|
-
_RenderContext_stackTrail = new WeakMap();
|
|
136
|
-
const renderFile = ({ content, destinationPath, basePath,
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
parser: 'estree',
|
|
140
|
-
plugins: [estree, typescript],
|
|
141
|
-
...prettier
|
|
142
|
-
})
|
|
143
|
-
: content;
|
|
139
|
+
_RenderContext_prettierConfig = new WeakMap(), _RenderContext_stackTrail = new WeakMap();
|
|
140
|
+
const renderFile = ({ content, destinationPath, basePath, prettierConfig }) => {
|
|
141
|
+
const path = toResolvedArtifactPath({ basePath, destinationPath });
|
|
142
|
+
const formatted = prettierConfig ? formatSync({ prettierConfig, content, path }) : content;
|
|
144
143
|
return {
|
|
145
144
|
content: formatted,
|
|
146
|
-
path
|
|
145
|
+
path,
|
|
147
146
|
destinationPath,
|
|
148
147
|
lines: formatted.split('\n').length,
|
|
149
148
|
characters: formatted.length
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skmtc/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.636",
|
|
4
4
|
"main": "./script/mod.js",
|
|
5
5
|
"module": "./esm/mod.js",
|
|
6
6
|
"exports": {
|
|
@@ -133,12 +133,12 @@
|
|
|
133
133
|
"@apiture/openapi-down-convert": "0.14.0",
|
|
134
134
|
"@babel/helper-validator-identifier": "7.22.20",
|
|
135
135
|
"@deno/shim-deno": "~0.18.0",
|
|
136
|
-
"@prettier/sync": "^0.5.5",
|
|
137
136
|
"@sentry/deno": "8.47.0",
|
|
138
137
|
"@types/babel__helper-validator-identifier": "7.15.2",
|
|
139
138
|
"@types/lodash-es": "4.17.12",
|
|
140
139
|
"@types/swagger2openapi": "7.0.4",
|
|
141
140
|
"lodash-es": "4.17.21",
|
|
141
|
+
"make-synchronized": "^0.7.2",
|
|
142
142
|
"openapi-types": "12.1.3",
|
|
143
143
|
"prettier": "^3.5.3",
|
|
144
144
|
"swagger2openapi": "7.0.8",
|
|
@@ -208,7 +208,7 @@ _CoreContext_phase = new WeakMap(), _CoreContext_results = new WeakMap(), _CoreC
|
|
|
208
208
|
files,
|
|
209
209
|
previews,
|
|
210
210
|
schemaOptions,
|
|
211
|
-
prettier,
|
|
211
|
+
prettierConfig: prettier,
|
|
212
212
|
basePath,
|
|
213
213
|
logger: this.logger,
|
|
214
214
|
stackTrail: __classPrivateFieldGet(this, _CoreContext_stackTrail, "f"),
|
|
@@ -12,7 +12,7 @@ type ConstructorArgs = {
|
|
|
12
12
|
files: Map<string, File>;
|
|
13
13
|
previews: Record<string, Record<string, Preview>>;
|
|
14
14
|
schemaOptions: SchemaOption[];
|
|
15
|
-
|
|
15
|
+
prettierConfig?: PrettierConfigType;
|
|
16
16
|
basePath: string | undefined;
|
|
17
17
|
stackTrail: StackTrail;
|
|
18
18
|
logger: log.Logger;
|
|
@@ -23,11 +23,10 @@ export declare class RenderContext {
|
|
|
23
23
|
files: Map<string, File>;
|
|
24
24
|
previews: Record<string, Record<string, Preview>>;
|
|
25
25
|
schemaOptions: SchemaOption[];
|
|
26
|
-
private prettier?;
|
|
27
26
|
basePath: string | undefined;
|
|
28
27
|
logger: log.Logger;
|
|
29
28
|
captureCurrentResult: (result: ResultType) => void;
|
|
30
|
-
constructor({ files, previews, schemaOptions,
|
|
29
|
+
constructor({ files, previews, schemaOptions, prettierConfig, basePath, logger, stackTrail, captureCurrentResult }: ConstructorArgs);
|
|
31
30
|
render(): Omit<RenderResult, 'results'>;
|
|
32
31
|
private collate;
|
|
33
32
|
trace<T>(token: string | string[], fn: () => T): T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RenderContext.d.ts","sourceRoot":"","sources":["../../src/context/RenderContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAEpE,OAAO,KAAK,EAAqB,YAAY,EAAE,MAAM,YAAY,CAAA;AAEjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAGrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,KAAK,GAAG,MAAM,wCAAwC,CAAA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UAAU,KAAK,IAAI,CAAA;CACnD,CAAA;AAyBD,qBAAa,aAAa;;IACxB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACxB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACjD,aAAa,EAAE,YAAY,EAAE,CAAA;IAE7B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,MAAM,EAAE,GAAG,CAAC,MAAM,CAAA;IAElB,oBAAoB,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAA;gBACtC,EACV,KAAK,EACL,QAAQ,EACR,aAAa,EACb,cAAc,EACd,QAAQ,EACR,MAAM,EACN,UAAU,EACV,oBAAoB,EACrB,EAAE,eAAe;IAWlB,MAAM,IAAI,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC;IAiBvC,OAAO,CAAC,OAAO;IAyCf,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC;IAIlD,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAU/B,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS;CAG7D"}
|
|
@@ -36,7 +36,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
36
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
|
-
var _RenderContext_stackTrail;
|
|
39
|
+
var _RenderContext_prettierConfig, _RenderContext_stackTrail;
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.RenderContext = void 0;
|
|
42
42
|
const Sentry = __importStar(require("@sentry/deno"));
|
|
@@ -44,11 +44,20 @@ const tiny_invariant_1 = __importDefault(require("tiny-invariant"));
|
|
|
44
44
|
const mod_js_1 = require("../deps/jsr.io/@std/path/1.0.6/mod.js");
|
|
45
45
|
const toResolvedArtifactPath_js_1 = require("../helpers/toResolvedArtifactPath.js");
|
|
46
46
|
const tracer_js_1 = require("../helpers/tracer.js");
|
|
47
|
-
const
|
|
47
|
+
const prettier = __importStar(require("prettier"));
|
|
48
48
|
const estree_1 = __importDefault(require("prettier/plugins/estree"));
|
|
49
49
|
const typescript_1 = __importDefault(require("prettier/plugins/typescript"));
|
|
50
|
+
const make_synchronized_1 = __importDefault(require("make-synchronized"));
|
|
51
|
+
const formatSync = (0, make_synchronized_1.default)(({ content, prettierConfig, path }) => {
|
|
52
|
+
return prettier.format(content, {
|
|
53
|
+
...prettierConfig,
|
|
54
|
+
parser: 'estree',
|
|
55
|
+
plugins: [estree_1.default, typescript_1.default],
|
|
56
|
+
filepath: path
|
|
57
|
+
});
|
|
58
|
+
});
|
|
50
59
|
class RenderContext {
|
|
51
|
-
constructor({ files, previews, schemaOptions,
|
|
60
|
+
constructor({ files, previews, schemaOptions, prettierConfig, basePath, logger, stackTrail, captureCurrentResult }) {
|
|
52
61
|
Object.defineProperty(this, "files", {
|
|
53
62
|
enumerable: true,
|
|
54
63
|
configurable: true,
|
|
@@ -67,12 +76,7 @@ class RenderContext {
|
|
|
67
76
|
writable: true,
|
|
68
77
|
value: void 0
|
|
69
78
|
});
|
|
70
|
-
|
|
71
|
-
enumerable: true,
|
|
72
|
-
configurable: true,
|
|
73
|
-
writable: true,
|
|
74
|
-
value: void 0
|
|
75
|
-
});
|
|
79
|
+
_RenderContext_prettierConfig.set(this, void 0);
|
|
76
80
|
Object.defineProperty(this, "basePath", {
|
|
77
81
|
enumerable: true,
|
|
78
82
|
configurable: true,
|
|
@@ -95,7 +99,7 @@ class RenderContext {
|
|
|
95
99
|
this.files = files;
|
|
96
100
|
this.previews = previews;
|
|
97
101
|
this.schemaOptions = schemaOptions;
|
|
98
|
-
this
|
|
102
|
+
__classPrivateFieldSet(this, _RenderContext_prettierConfig, prettierConfig, "f");
|
|
99
103
|
this.basePath = basePath;
|
|
100
104
|
this.logger = logger;
|
|
101
105
|
__classPrivateFieldSet(this, _RenderContext_stackTrail, stackTrail, "f");
|
|
@@ -124,7 +128,7 @@ class RenderContext {
|
|
|
124
128
|
content: file.toString(),
|
|
125
129
|
destinationPath,
|
|
126
130
|
basePath: this.basePath,
|
|
127
|
-
|
|
131
|
+
prettierConfig: __classPrivateFieldGet(this, _RenderContext_prettierConfig, "f")
|
|
128
132
|
});
|
|
129
133
|
this.captureCurrentResult('success');
|
|
130
134
|
return renderedFile;
|
|
@@ -162,18 +166,13 @@ class RenderContext {
|
|
|
162
166
|
}
|
|
163
167
|
}
|
|
164
168
|
exports.RenderContext = RenderContext;
|
|
165
|
-
_RenderContext_stackTrail = new WeakMap();
|
|
166
|
-
const renderFile = ({ content, destinationPath, basePath,
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
parser: 'estree',
|
|
170
|
-
plugins: [estree_1.default, typescript_1.default],
|
|
171
|
-
...prettier
|
|
172
|
-
})
|
|
173
|
-
: content;
|
|
169
|
+
_RenderContext_prettierConfig = new WeakMap(), _RenderContext_stackTrail = new WeakMap();
|
|
170
|
+
const renderFile = ({ content, destinationPath, basePath, prettierConfig }) => {
|
|
171
|
+
const path = (0, toResolvedArtifactPath_js_1.toResolvedArtifactPath)({ basePath, destinationPath });
|
|
172
|
+
const formatted = prettierConfig ? formatSync({ prettierConfig, content, path }) : content;
|
|
174
173
|
return {
|
|
175
174
|
content: formatted,
|
|
176
|
-
path
|
|
175
|
+
path,
|
|
177
176
|
destinationPath,
|
|
178
177
|
lines: formatted.split('\n').length,
|
|
179
178
|
characters: formatted.length
|