Skip to content

Commit 02420f0

Browse files
committed
feature #55 Move "types" into the package (weaverryan)
This PR was squashed before being merged into the main branch. Discussion ---------- Move "types" into the package Fixes #39 Instead of having a separate ``@symfony`/stimulus-bridge-types` package, it's easier (both for us but mostly for users) to embed it directly in the package. Cheers! Commits ------- f5224ae Move "types" into the package
2 parents 7ca86bc + f5224ae commit 02420f0

11 files changed

+21
-38
lines changed

dist/index.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/// <reference types="webpack-env" />
2+
import { Application } from '@hotwired/stimulus';
3+
export declare function startStimulusApp(context: __WebpackModuleApi.RequireContext): Application;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export default function (source: string): {
2+
options: {};
3+
errors: any[];
4+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export default function createControllersModule(config: any): {
2+
finalSource: string;
3+
deprecations: string[];
4+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default function (controllerPath: string, indentationSpaces: number, exportName?: string): string;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default function (source: string, sourceMap: string): any;

dist/webpack/loader.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default function (source: string): string;

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@
33
"description": "Stimulus integration bridge for Symfony projects",
44
"version": "3.1.0",
55
"main": "dist/index.js",
6+
"types": "dist/index.d.ts",
67
"license": "MIT",
78
"author": "Titouan Galopin <[email protected]>",
89
"engines": {
910
"node": "^10.13.0 || >=12.0.0"
1011
},
1112
"scripts": {
1213
"build": "yarn rollup -c",
14+
"build-types": "yarn tsc",
1315
"test": "yarn run webpack --config test/webpack.config.js && yarn run jest",
1416
"lint": "yarn run eslint src test",
1517
"format": "prettier src/*.ts test/*.js --write",
@@ -21,6 +23,7 @@
2123
},
2224
"dependencies": {
2325
"@hotwired/stimulus-webpack-helpers": "^1.0.1",
26+
"@types/webpack-env": "^1.16.4",
2427
"acorn": "^8.0.5",
2528
"loader-utils": "^2.0.0",
2629
"schema-utils": "^3.0.0"

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { definitionsFromContext } from '@hotwired/stimulus-webpack-helpers';
1717
// @ts-ignore: Unable to find module
1818
import symfonyControllers from './webpack/loader!@symfony/stimulus-bridge/controllers.json';
1919

20-
export function startStimulusApp(context: any) {
20+
export function startStimulusApp(context: __WebpackModuleApi.RequireContext) {
2121
const application = Application.start();
2222

2323
if (process.env.NODE_ENV === 'development') {

tsconfig.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
"outDir": "dist",
1212
"baseUrl": ".",
1313
"noEmit": false,
14-
"declaration": false,
14+
"declaration": true,
15+
"emitDeclarationOnly": true,
1516
"esModuleInterop": true,
1617
"allowSyntheticDefaultImports": true
1718
},
18-
"include": ["src/**/*", "test/**/*"]
19+
"include": ["src/**/*"]
1920
}

types/index.d.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

types/package.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)