@devvit/build-pack 0.12.0-next-2025-04-30-2e2a14dbe.0 → 0.12.0-next-2025-08-12-20-06-14-50f19bb3e.0
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/esbuild/BuildInfoUtil.d.ts +6 -8
- package/esbuild/BuildInfoUtil.d.ts.map +1 -1
- package/esbuild/BuildInfoUtil.js +40 -26
- package/esbuild/BundleModule.d.ts.map +1 -1
- package/esbuild/BundleModule.js +6 -13
- package/esbuild/ESBuildPack.d.ts +38 -14
- package/esbuild/ESBuildPack.d.ts.map +1 -1
- package/esbuild/ESBuildPack.js +136 -98
- package/esbuild/dependency-spec-util.d.ts +10 -0
- package/esbuild/dependency-spec-util.d.ts.map +1 -0
- package/esbuild/dependency-spec-util.js +135 -0
- package/esbuild/dependency-spec-util.test.d.ts.map +1 -0
- package/esbuild/templatizer/blocks.template.d.ts +10 -0
- package/esbuild/templatizer/blocks.template.d.ts.map +1 -0
- package/esbuild/templatizer/blocks.template.js +343 -0
- package/esbuild/templatizer/blocks.template.test.d.ts.map +1 -0
- package/esbuild/templatizer/templatizer.d.ts +4 -0
- package/esbuild/templatizer/templatizer.d.ts.map +1 -0
- package/esbuild/templatizer/templatizer.js +12 -0
- package/esbuild/templatizer/templatizer.test.d.ts.map +1 -0
- package/esbuild/utils.d.ts +0 -4
- package/esbuild/utils.d.ts.map +1 -1
- package/esbuild/utils.js +0 -21
- package/index.d.ts +0 -1
- package/index.d.ts.map +1 -1
- package/index.js +0 -1
- package/lib/BuildPack.d.ts +6 -16
- package/lib/BuildPack.d.ts.map +1 -1
- package/lib/BuildPack.js +10 -6
- package/package.json +26 -15
- package/esbuild/type-checkers/TscTypeChecker.d.ts +0 -13
- package/esbuild/type-checkers/TscTypeChecker.d.ts.map +0 -1
- package/esbuild/type-checkers/TscTypeChecker.js +0 -93
- package/esbuild/type-checkers/types.d.ts +0 -10
- package/esbuild/type-checkers/types.d.ts.map +0 -1
- package/esbuild/type-checkers/types.js +0 -1
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import {} from '@devvit/protos/types/devvit/plugin/buildpack/buildpack_common.js';
|
|
2
|
-
import tsc from 'typescript';
|
|
3
|
-
import { getModuleEntrypoint } from '../../lib/BuildPack.js';
|
|
4
|
-
import { prefixBuildResultLogs } from '../utils.js';
|
|
5
|
-
// TODO: [DX-2214] We should make this the same as the tsconfig dumped into template projects
|
|
6
|
-
// to make sure that their IDE diagnostics match the ones we get from our compiler.
|
|
7
|
-
const BASE_TS_CONFIG = {
|
|
8
|
-
// we'll allow it since we do checkJS: true
|
|
9
|
-
allowJs: true,
|
|
10
|
-
checkJs: true,
|
|
11
|
-
allowSyntheticDefaultImports: true,
|
|
12
|
-
composite: false,
|
|
13
|
-
declaration: true,
|
|
14
|
-
declarationMap: true,
|
|
15
|
-
downlevelIteration: true,
|
|
16
|
-
esModuleInterop: true,
|
|
17
|
-
exactOptionalPropertyTypes: false,
|
|
18
|
-
experimentalDecorators: true,
|
|
19
|
-
forceConsistentCasingInFileNames: true,
|
|
20
|
-
inlineSources: false,
|
|
21
|
-
isolatedModules: true,
|
|
22
|
-
jsx: tsc.JsxEmit.React,
|
|
23
|
-
jsxFactory: 'Devvit.createElement',
|
|
24
|
-
jsxFragmentFactory: 'Devvit.Fragment',
|
|
25
|
-
lib: ['lib.es2020.core.d.ts', 'lib.webworker.d.ts'],
|
|
26
|
-
module: tsc.ModuleKind.NodeNext,
|
|
27
|
-
moduleResolution: tsc.ModuleResolutionKind.NodeNext,
|
|
28
|
-
noImplicitOverride: true,
|
|
29
|
-
noImplicitAny: false,
|
|
30
|
-
noUnusedLocals: false,
|
|
31
|
-
noUnusedParameters: false,
|
|
32
|
-
preserveWatchOutput: true,
|
|
33
|
-
resolveJsonModule: true,
|
|
34
|
-
strict: true,
|
|
35
|
-
target: tsc.ScriptTarget.ES2020,
|
|
36
|
-
skipLibCheck: true,
|
|
37
|
-
noEmitOnError: true,
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* @description TscBuildPack is a BuildPack that uses the TypeScript compiler to type check TypeScript files.
|
|
41
|
-
* Please note that this BuildPack does not produce any output files. It is meant to be used in conjunction with
|
|
42
|
-
* another BuildPack that produces output files.
|
|
43
|
-
*/
|
|
44
|
-
export class TscTypeChecker {
|
|
45
|
-
async check(request) {
|
|
46
|
-
const { filename } = request;
|
|
47
|
-
if (filename == null) {
|
|
48
|
-
throw new Error('Bundling virtual file system not implemented yet. Please provide a filename as the compilation entrypoint.');
|
|
49
|
-
}
|
|
50
|
-
const entrypoint = getModuleEntrypoint(filename);
|
|
51
|
-
const program = tsc.createProgram([entrypoint], BASE_TS_CONFIG);
|
|
52
|
-
const emitResult = program.emit();
|
|
53
|
-
return tscTypeCheckResultToCompileResponse(emitResult);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
function oneBase(num) {
|
|
57
|
-
return num + 1;
|
|
58
|
-
}
|
|
59
|
-
export function tscTypeCheckResultToCompileResponse(emitResult) {
|
|
60
|
-
const errors = [];
|
|
61
|
-
const warnings = [];
|
|
62
|
-
emitResult.diagnostics.forEach((diagnostic) => {
|
|
63
|
-
if (diagnostic.file != null) {
|
|
64
|
-
const text = tsc.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
|
|
65
|
-
const detail = {
|
|
66
|
-
column: 0,
|
|
67
|
-
filename: diagnostic.file.fileName,
|
|
68
|
-
line: 0,
|
|
69
|
-
text: diagnostic.messageText.toString(),
|
|
70
|
-
suggestion: '', // there is an API for this, but it's not exposed in specific diagnostic messages
|
|
71
|
-
};
|
|
72
|
-
if (diagnostic.start != null) {
|
|
73
|
-
detail.line = oneBase(diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start).line);
|
|
74
|
-
detail.column = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start).character;
|
|
75
|
-
}
|
|
76
|
-
const compileLog = {
|
|
77
|
-
detail,
|
|
78
|
-
text,
|
|
79
|
-
};
|
|
80
|
-
if (diagnostic.category === tsc.DiagnosticCategory.Error) {
|
|
81
|
-
errors.push(compileLog);
|
|
82
|
-
}
|
|
83
|
-
else if (diagnostic.category === tsc.DiagnosticCategory.Warning) {
|
|
84
|
-
warnings.push(compileLog);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
return prefixBuildResultLogs({
|
|
89
|
-
bundles: [],
|
|
90
|
-
errors,
|
|
91
|
-
warnings,
|
|
92
|
-
}, 'tsc');
|
|
93
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { CompileParams, CompileResponse } from '@devvit/protos/types/devvit/plugin/buildpack/buildpack_common.js';
|
|
2
|
-
export type TypeCheckParams = Pick<CompileParams, 'filename'>;
|
|
3
|
-
export type TypeCheckResult = Omit<CompileResponse, 'bundle'>;
|
|
4
|
-
/**
|
|
5
|
-
* @description TypeChecker is like a buildpack, except that it does not produce bundles
|
|
6
|
-
*/
|
|
7
|
-
export type TypeChecker = {
|
|
8
|
-
check: (request: TypeCheckParams) => Promise<TypeCheckResult>;
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/esbuild/type-checkers/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EAChB,MAAM,kEAAkE,CAAC;AAE1E,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;AAC9D,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;CAC/D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|