@strapi/typescript-utils 0.0.0-experimental.6340da17068c3bed7fb006e7bcc554c71129e282 → 0.0.0-experimental.63624e21eb5b0713345a0cf2f68f1c40eab427bc
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/dist/compile.d.ts +5 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +12 -0
- package/dist/compile.js.map +1 -0
- package/dist/compile.mjs +10 -0
- package/dist/compile.mjs.map +1 -0
- package/dist/compilers/basic.d.ts +11 -0
- package/dist/compilers/basic.d.ts.map +1 -0
- package/dist/compilers/basic.js +58 -0
- package/dist/compilers/basic.js.map +1 -0
- package/dist/compilers/basic.mjs +36 -0
- package/dist/compilers/basic.mjs.map +1 -0
- package/dist/compilers/index.d.ts +3 -0
- package/dist/compilers/index.d.ts.map +1 -0
- package/dist/compilers/index.js +8 -0
- package/dist/compilers/index.js.map +1 -0
- package/dist/compilers/index.mjs +3 -0
- package/dist/compilers/index.mjs.map +1 -0
- package/dist/generators/common/compare.d.ts +14 -0
- package/dist/generators/common/compare.d.ts.map +1 -0
- package/dist/generators/common/compare.js +25 -0
- package/dist/generators/common/compare.js.map +1 -0
- package/dist/generators/common/compare.mjs +22 -0
- package/dist/generators/common/compare.mjs.map +1 -0
- package/dist/generators/common/imports.d.ts +5 -0
- package/dist/generators/common/imports.d.ts.map +1 -0
- package/dist/generators/common/imports.js +42 -0
- package/dist/generators/common/imports.js.map +1 -0
- package/dist/generators/common/imports.mjs +19 -0
- package/dist/generators/common/imports.mjs.map +1 -0
- package/dist/generators/common/index.d.ts +4 -0
- package/dist/generators/common/index.d.ts.map +1 -0
- package/dist/generators/common/interface-names.d.ts +16 -0
- package/dist/generators/common/interface-names.d.ts.map +1 -0
- package/dist/generators/common/interface-names.js +54 -0
- package/dist/generators/common/interface-names.js.map +1 -0
- package/dist/generators/common/interface-names.mjs +52 -0
- package/dist/generators/common/interface-names.mjs.map +1 -0
- package/dist/generators/common/models/attributes.d.ts +38 -0
- package/dist/generators/common/models/attributes.d.ts.map +1 -0
- package/dist/generators/common/models/attributes.js +205 -0
- package/dist/generators/common/models/attributes.js.map +1 -0
- package/dist/generators/common/models/attributes.mjs +176 -0
- package/dist/generators/common/models/attributes.mjs.map +1 -0
- package/dist/generators/common/models/index.d.ts +7 -0
- package/dist/generators/common/models/index.d.ts.map +1 -0
- package/dist/generators/common/models/mappers.d.ts +9 -0
- package/dist/generators/common/models/mappers.d.ts.map +1 -0
- package/dist/generators/common/models/mappers.js +227 -0
- package/dist/generators/common/models/mappers.js.map +1 -0
- package/dist/generators/common/models/mappers.mjs +202 -0
- package/dist/generators/common/models/mappers.mjs.map +1 -0
- package/dist/generators/common/models/schema.d.ts +8 -0
- package/dist/generators/common/models/schema.d.ts.map +1 -0
- package/dist/generators/common/models/schema.js +78 -0
- package/dist/generators/common/models/schema.js.map +1 -0
- package/dist/generators/common/models/schema.mjs +56 -0
- package/dist/generators/common/models/schema.mjs.map +1 -0
- package/dist/generators/common/models/utils.d.ts +57 -0
- package/dist/generators/common/models/utils.d.ts.map +1 -0
- package/dist/generators/common/models/utils.js +110 -0
- package/dist/generators/common/models/utils.js.map +1 -0
- package/dist/generators/common/models/utils.mjs +82 -0
- package/dist/generators/common/models/utils.mjs.map +1 -0
- package/dist/generators/common/sources.d.ts +133 -0
- package/dist/generators/common/sources.d.ts.map +1 -0
- package/dist/generators/common/sources.js +354 -0
- package/dist/generators/common/sources.js.map +1 -0
- package/dist/generators/common/sources.mjs +318 -0
- package/dist/generators/common/sources.mjs.map +1 -0
- package/dist/generators/components/index.d.ts +9 -0
- package/dist/generators/components/index.d.ts.map +1 -0
- package/dist/generators/components/index.js +84 -0
- package/dist/generators/components/index.js.map +1 -0
- package/dist/generators/components/index.mjs +62 -0
- package/dist/generators/components/index.mjs.map +1 -0
- package/dist/generators/constants.d.ts +3 -0
- package/dist/generators/constants.d.ts.map +1 -0
- package/dist/generators/constants.js +8 -0
- package/dist/generators/constants.js.map +1 -0
- package/dist/generators/constants.mjs +5 -0
- package/dist/generators/constants.mjs.map +1 -0
- package/dist/generators/content-types/index.d.ts +9 -0
- package/dist/generators/content-types/index.d.ts.map +1 -0
- package/dist/generators/content-types/index.js +84 -0
- package/dist/generators/content-types/index.js.map +1 -0
- package/dist/generators/content-types/index.mjs +62 -0
- package/dist/generators/content-types/index.mjs.map +1 -0
- package/dist/generators/controllers/index.d.ts +35 -0
- package/dist/generators/controllers/index.d.ts.map +1 -0
- package/dist/generators/controllers/index.js +88 -0
- package/dist/generators/controllers/index.js.map +1 -0
- package/dist/generators/controllers/index.mjs +86 -0
- package/dist/generators/controllers/index.mjs.map +1 -0
- package/dist/generators/index.d.ts +31 -0
- package/dist/generators/index.d.ts.map +1 -0
- package/dist/generators/index.js +150 -0
- package/dist/generators/index.js.map +1 -0
- package/dist/generators/index.mjs +142 -0
- package/dist/generators/index.mjs.map +1 -0
- package/dist/generators/middlewares/index.d.ts +30 -0
- package/dist/generators/middlewares/index.d.ts.map +1 -0
- package/dist/generators/middlewares/index.js +163 -0
- package/dist/generators/middlewares/index.js.map +1 -0
- package/dist/generators/middlewares/index.mjs +141 -0
- package/dist/generators/middlewares/index.mjs.map +1 -0
- package/dist/generators/plugins/index.d.ts +9 -0
- package/dist/generators/plugins/index.d.ts.map +1 -0
- package/dist/generators/plugins/index.js +225 -0
- package/dist/generators/plugins/index.js.map +1 -0
- package/dist/generators/plugins/index.mjs +200 -0
- package/dist/generators/plugins/index.mjs.map +1 -0
- package/dist/generators/policies/index.d.ts +29 -0
- package/dist/generators/policies/index.d.ts.map +1 -0
- package/dist/generators/policies/index.js +135 -0
- package/dist/generators/policies/index.js.map +1 -0
- package/dist/generators/policies/index.mjs +113 -0
- package/dist/generators/policies/index.mjs.map +1 -0
- package/dist/generators/services/index.d.ts +35 -0
- package/dist/generators/services/index.d.ts.map +1 -0
- package/dist/generators/services/index.js +87 -0
- package/dist/generators/services/index.js.map +1 -0
- package/dist/generators/services/index.mjs +85 -0
- package/dist/generators/services/index.mjs.map +1 -0
- package/dist/generators/strict/index.d.ts +13 -0
- package/dist/generators/strict/index.d.ts.map +1 -0
- package/dist/generators/strict/index.js +24 -0
- package/dist/generators/strict/index.js.map +1 -0
- package/dist/generators/strict/index.mjs +22 -0
- package/dist/generators/strict/index.mjs.map +1 -0
- package/dist/generators/utils.d.ts +68 -0
- package/dist/generators/utils.d.ts.map +1 -0
- package/dist/generators/utils.js +201 -0
- package/dist/generators/utils.js.map +1 -0
- package/dist/generators/utils.mjs +166 -0
- package/dist/generators/utils.mjs.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +14 -0
- package/dist/index.mjs.map +1 -0
- package/dist/utils/format-host.d.ts +3 -0
- package/dist/utils/format-host.d.ts.map +1 -0
- package/dist/utils/format-host.js +33 -0
- package/dist/utils/format-host.js.map +1 -0
- package/dist/utils/format-host.mjs +11 -0
- package/dist/utils/format-host.mjs.map +1 -0
- package/dist/utils/get-config-path.d.ts +10 -0
- package/dist/utils/get-config-path.d.ts.map +1 -0
- package/dist/utils/get-config-path.js +43 -0
- package/dist/utils/get-config-path.js.map +1 -0
- package/dist/utils/get-config-path.mjs +18 -0
- package/dist/utils/get-config-path.mjs.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/is-using-typescript-sync.d.ts +5 -0
- package/dist/utils/is-using-typescript-sync.d.ts.map +1 -0
- package/dist/utils/is-using-typescript-sync.js +20 -0
- package/dist/utils/is-using-typescript-sync.js.map +1 -0
- package/dist/utils/is-using-typescript-sync.mjs +14 -0
- package/dist/utils/is-using-typescript-sync.mjs.map +1 -0
- package/dist/utils/is-using-typescript.d.ts +5 -0
- package/dist/utils/is-using-typescript.d.ts.map +1 -0
- package/dist/utils/is-using-typescript.js +20 -0
- package/dist/utils/is-using-typescript.js.map +1 -0
- package/dist/utils/is-using-typescript.mjs +14 -0
- package/dist/utils/is-using-typescript.mjs.map +1 -0
- package/dist/utils/report-diagnostics.d.ts +6 -0
- package/dist/utils/report-diagnostics.d.ts.map +1 -0
- package/dist/utils/report-diagnostics.js +37 -0
- package/dist/utils/report-diagnostics.js.map +1 -0
- package/dist/utils/report-diagnostics.mjs +15 -0
- package/dist/utils/report-diagnostics.mjs.map +1 -0
- package/dist/utils/resolve-config-options.d.ts +12 -0
- package/dist/utils/resolve-config-options.d.ts.map +1 -0
- package/dist/utils/resolve-config-options.js +39 -0
- package/dist/utils/resolve-config-options.js.map +1 -0
- package/dist/utils/resolve-config-options.mjs +17 -0
- package/dist/utils/resolve-config-options.mjs.map +1 -0
- package/dist/utils/resolve-outdir-sync.d.ts +5 -0
- package/dist/utils/resolve-outdir-sync.d.ts.map +1 -0
- package/dist/utils/resolve-outdir-sync.js +19 -0
- package/dist/utils/resolve-outdir-sync.js.map +1 -0
- package/dist/utils/resolve-outdir-sync.mjs +13 -0
- package/dist/utils/resolve-outdir-sync.mjs.map +1 -0
- package/dist/utils/resolve-outdir.d.ts +5 -0
- package/dist/utils/resolve-outdir.d.ts.map +1 -0
- package/dist/utils/resolve-outdir.js +19 -0
- package/dist/utils/resolve-outdir.js.map +1 -0
- package/dist/utils/resolve-outdir.mjs +13 -0
- package/dist/utils/resolve-outdir.mjs.map +1 -0
- package/package.json +27 -12
- package/.eslintrc.cjs +0 -16
- package/index.d.ts +0 -5
- package/jest.config.js +0 -6
- package/lib/__tests__/generators/schemas/attributes.test.js +0 -903
- package/lib/__tests__/generators/schemas/imports.test.js +0 -56
- package/lib/__tests__/generators/schemas/utils.test.js +0 -314
- package/lib/compile.js +0 -10
- package/lib/compilers/basic.js +0 -50
- package/lib/compilers/index.js +0 -7
- package/lib/generators/common/imports.js +0 -34
- package/lib/generators/common/index.js +0 -9
- package/lib/generators/common/models/attributes.js +0 -198
- package/lib/generators/common/models/index.js +0 -15
- package/lib/generators/common/models/mappers.js +0 -144
- package/lib/generators/common/models/schema.js +0 -93
- package/lib/generators/common/models/utils.js +0 -178
- package/lib/generators/components/index.js +0 -74
- package/lib/generators/constants.js +0 -6
- package/lib/generators/content-types/index.js +0 -74
- package/lib/generators/index.js +0 -122
- package/lib/generators/utils.js +0 -216
- package/lib/index.js +0 -13
- package/lib/utils/format-host.js +0 -15
- package/lib/utils/get-config-path.js +0 -29
- package/lib/utils/index.js +0 -21
- package/lib/utils/is-using-typescript-sync.js +0 -19
- package/lib/utils/is-using-typescript.js +0 -17
- package/lib/utils/report-diagnostics.js +0 -19
- package/lib/utils/resolve-config-options.js +0 -23
- package/lib/utils/resolve-outdir-sync.js +0 -18
- package/lib/utils/resolve-outdir.js +0 -18
- package/lint-staged.config.mjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../src/compile.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,eAAO,MAAM,OAAO,GAClB,QAAQ,MAAM,EACd,oBAAwB;IAAE,aAAa,CAAC,EAAE,aAAa,CAAA;CAAO,KAC7D,OAAO,CAAC,IAAI,CAId,CAAC"}
|
package/dist/compile.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var basic = require('./compilers/basic.js');
|
|
4
|
+
var getConfigPath = require('./utils/get-config-path.js');
|
|
5
|
+
|
|
6
|
+
const compile = async (srcDir, { configOptions = {} } = {})=>{
|
|
7
|
+
const configPath = getConfigPath.getConfigPath(srcDir);
|
|
8
|
+
basic.run(configPath, configOptions);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
exports.compile = compile;
|
|
12
|
+
//# sourceMappingURL=compile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.js","sources":["../src/compile.ts"],"sourcesContent":["import * as compilers from './compilers';\nimport { getConfigPath } from './utils/get-config-path';\nimport type { ConfigOptions } from './compilers/basic';\n\nexport const compile = async (\n srcDir: string,\n { configOptions = {} }: { configOptions?: ConfigOptions } = {}\n): Promise<void> => {\n const configPath = getConfigPath(srcDir);\n\n compilers.basic.run(configPath as string, configOptions);\n};\n"],"names":["compile","srcDir","configOptions","configPath","getConfigPath","compilers"],"mappings":";;;;;AAIO,MAAMA,OAAAA,GAAU,OACrBC,MAAAA,EACA,EAAEC,aAAAA,GAAgB,EAAE,EAAqC,GAAG,EAAE,GAAA;AAE9D,IAAA,MAAMC,aAAaC,2BAAAA,CAAcH,MAAAA,CAAAA;AAEjCI,IAAAA,SAAmB,CAACF,UAAAA,EAAsBD,aAAAA,CAAAA;AAC5C;;;;"}
|
package/dist/compile.mjs
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { run } from './compilers/basic.mjs';
|
|
2
|
+
import { getConfigPath } from './utils/get-config-path.mjs';
|
|
3
|
+
|
|
4
|
+
const compile = async (srcDir, { configOptions = {} } = {})=>{
|
|
5
|
+
const configPath = getConfigPath(srcDir);
|
|
6
|
+
run(configPath, configOptions);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { compile };
|
|
10
|
+
//# sourceMappingURL=compile.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.mjs","sources":["../src/compile.ts"],"sourcesContent":["import * as compilers from './compilers';\nimport { getConfigPath } from './utils/get-config-path';\nimport type { ConfigOptions } from './compilers/basic';\n\nexport const compile = async (\n srcDir: string,\n { configOptions = {} }: { configOptions?: ConfigOptions } = {}\n): Promise<void> => {\n const configPath = getConfigPath(srcDir);\n\n compilers.basic.run(configPath as string, configOptions);\n};\n"],"names":["compile","srcDir","configOptions","configPath","getConfigPath","compilers"],"mappings":";;;AAIO,MAAMA,OAAAA,GAAU,OACrBC,MAAAA,EACA,EAAEC,aAAAA,GAAgB,EAAE,EAAqC,GAAG,EAAE,GAAA;AAE9D,IAAA,MAAMC,aAAaC,aAAAA,CAAcH,MAAAA,CAAAA;AAEjCI,IAAAA,GAAmB,CAACF,UAAAA,EAAsBD,aAAAA,CAAAA;AAC5C;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as ts from 'typescript';
|
|
2
|
+
export interface ConfigOptions {
|
|
3
|
+
fileNames?: string[];
|
|
4
|
+
options?: ts.CompilerOptions;
|
|
5
|
+
ignoreDiagnostics?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Default TS -> JS Compilation for Strapi
|
|
9
|
+
*/
|
|
10
|
+
export declare function run(tsConfigPath: string, configOptions?: ConfigOptions): void;
|
|
11
|
+
//# sourceMappingURL=basic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basic.d.ts","sourceRoot":"","sources":["../../src/compilers/basic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAMjC,MAAM,WAAW,aAAa;IAC5B,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,EAAE,CAAC,eAAe,CAAC;IAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,wBAAgB,GAAG,CAAC,YAAY,EAAE,MAAM,EAAE,aAAa,GAAE,aAAkB,QA+B1E"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ts = require('typescript');
|
|
4
|
+
var _ = require('lodash');
|
|
5
|
+
var reportDiagnostics = require('../utils/report-diagnostics.js');
|
|
6
|
+
var resolveConfigOptions = require('../utils/resolve-config-options.js');
|
|
7
|
+
|
|
8
|
+
function _interopNamespace(e) {
|
|
9
|
+
if (e && e.__esModule) return e;
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var ts__namespace = /*#__PURE__*/_interopNamespace(ts);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Default TS -> JS Compilation for Strapi
|
|
30
|
+
*/ function run(tsConfigPath, configOptions = {}) {
|
|
31
|
+
const { ignoreDiagnostics = false } = configOptions;
|
|
32
|
+
// Parse the tsconfig.json file & resolve the configuration options
|
|
33
|
+
const { fileNames, options, projectReferences } = resolveConfigOptions.resolveConfigOptions(tsConfigPath);
|
|
34
|
+
const compilerOptions = _.merge(options, configOptions.options);
|
|
35
|
+
if (ignoreDiagnostics) {
|
|
36
|
+
Object.assign(compilerOptions, {
|
|
37
|
+
noEmit: false,
|
|
38
|
+
noEmitOnError: false
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
const program = ts__namespace.createProgram({
|
|
42
|
+
rootNames: configOptions.fileNames ? configOptions.fileNames : fileNames,
|
|
43
|
+
projectReferences,
|
|
44
|
+
options: compilerOptions
|
|
45
|
+
});
|
|
46
|
+
const emitResults = program.emit();
|
|
47
|
+
const diagnostics = ts__namespace.sortAndDeduplicateDiagnostics(ts__namespace.getPreEmitDiagnostics(program).concat(emitResults.diagnostics));
|
|
48
|
+
if (!ignoreDiagnostics && diagnostics.length > 0) {
|
|
49
|
+
reportDiagnostics.reportDiagnostics(diagnostics);
|
|
50
|
+
}
|
|
51
|
+
// If the compilation failed and diagnostics are not ignored, exit early
|
|
52
|
+
if (!ignoreDiagnostics && emitResults.emitSkipped) {
|
|
53
|
+
throw new Error('TypeScript compilation failed');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
exports.run = run;
|
|
58
|
+
//# sourceMappingURL=basic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basic.js","sources":["../../src/compilers/basic.ts"],"sourcesContent":["import * as ts from 'typescript';\nimport { merge } from 'lodash';\n\nimport { reportDiagnostics } from '../utils/report-diagnostics';\nimport { resolveConfigOptions } from '../utils/resolve-config-options';\n\nexport interface ConfigOptions {\n fileNames?: string[];\n options?: ts.CompilerOptions;\n ignoreDiagnostics?: boolean;\n}\n\n/**\n * Default TS -> JS Compilation for Strapi\n */\nexport function run(tsConfigPath: string, configOptions: ConfigOptions = {}) {\n const { ignoreDiagnostics = false } = configOptions;\n // Parse the tsconfig.json file & resolve the configuration options\n const { fileNames, options, projectReferences } = resolveConfigOptions(tsConfigPath);\n\n const compilerOptions = merge(options, configOptions.options);\n\n if (ignoreDiagnostics) {\n Object.assign(compilerOptions, { noEmit: false, noEmitOnError: false });\n }\n\n const program = ts.createProgram({\n rootNames: configOptions.fileNames ? configOptions.fileNames : fileNames,\n projectReferences,\n options: compilerOptions,\n });\n\n const emitResults = program.emit();\n\n const diagnostics = ts.sortAndDeduplicateDiagnostics(\n ts.getPreEmitDiagnostics(program).concat(emitResults.diagnostics)\n );\n\n if (!ignoreDiagnostics && diagnostics.length > 0) {\n reportDiagnostics(diagnostics);\n }\n\n // If the compilation failed and diagnostics are not ignored, exit early\n if (!ignoreDiagnostics && emitResults.emitSkipped) {\n throw new Error('TypeScript compilation failed');\n }\n}\n"],"names":["run","tsConfigPath","configOptions","ignoreDiagnostics","fileNames","options","projectReferences","resolveConfigOptions","compilerOptions","merge","Object","assign","noEmit","noEmitOnError","program","ts","createProgram","rootNames","emitResults","emit","diagnostics","sortAndDeduplicateDiagnostics","getPreEmitDiagnostics","concat","length","reportDiagnostics","emitSkipped","Error"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA;;AAEC,IACM,SAASA,GAAAA,CAAIC,YAAoB,EAAEC,aAAAA,GAA+B,EAAE,EAAA;AACzE,IAAA,MAAM,EAAEC,iBAAAA,GAAoB,KAAK,EAAE,GAAGD,aAAAA;;IAEtC,MAAM,EAAEE,SAAS,EAAEC,OAAO,EAAEC,iBAAiB,EAAE,GAAGC,yCAAAA,CAAqBN,YAAAA,CAAAA;AAEvE,IAAA,MAAMO,eAAAA,GAAkBC,OAAAA,CAAMJ,OAAAA,EAASH,aAAAA,CAAcG,OAAO,CAAA;AAE5D,IAAA,IAAIF,iBAAAA,EAAmB;QACrBO,MAAAA,CAAOC,MAAM,CAACH,eAAAA,EAAiB;YAAEI,MAAAA,EAAQ,KAAA;YAAOC,aAAAA,EAAe;AAAM,SAAA,CAAA;AACvE,IAAA;IAEA,MAAMC,OAAAA,GAAUC,aAAAA,CAAGC,aAAa,CAAC;AAC/BC,QAAAA,SAAAA,EAAWf,aAAAA,CAAcE,SAAS,GAAGF,aAAAA,CAAcE,SAAS,GAAGA,SAAAA;AAC/DE,QAAAA,iBAAAA;QACAD,OAAAA,EAASG;AACX,KAAA,CAAA;IAEA,MAAMU,WAAAA,GAAcJ,QAAQK,IAAI,EAAA;IAEhC,MAAMC,WAAAA,GAAcL,aAAAA,CAAGM,6BAA6B,CAClDN,aAAAA,CAAGO,qBAAqB,CAACR,OAAAA,CAAAA,CAASS,MAAM,CAACL,WAAAA,CAAYE,WAAW,CAAA,CAAA;AAGlE,IAAA,IAAI,CAACjB,iBAAAA,IAAqBiB,WAAAA,CAAYI,MAAM,GAAG,CAAA,EAAG;QAChDC,mCAAAA,CAAkBL,WAAAA,CAAAA;AACpB,IAAA;;AAGA,IAAA,IAAI,CAACjB,iBAAAA,IAAqBe,WAAAA,CAAYQ,WAAW,EAAE;AACjD,QAAA,MAAM,IAAIC,KAAAA,CAAM,+BAAA,CAAA;AAClB,IAAA;AACF;;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as ts from 'typescript';
|
|
2
|
+
import { merge } from 'lodash';
|
|
3
|
+
import { reportDiagnostics } from '../utils/report-diagnostics.mjs';
|
|
4
|
+
import { resolveConfigOptions } from '../utils/resolve-config-options.mjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Default TS -> JS Compilation for Strapi
|
|
8
|
+
*/ function run(tsConfigPath, configOptions = {}) {
|
|
9
|
+
const { ignoreDiagnostics = false } = configOptions;
|
|
10
|
+
// Parse the tsconfig.json file & resolve the configuration options
|
|
11
|
+
const { fileNames, options, projectReferences } = resolveConfigOptions(tsConfigPath);
|
|
12
|
+
const compilerOptions = merge(options, configOptions.options);
|
|
13
|
+
if (ignoreDiagnostics) {
|
|
14
|
+
Object.assign(compilerOptions, {
|
|
15
|
+
noEmit: false,
|
|
16
|
+
noEmitOnError: false
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const program = ts.createProgram({
|
|
20
|
+
rootNames: configOptions.fileNames ? configOptions.fileNames : fileNames,
|
|
21
|
+
projectReferences,
|
|
22
|
+
options: compilerOptions
|
|
23
|
+
});
|
|
24
|
+
const emitResults = program.emit();
|
|
25
|
+
const diagnostics = ts.sortAndDeduplicateDiagnostics(ts.getPreEmitDiagnostics(program).concat(emitResults.diagnostics));
|
|
26
|
+
if (!ignoreDiagnostics && diagnostics.length > 0) {
|
|
27
|
+
reportDiagnostics(diagnostics);
|
|
28
|
+
}
|
|
29
|
+
// If the compilation failed and diagnostics are not ignored, exit early
|
|
30
|
+
if (!ignoreDiagnostics && emitResults.emitSkipped) {
|
|
31
|
+
throw new Error('TypeScript compilation failed');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { run };
|
|
36
|
+
//# sourceMappingURL=basic.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basic.mjs","sources":["../../src/compilers/basic.ts"],"sourcesContent":["import * as ts from 'typescript';\nimport { merge } from 'lodash';\n\nimport { reportDiagnostics } from '../utils/report-diagnostics';\nimport { resolveConfigOptions } from '../utils/resolve-config-options';\n\nexport interface ConfigOptions {\n fileNames?: string[];\n options?: ts.CompilerOptions;\n ignoreDiagnostics?: boolean;\n}\n\n/**\n * Default TS -> JS Compilation for Strapi\n */\nexport function run(tsConfigPath: string, configOptions: ConfigOptions = {}) {\n const { ignoreDiagnostics = false } = configOptions;\n // Parse the tsconfig.json file & resolve the configuration options\n const { fileNames, options, projectReferences } = resolveConfigOptions(tsConfigPath);\n\n const compilerOptions = merge(options, configOptions.options);\n\n if (ignoreDiagnostics) {\n Object.assign(compilerOptions, { noEmit: false, noEmitOnError: false });\n }\n\n const program = ts.createProgram({\n rootNames: configOptions.fileNames ? configOptions.fileNames : fileNames,\n projectReferences,\n options: compilerOptions,\n });\n\n const emitResults = program.emit();\n\n const diagnostics = ts.sortAndDeduplicateDiagnostics(\n ts.getPreEmitDiagnostics(program).concat(emitResults.diagnostics)\n );\n\n if (!ignoreDiagnostics && diagnostics.length > 0) {\n reportDiagnostics(diagnostics);\n }\n\n // If the compilation failed and diagnostics are not ignored, exit early\n if (!ignoreDiagnostics && emitResults.emitSkipped) {\n throw new Error('TypeScript compilation failed');\n }\n}\n"],"names":["run","tsConfigPath","configOptions","ignoreDiagnostics","fileNames","options","projectReferences","resolveConfigOptions","compilerOptions","merge","Object","assign","noEmit","noEmitOnError","program","ts","createProgram","rootNames","emitResults","emit","diagnostics","sortAndDeduplicateDiagnostics","getPreEmitDiagnostics","concat","length","reportDiagnostics","emitSkipped","Error"],"mappings":";;;;;AAYA;;AAEC,IACM,SAASA,GAAAA,CAAIC,YAAoB,EAAEC,aAAAA,GAA+B,EAAE,EAAA;AACzE,IAAA,MAAM,EAAEC,iBAAAA,GAAoB,KAAK,EAAE,GAAGD,aAAAA;;IAEtC,MAAM,EAAEE,SAAS,EAAEC,OAAO,EAAEC,iBAAiB,EAAE,GAAGC,oBAAAA,CAAqBN,YAAAA,CAAAA;AAEvE,IAAA,MAAMO,eAAAA,GAAkBC,KAAAA,CAAMJ,OAAAA,EAASH,aAAAA,CAAcG,OAAO,CAAA;AAE5D,IAAA,IAAIF,iBAAAA,EAAmB;QACrBO,MAAAA,CAAOC,MAAM,CAACH,eAAAA,EAAiB;YAAEI,MAAAA,EAAQ,KAAA;YAAOC,aAAAA,EAAe;AAAM,SAAA,CAAA;AACvE,IAAA;IAEA,MAAMC,OAAAA,GAAUC,EAAAA,CAAGC,aAAa,CAAC;AAC/BC,QAAAA,SAAAA,EAAWf,aAAAA,CAAcE,SAAS,GAAGF,aAAAA,CAAcE,SAAS,GAAGA,SAAAA;AAC/DE,QAAAA,iBAAAA;QACAD,OAAAA,EAASG;AACX,KAAA,CAAA;IAEA,MAAMU,WAAAA,GAAcJ,QAAQK,IAAI,EAAA;IAEhC,MAAMC,WAAAA,GAAcL,EAAAA,CAAGM,6BAA6B,CAClDN,EAAAA,CAAGO,qBAAqB,CAACR,OAAAA,CAAAA,CAASS,MAAM,CAACL,WAAAA,CAAYE,WAAW,CAAA,CAAA;AAGlE,IAAA,IAAI,CAACjB,iBAAAA,IAAqBiB,WAAAA,CAAYI,MAAM,GAAG,CAAA,EAAG;QAChDC,iBAAAA,CAAkBL,WAAAA,CAAAA;AACpB,IAAA;;AAGA,IAAA,IAAI,CAACjB,iBAAAA,IAAqBe,WAAAA,CAAYQ,WAAW,EAAE;AACjD,QAAA,MAAM,IAAIC,KAAAA,CAAM,+BAAA,CAAA;AAClB,IAAA;AACF;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/compilers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orders strings by UTF-16 code units, like the default `Array.prototype.sort`. Unlike
|
|
3
|
+
* `localeCompare`, the order does not depend on the locale of the machine, so the generated files
|
|
4
|
+
* are the same everywhere.
|
|
5
|
+
*/
|
|
6
|
+
export declare const compareCodeUnits: (a: string, b: string) => 0 | 1 | -1;
|
|
7
|
+
/**
|
|
8
|
+
* Orders strings like `localeCompare` on an English or `C` locale machine, whatever the locale of
|
|
9
|
+
* the machine. The schema generators come from develop and use `localeCompare`: an explicit
|
|
10
|
+
* locale keeps their output where it was already stable, instead of reordering mixed-case or
|
|
11
|
+
* punctuated keys like `compareCodeUnits` would.
|
|
12
|
+
*/
|
|
13
|
+
export declare const compareEnglish: (a: string, b: string) => number;
|
|
14
|
+
//# sourceMappingURL=compare.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compare.d.ts","sourceRoot":"","sources":["../../../src/generators/common/compare.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,eAUpD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,GAAG,MAAM,EAAE,GAAG,MAAM,WAA6B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Orders strings by UTF-16 code units, like the default `Array.prototype.sort`. Unlike
|
|
5
|
+
* `localeCompare`, the order does not depend on the locale of the machine, so the generated files
|
|
6
|
+
* are the same everywhere.
|
|
7
|
+
*/ const compareCodeUnits = (a, b)=>{
|
|
8
|
+
if (a < b) {
|
|
9
|
+
return -1;
|
|
10
|
+
}
|
|
11
|
+
if (a > b) {
|
|
12
|
+
return 1;
|
|
13
|
+
}
|
|
14
|
+
return 0;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Orders strings like `localeCompare` on an English or `C` locale machine, whatever the locale of
|
|
18
|
+
* the machine. The schema generators come from develop and use `localeCompare`: an explicit
|
|
19
|
+
* locale keeps their output where it was already stable, instead of reordering mixed-case or
|
|
20
|
+
* punctuated keys like `compareCodeUnits` would.
|
|
21
|
+
*/ const compareEnglish = (a, b)=>a.localeCompare(b, 'en');
|
|
22
|
+
|
|
23
|
+
exports.compareCodeUnits = compareCodeUnits;
|
|
24
|
+
exports.compareEnglish = compareEnglish;
|
|
25
|
+
//# sourceMappingURL=compare.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compare.js","sources":["../../../src/generators/common/compare.ts"],"sourcesContent":["/**\n * Orders strings by UTF-16 code units, like the default `Array.prototype.sort`. Unlike\n * `localeCompare`, the order does not depend on the locale of the machine, so the generated files\n * are the same everywhere.\n */\nexport const compareCodeUnits = (a: string, b: string) => {\n if (a < b) {\n return -1;\n }\n\n if (a > b) {\n return 1;\n }\n\n return 0;\n};\n\n/**\n * Orders strings like `localeCompare` on an English or `C` locale machine, whatever the locale of\n * the machine. The schema generators come from develop and use `localeCompare`: an explicit\n * locale keeps their output where it was already stable, instead of reordering mixed-case or\n * punctuated keys like `compareCodeUnits` would.\n */\nexport const compareEnglish = (a: string, b: string) => a.localeCompare(b, 'en');\n"],"names":["compareCodeUnits","a","b","compareEnglish","localeCompare"],"mappings":";;AAAA;;;;AAIC,IACM,MAAMA,gBAAAA,GAAmB,CAACC,CAAAA,EAAWC,CAAAA,GAAAA;AAC1C,IAAA,IAAID,IAAIC,CAAAA,EAAG;AACT,QAAA,OAAO,EAAC;AACV,IAAA;AAEA,IAAA,IAAID,IAAIC,CAAAA,EAAG;QACT,OAAO,CAAA;AACT,IAAA;IAEA,OAAO,CAAA;AACT;AAEA;;;;;IAMO,MAAMC,cAAAA,GAAiB,CAACF,CAAAA,EAAWC,IAAcD,CAAAA,CAAEG,aAAa,CAACF,CAAAA,EAAG,IAAA;;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orders strings by UTF-16 code units, like the default `Array.prototype.sort`. Unlike
|
|
3
|
+
* `localeCompare`, the order does not depend on the locale of the machine, so the generated files
|
|
4
|
+
* are the same everywhere.
|
|
5
|
+
*/ const compareCodeUnits = (a, b)=>{
|
|
6
|
+
if (a < b) {
|
|
7
|
+
return -1;
|
|
8
|
+
}
|
|
9
|
+
if (a > b) {
|
|
10
|
+
return 1;
|
|
11
|
+
}
|
|
12
|
+
return 0;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Orders strings like `localeCompare` on an English or `C` locale machine, whatever the locale of
|
|
16
|
+
* the machine. The schema generators come from develop and use `localeCompare`: an explicit
|
|
17
|
+
* locale keeps their output where it was already stable, instead of reordering mixed-case or
|
|
18
|
+
* punctuated keys like `compareCodeUnits` would.
|
|
19
|
+
*/ const compareEnglish = (a, b)=>a.localeCompare(b, 'en');
|
|
20
|
+
|
|
21
|
+
export { compareCodeUnits, compareEnglish };
|
|
22
|
+
//# sourceMappingURL=compare.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compare.mjs","sources":["../../../src/generators/common/compare.ts"],"sourcesContent":["/**\n * Orders strings by UTF-16 code units, like the default `Array.prototype.sort`. Unlike\n * `localeCompare`, the order does not depend on the locale of the machine, so the generated files\n * are the same everywhere.\n */\nexport const compareCodeUnits = (a: string, b: string) => {\n if (a < b) {\n return -1;\n }\n\n if (a > b) {\n return 1;\n }\n\n return 0;\n};\n\n/**\n * Orders strings like `localeCompare` on an English or `C` locale machine, whatever the locale of\n * the machine. The schema generators come from develop and use `localeCompare`: an explicit\n * locale keeps their output where it was already stable, instead of reordering mixed-case or\n * punctuated keys like `compareCodeUnits` would.\n */\nexport const compareEnglish = (a: string, b: string) => a.localeCompare(b, 'en');\n"],"names":["compareCodeUnits","a","b","compareEnglish","localeCompare"],"mappings":"AAAA;;;;AAIC,IACM,MAAMA,gBAAAA,GAAmB,CAACC,CAAAA,EAAWC,CAAAA,GAAAA;AAC1C,IAAA,IAAID,IAAIC,CAAAA,EAAG;AACT,QAAA,OAAO,EAAC;AACV,IAAA;AAEA,IAAA,IAAID,IAAIC,CAAAA,EAAG;QACT,OAAO,CAAA;AACT,IAAA;IAEA,OAAO,CAAA;AACT;AAEA;;;;;IAMO,MAAMC,cAAAA,GAAiB,CAACF,CAAAA,EAAWC,IAAcD,CAAAA,CAAEG,aAAa,CAACF,CAAAA,EAAG,IAAA;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../../../src/generators/common/imports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAMjC,wBAAgB,UAAU,IAAI,MAAM,EAAE,CAErC;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAM5C;AAED,wBAAgB,wBAAwB,IAAI,EAAE,CAAC,iBAAiB,EAAE,CAajE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ts = require('typescript');
|
|
4
|
+
|
|
5
|
+
function _interopNamespace(e) {
|
|
6
|
+
if (e && e.__esModule) return e;
|
|
7
|
+
var n = Object.create(null);
|
|
8
|
+
if (e) {
|
|
9
|
+
Object.keys(e).forEach(function (k) {
|
|
10
|
+
if (k !== 'default') {
|
|
11
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return e[k]; }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
n.default = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var ts__namespace = /*#__PURE__*/_interopNamespace(ts);
|
|
24
|
+
|
|
25
|
+
const { factory } = ts__namespace;
|
|
26
|
+
const imports = [];
|
|
27
|
+
function addImport(type) {
|
|
28
|
+
const hasType = imports.includes(type);
|
|
29
|
+
if (!hasType) {
|
|
30
|
+
imports.push(type);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function generateImportDefinition() {
|
|
34
|
+
const formattedImports = imports.sort().map((key)=>factory.createImportSpecifier(false, undefined, factory.createIdentifier(key)));
|
|
35
|
+
return [
|
|
36
|
+
factory.createImportDeclaration(undefined, factory.createImportClause(true, undefined, factory.createNamedImports(formattedImports)), factory.createStringLiteral('@strapi/strapi'), undefined)
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
exports.addImport = addImport;
|
|
41
|
+
exports.generateImportDefinition = generateImportDefinition;
|
|
42
|
+
//# sourceMappingURL=imports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imports.js","sources":["../../../src/generators/common/imports.ts"],"sourcesContent":["import * as ts from 'typescript';\n\nconst { factory } = ts;\n\nconst imports: string[] = [];\n\nexport function getImports(): string[] {\n return imports;\n}\n\nexport function addImport(type: string): void {\n const hasType = imports.includes(type);\n\n if (!hasType) {\n imports.push(type);\n }\n}\n\nexport function generateImportDefinition(): ts.ImportDeclaration[] {\n const formattedImports = imports\n .sort()\n .map((key) => factory.createImportSpecifier(false, undefined, factory.createIdentifier(key)));\n\n return [\n factory.createImportDeclaration(\n undefined,\n factory.createImportClause(true, undefined, factory.createNamedImports(formattedImports)),\n factory.createStringLiteral('@strapi/strapi'),\n undefined\n ),\n ];\n}\n"],"names":["factory","ts","imports","addImport","type","hasType","includes","push","generateImportDefinition","formattedImports","sort","map","key","createImportSpecifier","undefined","createIdentifier","createImportDeclaration","createImportClause","createNamedImports","createStringLiteral"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,EAAEA,OAAO,EAAE,GAAGC,aAAAA;AAEpB,MAAMC,UAAoB,EAAE;AAMrB,SAASC,UAAUC,IAAY,EAAA;IACpC,MAAMC,OAAAA,GAAUH,OAAAA,CAAQI,QAAQ,CAACF,IAAAA,CAAAA;AAEjC,IAAA,IAAI,CAACC,OAAAA,EAAS;AACZH,QAAAA,OAAAA,CAAQK,IAAI,CAACH,IAAAA,CAAAA;AACf,IAAA;AACF;AAEO,SAASI,wBAAAA,GAAAA;AACd,IAAA,MAAMC,gBAAAA,GAAmBP,OAAAA,CACtBQ,IAAI,EAAA,CACJC,GAAG,CAAC,CAACC,GAAAA,GAAQZ,OAAAA,CAAQa,qBAAqB,CAAC,KAAA,EAAOC,SAAAA,EAAWd,OAAAA,CAAQe,gBAAgB,CAACH,GAAAA,CAAAA,CAAAA,CAAAA;IAEzF,OAAO;AACLZ,QAAAA,OAAAA,CAAQgB,uBAAuB,CAC7BF,SAAAA,EACAd,OAAAA,CAAQiB,kBAAkB,CAAC,IAAA,EAAMH,SAAAA,EAAWd,OAAAA,CAAQkB,kBAAkB,CAACT,gBAAAA,CAAAA,CAAAA,EACvET,OAAAA,CAAQmB,mBAAmB,CAAC,gBAAA,CAAA,EAC5BL,SAAAA;AAEH,KAAA;AACH;;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as ts from 'typescript';
|
|
2
|
+
|
|
3
|
+
const { factory } = ts;
|
|
4
|
+
const imports = [];
|
|
5
|
+
function addImport(type) {
|
|
6
|
+
const hasType = imports.includes(type);
|
|
7
|
+
if (!hasType) {
|
|
8
|
+
imports.push(type);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function generateImportDefinition() {
|
|
12
|
+
const formattedImports = imports.sort().map((key)=>factory.createImportSpecifier(false, undefined, factory.createIdentifier(key)));
|
|
13
|
+
return [
|
|
14
|
+
factory.createImportDeclaration(undefined, factory.createImportClause(true, undefined, factory.createNamedImports(formattedImports)), factory.createStringLiteral('@strapi/strapi'), undefined)
|
|
15
|
+
];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { addImport, generateImportDefinition };
|
|
19
|
+
//# sourceMappingURL=imports.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imports.mjs","sources":["../../../src/generators/common/imports.ts"],"sourcesContent":["import * as ts from 'typescript';\n\nconst { factory } = ts;\n\nconst imports: string[] = [];\n\nexport function getImports(): string[] {\n return imports;\n}\n\nexport function addImport(type: string): void {\n const hasType = imports.includes(type);\n\n if (!hasType) {\n imports.push(type);\n }\n}\n\nexport function generateImportDefinition(): ts.ImportDeclaration[] {\n const formattedImports = imports\n .sort()\n .map((key) => factory.createImportSpecifier(false, undefined, factory.createIdentifier(key)));\n\n return [\n factory.createImportDeclaration(\n undefined,\n factory.createImportClause(true, undefined, factory.createNamedImports(formattedImports)),\n factory.createStringLiteral('@strapi/strapi'),\n undefined\n ),\n ];\n}\n"],"names":["factory","ts","imports","addImport","type","hasType","includes","push","generateImportDefinition","formattedImports","sort","map","key","createImportSpecifier","undefined","createIdentifier","createImportDeclaration","createImportClause","createNamedImports","createStringLiteral"],"mappings":";;AAEA,MAAM,EAAEA,OAAO,EAAE,GAAGC,EAAAA;AAEpB,MAAMC,UAAoB,EAAE;AAMrB,SAASC,UAAUC,IAAY,EAAA;IACpC,MAAMC,OAAAA,GAAUH,OAAAA,CAAQI,QAAQ,CAACF,IAAAA,CAAAA;AAEjC,IAAA,IAAI,CAACC,OAAAA,EAAS;AACZH,QAAAA,OAAAA,CAAQK,IAAI,CAACH,IAAAA,CAAAA;AACf,IAAA;AACF;AAEO,SAASI,wBAAAA,GAAAA;AACd,IAAA,MAAMC,gBAAAA,GAAmBP,OAAAA,CACtBQ,IAAI,EAAA,CACJC,GAAG,CAAC,CAACC,GAAAA,GAAQZ,OAAAA,CAAQa,qBAAqB,CAAC,KAAA,EAAOC,SAAAA,EAAWd,OAAAA,CAAQe,gBAAgB,CAACH,GAAAA,CAAAA,CAAAA,CAAAA;IAEzF,OAAO;AACLZ,QAAAA,OAAAA,CAAQgB,uBAAuB,CAC7BF,SAAAA,EACAd,OAAAA,CAAQiB,kBAAkB,CAAC,IAAA,EAAMH,SAAAA,EAAWd,OAAAA,CAAQkB,kBAAkB,CAACT,gBAAAA,CAAAA,CAAAA,EACvET,OAAAA,CAAQmB,mBAAmB,CAAC,gBAAA,CAAA,EAC5BL,SAAAA;AAEH,KAAA;AACH;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generators/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Logger } from '../utils';
|
|
2
|
+
/**
|
|
3
|
+
* The interface name of each schema UID, e.g. `ApiFooBarBaz` for `api::foo-bar.baz`.
|
|
4
|
+
*
|
|
5
|
+
* Several UIDs can get the same name, e.g. `api::foo-bar.baz` and `api::foo.bar-baz`, and their
|
|
6
|
+
* declarations would then merge into one interface. Without strict types, the names stay as they
|
|
7
|
+
* are, with a warning: making them unique renames generated interfaces that application code
|
|
8
|
+
* imports. With strict types, which already change the generated output, every UID after the first
|
|
9
|
+
* one (in code unit order) gets the first free numeric suffix, e.g. `ApiFooBarBaz2`.
|
|
10
|
+
*
|
|
11
|
+
* `uids` must be sorted, so the names do not depend on the order schemas were loaded in.
|
|
12
|
+
*/
|
|
13
|
+
export declare const resolveInterfaceNames: (uids: string[], logger: Logger, { strict }: {
|
|
14
|
+
strict: boolean;
|
|
15
|
+
}) => Map<string, string>;
|
|
16
|
+
//# sourceMappingURL=interface-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface-names.d.ts","sourceRoot":"","sources":["../../../src/generators/common/interface-names.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,GAChC,MAAM,MAAM,EAAE,EACd,QAAQ,MAAM,EACd,YAAY;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,KAC9B,GAAG,CAAC,MAAM,EAAE,MAAM,CAuCpB,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('typescript');
|
|
4
|
+
require('lodash');
|
|
5
|
+
var utils = require('./models/utils.js');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The interface name of each schema UID, e.g. `ApiFooBarBaz` for `api::foo-bar.baz`.
|
|
9
|
+
*
|
|
10
|
+
* Several UIDs can get the same name, e.g. `api::foo-bar.baz` and `api::foo.bar-baz`, and their
|
|
11
|
+
* declarations would then merge into one interface. Without strict types, the names stay as they
|
|
12
|
+
* are, with a warning: making them unique renames generated interfaces that application code
|
|
13
|
+
* imports. With strict types, which already change the generated output, every UID after the first
|
|
14
|
+
* one (in code unit order) gets the first free numeric suffix, e.g. `ApiFooBarBaz2`.
|
|
15
|
+
*
|
|
16
|
+
* `uids` must be sorted, so the names do not depend on the order schemas were loaded in.
|
|
17
|
+
*/ const resolveInterfaceNames = (uids, logger, { strict })=>{
|
|
18
|
+
const uidsByName = new Map();
|
|
19
|
+
for (const uid of uids){
|
|
20
|
+
const name = utils.getSchemaInterfaceName(uid);
|
|
21
|
+
uidsByName.set(name, [
|
|
22
|
+
...uidsByName.get(name) ?? [],
|
|
23
|
+
uid
|
|
24
|
+
]);
|
|
25
|
+
}
|
|
26
|
+
const names = new Map(uids.map((uid)=>[
|
|
27
|
+
uid,
|
|
28
|
+
utils.getSchemaInterfaceName(uid)
|
|
29
|
+
]));
|
|
30
|
+
const taken = new Set(names.values());
|
|
31
|
+
for (const [name, sharing] of uidsByName){
|
|
32
|
+
if (sharing.length === 1) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (strict === false) {
|
|
36
|
+
logger.warn(`${sharing.join(', ')} share the generated interface name ${name}, so their types merge. Rename one of them.`);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
for (const uid of sharing.slice(1)){
|
|
40
|
+
let suffix = 2;
|
|
41
|
+
while(taken.has(`${name}${suffix}`) === true){
|
|
42
|
+
suffix += 1;
|
|
43
|
+
}
|
|
44
|
+
const unique = `${name}${suffix}`;
|
|
45
|
+
taken.add(unique);
|
|
46
|
+
names.set(uid, unique);
|
|
47
|
+
logger.warn(`${uid} shares the generated interface name ${name} with ${sharing[0]}, so its interface is named ${unique}.`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return names;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
exports.resolveInterfaceNames = resolveInterfaceNames;
|
|
54
|
+
//# sourceMappingURL=interface-names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface-names.js","sources":["../../../src/generators/common/interface-names.ts"],"sourcesContent":["import { models } from '.';\nimport type { Logger } from '../utils';\n\n/**\n * The interface name of each schema UID, e.g. `ApiFooBarBaz` for `api::foo-bar.baz`.\n *\n * Several UIDs can get the same name, e.g. `api::foo-bar.baz` and `api::foo.bar-baz`, and their\n * declarations would then merge into one interface. Without strict types, the names stay as they\n * are, with a warning: making them unique renames generated interfaces that application code\n * imports. With strict types, which already change the generated output, every UID after the first\n * one (in code unit order) gets the first free numeric suffix, e.g. `ApiFooBarBaz2`.\n *\n * `uids` must be sorted, so the names do not depend on the order schemas were loaded in.\n */\nexport const resolveInterfaceNames = (\n uids: string[],\n logger: Logger,\n { strict }: { strict: boolean }\n): Map<string, string> => {\n const uidsByName = new Map<string, string[]>();\n\n for (const uid of uids) {\n const name = models.utils.getSchemaInterfaceName(uid);\n uidsByName.set(name, [...(uidsByName.get(name) ?? []), uid]);\n }\n\n const names = new Map(uids.map((uid) => [uid, models.utils.getSchemaInterfaceName(uid)]));\n const taken = new Set(names.values());\n\n for (const [name, sharing] of uidsByName) {\n if (sharing.length === 1) {\n continue;\n }\n\n if (strict === false) {\n logger.warn(\n `${sharing.join(', ')} share the generated interface name ${name}, so their types merge. Rename one of them.`\n );\n continue;\n }\n\n for (const uid of sharing.slice(1)) {\n let suffix = 2;\n while (taken.has(`${name}${suffix}`) === true) {\n suffix += 1;\n }\n\n const unique = `${name}${suffix}`;\n taken.add(unique);\n names.set(uid, unique);\n logger.warn(\n `${uid} shares the generated interface name ${name} with ${sharing[0]}, so its interface is named ${unique}.`\n );\n }\n }\n\n return names;\n};\n"],"names":["resolveInterfaceNames","uids","logger","strict","uidsByName","Map","uid","name","models","set","get","names","map","taken","Set","values","sharing","length","warn","join","slice","suffix","has","unique","add"],"mappings":";;;;;;AAGA;;;;;;;;;;UAWaA,qBAAAA,GAAwB,CACnCC,MACAC,MAAAA,EACA,EAAEC,MAAM,EAAuB,GAAA;AAE/B,IAAA,MAAMC,aAAa,IAAIC,GAAAA,EAAAA;IAEvB,KAAK,MAAMC,OAAOL,IAAAA,CAAM;AACtB,QAAA,MAAMM,IAAAA,GAAOC,4BAAmC,CAACF,GAAAA,CAAAA;QACjDF,UAAAA,CAAWK,GAAG,CAACF,IAAAA,EAAM;eAAKH,UAAAA,CAAWM,GAAG,CAACH,IAAAA,CAAAA,IAAS,EAAE;AAAGD,YAAAA;AAAI,SAAA,CAAA;AAC7D,IAAA;AAEA,IAAA,MAAMK,QAAQ,IAAIN,GAAAA,CAAIJ,KAAKW,GAAG,CAAC,CAACN,GAAAA,GAAQ;AAACA,YAAAA,GAAAA;YAAKE,4BAAmC,CAACF,GAAAA;AAAK,SAAA,CAAA,CAAA;AACvF,IAAA,MAAMO,KAAAA,GAAQ,IAAIC,GAAAA,CAAIH,KAAAA,CAAMI,MAAM,EAAA,CAAA;AAElC,IAAA,KAAK,MAAM,CAACR,IAAAA,EAAMS,OAAAA,CAAQ,IAAIZ,UAAAA,CAAY;QACxC,IAAIY,OAAAA,CAAQC,MAAM,KAAK,CAAA,EAAG;AACxB,YAAA;AACF,QAAA;AAEA,QAAA,IAAId,WAAW,KAAA,EAAO;YACpBD,MAAAA,CAAOgB,IAAI,CACT,CAAA,EAAGF,OAAAA,CAAQG,IAAI,CAAC,IAAA,CAAA,CAAM,oCAAoC,EAAEZ,IAAAA,CAAK,2CAA2C,CAAC,CAAA;AAE/G,YAAA;AACF,QAAA;AAEA,QAAA,KAAK,MAAMD,GAAAA,IAAOU,OAAAA,CAAQI,KAAK,CAAC,CAAA,CAAA,CAAI;AAClC,YAAA,IAAIC,MAAAA,GAAS,CAAA;AACb,YAAA,MAAOR,MAAMS,GAAG,CAAC,GAAGf,IAAAA,CAAAA,EAAOc,MAAAA,CAAAA,CAAQ,MAAM,IAAA,CAAM;gBAC7CA,MAAAA,IAAU,CAAA;AACZ,YAAA;YAEA,MAAME,MAAAA,GAAS,CAAA,EAAGhB,IAAAA,CAAAA,EAAOc,MAAAA,CAAAA,CAAQ;AACjCR,YAAAA,KAAAA,CAAMW,GAAG,CAACD,MAAAA,CAAAA;YACVZ,KAAAA,CAAMF,GAAG,CAACH,GAAAA,EAAKiB,MAAAA,CAAAA;AACfrB,YAAAA,MAAAA,CAAOgB,IAAI,CACT,CAAA,EAAGZ,GAAAA,CAAI,qCAAqC,EAAEC,IAAAA,CAAK,MAAM,EAAES,OAAO,CAAC,CAAA,CAAE,CAAC,4BAA4B,EAAEO,MAAAA,CAAO,CAAC,CAAC,CAAA;AAEjH,QAAA;AACF,IAAA;IAEA,OAAOZ,KAAAA;AACT;;;;"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import 'typescript';
|
|
2
|
+
import 'lodash';
|
|
3
|
+
import { getSchemaInterfaceName } from './models/utils.mjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The interface name of each schema UID, e.g. `ApiFooBarBaz` for `api::foo-bar.baz`.
|
|
7
|
+
*
|
|
8
|
+
* Several UIDs can get the same name, e.g. `api::foo-bar.baz` and `api::foo.bar-baz`, and their
|
|
9
|
+
* declarations would then merge into one interface. Without strict types, the names stay as they
|
|
10
|
+
* are, with a warning: making them unique renames generated interfaces that application code
|
|
11
|
+
* imports. With strict types, which already change the generated output, every UID after the first
|
|
12
|
+
* one (in code unit order) gets the first free numeric suffix, e.g. `ApiFooBarBaz2`.
|
|
13
|
+
*
|
|
14
|
+
* `uids` must be sorted, so the names do not depend on the order schemas were loaded in.
|
|
15
|
+
*/ const resolveInterfaceNames = (uids, logger, { strict })=>{
|
|
16
|
+
const uidsByName = new Map();
|
|
17
|
+
for (const uid of uids){
|
|
18
|
+
const name = getSchemaInterfaceName(uid);
|
|
19
|
+
uidsByName.set(name, [
|
|
20
|
+
...uidsByName.get(name) ?? [],
|
|
21
|
+
uid
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
const names = new Map(uids.map((uid)=>[
|
|
25
|
+
uid,
|
|
26
|
+
getSchemaInterfaceName(uid)
|
|
27
|
+
]));
|
|
28
|
+
const taken = new Set(names.values());
|
|
29
|
+
for (const [name, sharing] of uidsByName){
|
|
30
|
+
if (sharing.length === 1) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (strict === false) {
|
|
34
|
+
logger.warn(`${sharing.join(', ')} share the generated interface name ${name}, so their types merge. Rename one of them.`);
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
for (const uid of sharing.slice(1)){
|
|
38
|
+
let suffix = 2;
|
|
39
|
+
while(taken.has(`${name}${suffix}`) === true){
|
|
40
|
+
suffix += 1;
|
|
41
|
+
}
|
|
42
|
+
const unique = `${name}${suffix}`;
|
|
43
|
+
taken.add(unique);
|
|
44
|
+
names.set(uid, unique);
|
|
45
|
+
logger.warn(`${uid} shares the generated interface name ${name} with ${sharing[0]}, so its interface is named ${unique}.`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return names;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { resolveInterfaceNames };
|
|
52
|
+
//# sourceMappingURL=interface-names.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface-names.mjs","sources":["../../../src/generators/common/interface-names.ts"],"sourcesContent":["import { models } from '.';\nimport type { Logger } from '../utils';\n\n/**\n * The interface name of each schema UID, e.g. `ApiFooBarBaz` for `api::foo-bar.baz`.\n *\n * Several UIDs can get the same name, e.g. `api::foo-bar.baz` and `api::foo.bar-baz`, and their\n * declarations would then merge into one interface. Without strict types, the names stay as they\n * are, with a warning: making them unique renames generated interfaces that application code\n * imports. With strict types, which already change the generated output, every UID after the first\n * one (in code unit order) gets the first free numeric suffix, e.g. `ApiFooBarBaz2`.\n *\n * `uids` must be sorted, so the names do not depend on the order schemas were loaded in.\n */\nexport const resolveInterfaceNames = (\n uids: string[],\n logger: Logger,\n { strict }: { strict: boolean }\n): Map<string, string> => {\n const uidsByName = new Map<string, string[]>();\n\n for (const uid of uids) {\n const name = models.utils.getSchemaInterfaceName(uid);\n uidsByName.set(name, [...(uidsByName.get(name) ?? []), uid]);\n }\n\n const names = new Map(uids.map((uid) => [uid, models.utils.getSchemaInterfaceName(uid)]));\n const taken = new Set(names.values());\n\n for (const [name, sharing] of uidsByName) {\n if (sharing.length === 1) {\n continue;\n }\n\n if (strict === false) {\n logger.warn(\n `${sharing.join(', ')} share the generated interface name ${name}, so their types merge. Rename one of them.`\n );\n continue;\n }\n\n for (const uid of sharing.slice(1)) {\n let suffix = 2;\n while (taken.has(`${name}${suffix}`) === true) {\n suffix += 1;\n }\n\n const unique = `${name}${suffix}`;\n taken.add(unique);\n names.set(uid, unique);\n logger.warn(\n `${uid} shares the generated interface name ${name} with ${sharing[0]}, so its interface is named ${unique}.`\n );\n }\n }\n\n return names;\n};\n"],"names":["resolveInterfaceNames","uids","logger","strict","uidsByName","Map","uid","name","models","set","get","names","map","taken","Set","values","sharing","length","warn","join","slice","suffix","has","unique","add"],"mappings":";;;;AAGA;;;;;;;;;;UAWaA,qBAAAA,GAAwB,CACnCC,MACAC,MAAAA,EACA,EAAEC,MAAM,EAAuB,GAAA;AAE/B,IAAA,MAAMC,aAAa,IAAIC,GAAAA,EAAAA;IAEvB,KAAK,MAAMC,OAAOL,IAAAA,CAAM;AACtB,QAAA,MAAMM,IAAAA,GAAOC,sBAAmC,CAACF,GAAAA,CAAAA;QACjDF,UAAAA,CAAWK,GAAG,CAACF,IAAAA,EAAM;eAAKH,UAAAA,CAAWM,GAAG,CAACH,IAAAA,CAAAA,IAAS,EAAE;AAAGD,YAAAA;AAAI,SAAA,CAAA;AAC7D,IAAA;AAEA,IAAA,MAAMK,QAAQ,IAAIN,GAAAA,CAAIJ,KAAKW,GAAG,CAAC,CAACN,GAAAA,GAAQ;AAACA,YAAAA,GAAAA;YAAKE,sBAAmC,CAACF,GAAAA;AAAK,SAAA,CAAA,CAAA;AACvF,IAAA,MAAMO,KAAAA,GAAQ,IAAIC,GAAAA,CAAIH,KAAAA,CAAMI,MAAM,EAAA,CAAA;AAElC,IAAA,KAAK,MAAM,CAACR,IAAAA,EAAMS,OAAAA,CAAQ,IAAIZ,UAAAA,CAAY;QACxC,IAAIY,OAAAA,CAAQC,MAAM,KAAK,CAAA,EAAG;AACxB,YAAA;AACF,QAAA;AAEA,QAAA,IAAId,WAAW,KAAA,EAAO;YACpBD,MAAAA,CAAOgB,IAAI,CACT,CAAA,EAAGF,OAAAA,CAAQG,IAAI,CAAC,IAAA,CAAA,CAAM,oCAAoC,EAAEZ,IAAAA,CAAK,2CAA2C,CAAC,CAAA;AAE/G,YAAA;AACF,QAAA;AAEA,QAAA,KAAK,MAAMD,GAAAA,IAAOU,OAAAA,CAAQI,KAAK,CAAC,CAAA,CAAA,CAAI;AAClC,YAAA,IAAIC,MAAAA,GAAS,CAAA;AACb,YAAA,MAAOR,MAAMS,GAAG,CAAC,GAAGf,IAAAA,CAAAA,EAAOc,MAAAA,CAAAA,CAAQ,MAAM,IAAA,CAAM;gBAC7CA,MAAAA,IAAU,CAAA;AACZ,YAAA;YAEA,MAAME,MAAAA,GAAS,CAAA,EAAGhB,IAAAA,CAAAA,EAAOc,MAAAA,CAAAA,CAAQ;AACjCR,YAAAA,KAAAA,CAAMW,GAAG,CAACD,MAAAA,CAAAA;YACVZ,KAAAA,CAAMF,GAAG,CAACH,GAAAA,EAAKiB,MAAAA,CAAAA;AACfrB,YAAAA,MAAAA,CAAOgB,IAAI,CACT,CAAA,EAAGZ,GAAAA,CAAI,qCAAqC,EAAEC,IAAAA,CAAK,MAAM,EAAES,OAAO,CAAC,CAAA,CAAE,CAAC,4BAA4B,EAAEO,MAAAA,CAAO,CAAC,CAAC,CAAA;AAEjH,QAAA;AACF,IAAA;IAEA,OAAOZ,KAAAA;AACT;;;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as ts from 'typescript';
|
|
2
|
+
import type { Attribute, Schema } from './utils';
|
|
3
|
+
import { mappers } from './mappers';
|
|
4
|
+
/**
|
|
5
|
+
* Create the base type node for a given attribute
|
|
6
|
+
*/
|
|
7
|
+
export declare const getAttributeType: (attributeName: string, attribute: Attribute, uid?: string) => ts.TypeReferenceNode | null;
|
|
8
|
+
/**
|
|
9
|
+
* Options of the attribute generators.
|
|
10
|
+
*/
|
|
11
|
+
export type AttributeOptions = {
|
|
12
|
+
/**
|
|
13
|
+
* Whether the application enables `typescript.strictTypes`. Strict-only modifiers, such as
|
|
14
|
+
* `Schema.Attribute.Conditional`, are emitted only then, so generated files without strict types
|
|
15
|
+
* stay as in previous releases.
|
|
16
|
+
*/
|
|
17
|
+
strict?: boolean;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Collect every modifier node from an attribute
|
|
21
|
+
*/
|
|
22
|
+
export declare const getAttributeModifiers: (attribute: Attribute, { strict }?: AttributeOptions) => ts.TypeNode[];
|
|
23
|
+
/**
|
|
24
|
+
* The write rule of an attribute, as one sentence for its JSDoc, or `undefined` when the attribute
|
|
25
|
+
* has none to tell. It mirrors the strict write inputs of `@strapi/types`
|
|
26
|
+
* (`modules/documents/params/write.ts`), which follow the entity validator of `@strapi/core`.
|
|
27
|
+
*
|
|
28
|
+
* `draftAndPublish` is `undefined` for a component: its fields follow the mode of the parent entry.
|
|
29
|
+
*/
|
|
30
|
+
export declare const getAttributeWriteRule: (attribute: Attribute, { draftAndPublish }?: {
|
|
31
|
+
draftAndPublish?: boolean;
|
|
32
|
+
}) => string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Generate a property signature node for a given attribute
|
|
35
|
+
*/
|
|
36
|
+
export declare const attributeToPropertySignature: (schema: Schema, attributeName: string, attribute: Attribute, options?: AttributeOptions) => ts.PropertySignature | null;
|
|
37
|
+
export { mappers };
|
|
38
|
+
//# sourceMappingURL=attributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../../../../src/generators/common/models/attributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAKjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC3B,eAAe,MAAM,EACrB,WAAW,SAAS,EACpB,MAAM,MAAM,KACX,EAAE,CAAC,iBAAiB,GAAG,IAezB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAChC,WAAW,SAAS,EACpB,aAAoB,gBAAqB,KACxC,EAAE,CAAC,QAAQ,EAsIb,CAAC;AASF;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,GAChC,WAAW,SAAS,EACpB,sBAAqB;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAO,KACtD,MAAM,GAAG,SA2CX,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,4BAA4B,GACvC,QAAQ,MAAM,EACd,eAAe,MAAM,EACrB,WAAW,SAAS,EACpB,UAAS,gBAAqB,KAC7B,EAAE,CAAC,iBAAiB,GAAG,IAoCzB,CAAC;AAEF,OAAO,EAAE,OAAO,EAAE,CAAC"}
|