@visulima/packem 1.2.2 → 1.3.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/README.md CHANGED
@@ -522,1958 +522,47 @@ You choose which one of the three supported transformer to use.
522
522
  - [@swc/core](https://github.com/swc-project/swc)
523
523
  - [sucrase](https://github.com/alangpierce/sucrase)
524
524
 
525
- ## Api Docs
525
+ ### onSuccess
526
526
 
527
- <!-- TYPEDOC -->
527
+ You can specify command to be executed after a successful build, specially useful for **Watch mode**
528
528
 
529
- # cli
530
- # config
531
-
532
- ## Functions
533
-
534
- ### defineConfig()
535
-
536
- ```ts
537
- function defineConfig(config): BuildConfig | BuildConfigFunction
538
- ```
539
-
540
- Define a build configuration.
541
-
542
- #### Parameters
543
-
544
- • **config**: [`BuildConfig`](packem.md#buildconfig) \| [`BuildConfigFunction`](config.md#buildconfigfunction)
545
-
546
- #### Returns
547
-
548
- [`BuildConfig`](packem.md#buildconfig) \| [`BuildConfigFunction`](config.md#buildconfigfunction)
549
-
550
- #### Defined in
551
-
552
- [config.ts:14](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/config.ts#L14)
553
-
554
- ***
555
-
556
- ### definePreset()
557
-
558
- ```ts
559
- function definePreset(preset): BuildPreset
560
- ```
561
-
562
- Define a build preset.
563
-
564
- #### Parameters
565
-
566
- • **preset**: [`BuildPreset`](packem.md#buildpreset)
567
-
568
- #### Returns
569
-
570
- [`BuildPreset`](packem.md#buildpreset)
571
-
572
- #### Defined in
573
-
574
- [config.ts:24](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/config.ts#L24)
575
-
576
- ## Type Aliases
577
-
578
- ### BuildConfigFunction()
579
-
580
- ```ts
581
- type BuildConfigFunction: (enviroment, mode) => BuildConfig | Promise<BuildConfig>;
582
- ```
583
-
584
- #### Parameters
585
-
586
- • **enviroment**: [`Environment`](packem.md#environment-2)
587
-
588
- • **mode**: [`Mode`](packem.md#mode-1)
589
-
590
- #### Returns
591
-
592
- [`BuildConfig`](packem.md#buildconfig) \| `Promise`\<[`BuildConfig`](packem.md#buildconfig)\>
593
-
594
- #### Defined in
595
-
596
- [config.ts:3](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/config.ts#L3)
597
-
598
- ## References
599
-
600
- ### BuildConfig
601
-
602
- Re-exports [BuildConfig](packem.md#buildconfig)
603
-
604
- ### BuildHooks
605
-
606
- Re-exports [BuildHooks](packem.md#buildhooks)
607
-
608
- ### BuildPreset
609
-
610
- Re-exports [BuildPreset](packem.md#buildpreset)
611
- # packem
612
-
613
- ## Functions
614
-
615
- ### packem()
616
-
617
- ```ts
618
- function packem(
619
- rootDirectory,
620
- mode,
621
- environment,
622
- logger,
623
- inputConfig): Promise<void>
624
- ```
625
-
626
- #### Parameters
627
-
628
- • **rootDirectory**: `string`
629
-
630
- • **mode**: [`Mode`](packem.md#mode-1)
631
-
632
- • **environment**: [`Environment`](packem.md#environment-2)
633
-
634
- • **logger**: `PailServerType`
635
-
636
- • **inputConfig**: `object` & [`BuildConfig`](packem.md#buildconfig) = `{}`
637
-
638
- #### Returns
639
-
640
- `Promise`\<`void`\>
641
-
642
- #### Defined in
643
-
644
- [packem.ts:610](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/packem.ts#L610)
645
-
646
- ## Interfaces
647
-
648
- ### BuildConfig
649
-
650
- In addition to basic `entries`, `presets`, and `hooks`,
651
- there are also all the properties of `BuildOptions` except for BuildOption's `entries`.
652
-
653
- #### Extends
654
-
655
- - `DeepPartial`\<`Omit`\<[`BuildOptions`](packem.md#buildoptions), `"entries"`\>\>
656
-
657
- #### Properties
658
-
659
- ##### alias?
660
-
661
- ```ts
662
- optional alias: DeepPartial<Record<string, string>>;
663
- ```
664
-
665
- ###### Inherited from
666
-
667
- `DeepPartial.alias`
668
-
669
- ###### Defined in
670
-
671
- [types.ts:181](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L181)
672
-
673
- ##### analyze?
674
-
675
- ```ts
676
- optional analyze: DeepPartial<boolean>;
677
- ```
678
-
679
- ###### Inherited from
680
-
681
- `DeepPartial.analyze`
682
-
683
- ###### Defined in
684
-
685
- [types.ts:182](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L182)
686
-
687
- ##### builder?
688
-
689
- ```ts
690
- optional builder: DeepPartial<Record<string, (context, cachePath, fileCache, logged) => Promise<void>>>;
691
- ```
692
-
693
- ###### Inherited from
694
-
695
- `DeepPartial.builder`
696
-
697
- ###### Defined in
698
-
699
- [types.ts:183](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L183)
700
-
701
- ##### cjsInterop?
702
-
703
- ```ts
704
- optional cjsInterop: DeepPartial<boolean>;
705
- ```
706
-
707
- ###### Inherited from
708
-
709
- `DeepPartial.cjsInterop`
710
-
711
- ###### Defined in
712
-
713
- [types.ts:184](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L184)
714
-
715
- ##### clean?
716
-
717
- ```ts
718
- optional clean: DeepPartial<boolean>;
719
- ```
720
-
721
- ###### Inherited from
722
-
723
- `DeepPartial.clean`
724
-
725
- ###### Defined in
726
-
727
- [types.ts:185](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L185)
728
-
729
- ##### debug?
730
-
731
- ```ts
732
- optional debug: DeepPartial<boolean>;
733
- ```
734
-
735
- ###### Inherited from
736
-
737
- `DeepPartial.debug`
738
-
739
- ###### Defined in
740
-
741
- [types.ts:186](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L186)
742
-
743
- ##### declaration?
744
-
745
- ```ts
746
- optional declaration: DeepPartial<boolean | "compatible" | "node16">;
747
- ```
748
-
749
- `compatible` means "src/gather.ts" will generate "dist/index.d.mts", "dist/index.d.cts" and "dist/index.d.ts".
750
- `node16` means "src/gather.ts" will generate "dist/index.d.mts" and "dist/index.d.cts".
751
- `true` is equivalent to `compatible`.
752
- `false` will disable declaration generation.
753
- `undefined` will auto-detect based on "package.json". If "package.json" has "types" field, it will be `"compatible"`, otherwise `false`.
754
-
755
- ###### Inherited from
756
-
757
- `DeepPartial.declaration`
758
-
759
- ###### Defined in
760
-
761
- [types.ts:194](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L194)
762
-
763
- ##### dtsOnly?
764
-
765
- ```ts
766
- optional dtsOnly: DeepPartial<boolean>;
767
- ```
768
-
769
- If `true`, only generate declaration files.
770
- If `false` or `undefined`, generate both declaration and source files.
771
-
772
- ###### Inherited from
773
-
774
- `DeepPartial.dtsOnly`
775
-
776
- ###### Defined in
777
-
778
- [types.ts:199](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L199)
779
-
780
- ##### emitCJS?
781
-
782
- ```ts
783
- optional emitCJS: DeepPartial<boolean>;
784
- ```
785
-
786
- ###### Inherited from
787
-
788
- `DeepPartial.emitCJS`
789
-
790
- ###### Defined in
791
-
792
- [types.ts:200](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L200)
793
-
794
- ##### emitESM?
795
-
796
- ```ts
797
- optional emitESM: DeepPartial<boolean>;
798
- ```
799
-
800
- ###### Inherited from
801
-
802
- `DeepPartial.emitESM`
803
-
804
- ###### Defined in
805
-
806
- [types.ts:201](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L201)
807
-
808
- ##### entries?
809
-
810
- ```ts
811
- optional entries: (string | BuildEntry)[];
812
- ```
813
-
814
- ###### Defined in
815
-
816
- [types.ts:309](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L309)
817
-
818
- ##### externals?
819
-
820
- ```ts
821
- optional externals: DeepPartial<string | RegExp>[];
822
- ```
823
-
824
- ###### Inherited from
825
-
826
- `DeepPartial.externals`
827
-
828
- ###### Defined in
829
-
830
- [types.ts:203](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L203)
831
-
832
- ##### failOnWarn?
833
-
834
- ```ts
835
- optional failOnWarn: DeepPartial<boolean>;
836
- ```
837
-
838
- ###### Inherited from
839
-
840
- `DeepPartial.failOnWarn`
841
-
842
- ###### Defined in
843
-
844
- [types.ts:204](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L204)
845
-
846
- ##### fileCache?
847
-
848
- ```ts
849
- optional fileCache: DeepPartial<boolean>;
850
- ```
851
-
852
- ###### Inherited from
853
-
854
- `DeepPartial.fileCache`
855
-
856
- ###### Defined in
857
-
858
- [types.ts:205](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L205)
859
-
860
- ##### hooks?
861
-
862
- ```ts
863
- optional hooks: Partial<BuildHooks>;
864
- ```
865
-
866
- ###### Defined in
867
-
868
- [types.ts:310](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L310)
869
-
870
- ##### isolatedDeclarationTransformer?
871
-
872
- ```ts
873
- optional isolatedDeclarationTransformer: DeepPartial<(code, id) => Promise<IsolatedDeclarationsResult>>;
874
- ```
875
-
876
- **`Experimental`**
877
-
878
- ###### Inherited from
879
-
880
- `DeepPartial.isolatedDeclarationTransformer`
881
-
882
- ###### Defined in
883
-
884
- [types.ts:207](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L207)
885
-
886
- ##### jiti?
887
-
888
- ```ts
889
- optional jiti: DeepPartial<Omit<JitiOptions, "transform" | "onError">>;
890
- ```
891
-
892
- Jiti options, where [jiti](https://github.com/unjs/jiti) is used to load the entry files.
893
-
894
- ###### Inherited from
895
-
896
- `DeepPartial.jiti`
897
-
898
- ###### Defined in
899
-
900
- [types.ts:211](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L211)
901
-
902
- ##### minify?
903
-
904
- ```ts
905
- optional minify: DeepPartial<boolean>;
906
- ```
907
-
908
- ###### Inherited from
909
-
910
- `DeepPartial.minify`
911
-
912
- ###### Defined in
913
-
914
- [types.ts:212](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L212)
915
-
916
- ##### name?
917
-
918
- ```ts
919
- optional name: string;
920
- ```
921
-
922
- ###### Inherited from
923
-
924
- `DeepPartial.name`
925
-
926
- ###### Defined in
927
-
928
- [types.ts:213](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L213)
929
-
930
- ##### outDir?
931
-
932
- ```ts
933
- optional outDir: string;
934
- ```
935
-
936
- ###### Inherited from
937
-
938
- `DeepPartial.outDir`
939
-
940
- ###### Defined in
941
-
942
- [types.ts:214](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L214)
943
-
944
- ##### preset?
945
-
946
- ```ts
947
- optional preset: "none" | "auto" | BuildPreset | object & string;
948
- ```
949
-
950
- ###### Defined in
951
-
952
- [types.ts:311](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L311)
953
-
954
- ##### rollup?
955
-
956
- ```ts
957
- optional rollup: DeepPartial<RollupBuildOptions>;
958
- ```
959
-
960
- ###### Inherited from
961
-
962
- `DeepPartial.rollup`
963
-
964
- ###### Defined in
965
-
966
- [types.ts:215](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L215)
967
-
968
- ##### rootDir?
969
-
970
- ```ts
971
- optional rootDir: string;
972
- ```
973
-
974
- ###### Inherited from
975
-
976
- `DeepPartial.rootDir`
977
-
978
- ###### Defined in
979
-
980
- [types.ts:216](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L216)
981
-
982
- ##### sourceDir?
983
-
984
- ```ts
985
- optional sourceDir: string;
986
- ```
987
-
988
- ###### Inherited from
989
-
990
- `DeepPartial.sourceDir`
991
-
992
- ###### Defined in
993
-
994
- [types.ts:217](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L217)
995
-
996
- ##### sourcemap?
997
-
998
- ```ts
999
- optional sourcemap: DeepPartial<boolean>;
1000
- ```
1001
-
1002
- ###### Inherited from
1003
-
1004
- `DeepPartial.sourcemap`
1005
-
1006
- ###### Defined in
1007
-
1008
- [types.ts:218](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L218)
1009
-
1010
- ##### transformer?
1011
-
1012
- ```ts
1013
- optional transformer: DeepPartial<(config) => Plugin<any>>;
1014
- ```
1015
-
1016
- ###### Inherited from
1017
-
1018
- `DeepPartial.transformer`
1019
-
1020
- ###### Defined in
1021
-
1022
- [types.ts:219](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L219)
1023
-
1024
- ##### typedoc?
1025
-
1026
- ```ts
1027
- optional typedoc: DeepPartial<false | TypeDocumentOptions>;
1028
- ```
1029
-
1030
- ###### Inherited from
1031
-
1032
- `DeepPartial.typedoc`
1033
-
1034
- ###### Defined in
1035
-
1036
- [types.ts:220](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L220)
1037
-
1038
- ##### validation?
1039
-
1040
- ```ts
1041
- optional validation: DeepPartial<object>;
1042
- ```
1043
-
1044
- ###### Type declaration
1045
-
1046
- ###### packageJson?
1047
-
1048
- ```ts
1049
- optional packageJson: object;
1050
- ```
1051
-
1052
- ###### packageJson.bin?
1053
-
1054
- ```ts
1055
- optional bin: boolean;
1056
- ```
1057
-
1058
- ###### packageJson.dependencies?
1059
-
1060
- ```ts
1061
- optional dependencies: boolean;
1062
- ```
1063
-
1064
- ###### packageJson.exports?
1065
-
1066
- ```ts
1067
- optional exports: boolean;
1068
- ```
1069
-
1070
- ###### packageJson.files?
1071
-
1072
- ```ts
1073
- optional files: boolean;
1074
- ```
1075
-
1076
- ###### packageJson.main?
1077
-
1078
- ```ts
1079
- optional main: boolean;
1080
- ```
1081
-
1082
- ###### packageJson.module?
1083
-
1084
- ```ts
1085
- optional module: boolean;
1086
- ```
1087
-
1088
- ###### packageJson.name?
1089
-
1090
- ```ts
1091
- optional name: boolean;
1092
- ```
1093
-
1094
- ###### packageJson.types?
1095
-
1096
- ```ts
1097
- optional types: boolean;
1098
- ```
1099
-
1100
- ###### packageJson.typesVersions?
1101
-
1102
- ```ts
1103
- optional typesVersions: boolean;
1104
- ```
1105
-
1106
- ###### Inherited from
1107
-
1108
- `DeepPartial.validation`
1109
-
1110
- ###### Defined in
1111
-
1112
- [types.ts:221](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L221)
1113
-
1114
- ***
1115
-
1116
- ### BuildContext
1117
-
1118
- #### Properties
1119
-
1120
- ##### buildEntries
1121
-
1122
- ```ts
1123
- buildEntries: (BuildContextBuildEntry | BuildContextBuildAssetAndChunk)[];
1124
- ```
1125
-
1126
- ###### Defined in
1127
-
1128
- [types.ts:288](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L288)
1129
-
1130
- ##### dependencyGraphMap
1131
-
1132
- ```ts
1133
- dependencyGraphMap: Map<string, Set<[string, string]>>;
1134
- ```
1135
-
1136
- ###### Defined in
1137
-
1138
- [types.ts:289](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L289)
1139
-
1140
- ##### environment
1141
-
1142
- ```ts
1143
- environment: Environment;
1144
- ```
1145
-
1146
- ###### Defined in
1147
-
1148
- [types.ts:290](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L290)
1149
-
1150
- ##### hooks
1151
-
1152
- ```ts
1153
- hooks: Hookable<BuildHooks, HookKeys<BuildHooks>>;
1154
- ```
1155
-
1156
- ###### Defined in
1157
-
1158
- [types.ts:291](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L291)
1159
-
1160
- ##### jiti
1161
-
1162
- ```ts
1163
- jiti: Jiti;
1164
- ```
1165
-
1166
- ###### Defined in
1167
-
1168
- [types.ts:292](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L292)
1169
-
1170
- ##### logger
1171
-
1172
- ```ts
1173
- logger: PailServerType;
1174
- ```
1175
-
1176
- ###### Defined in
1177
-
1178
- [types.ts:293](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L293)
1179
-
1180
- ##### mode
1181
-
1182
- ```ts
1183
- mode: Mode;
1184
- ```
1185
-
1186
- ###### Defined in
1187
-
1188
- [types.ts:294](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L294)
1189
-
1190
- ##### options
1191
-
1192
- ```ts
1193
- options: InternalBuildOptions;
1194
- ```
1195
-
1196
- ###### Defined in
1197
-
1198
- [types.ts:295](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L295)
1199
-
1200
- ##### pkg
1201
-
1202
- ```ts
1203
- pkg: PackageJson<!-- TYPEDOC -->;
1204
- ```
1205
-
1206
- ###### Defined in
1207
-
1208
- [types.ts:296](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L296)
1209
-
1210
- ##### tsconfig?
1211
-
1212
- ```ts
1213
- optional tsconfig: TsConfigResult;
1214
- ```
1215
-
1216
- ###### Defined in
1217
-
1218
- [types.ts:297](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L297)
1219
-
1220
- ##### usedImports
1221
-
1222
- ```ts
1223
- usedImports: Set<string>;
1224
- ```
1225
-
1226
- ###### Defined in
1227
-
1228
- [types.ts:298](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L298)
1229
-
1230
- ##### warnings
1231
-
1232
- ```ts
1233
- warnings: Set<string>;
1234
- ```
1235
-
1236
- ###### Defined in
1237
-
1238
- [types.ts:299](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L299)
1239
-
1240
- ***
1241
-
1242
- ### BuildHooks
1243
-
1244
- #### Properties
1245
-
1246
- ##### build:before()
1247
-
1248
- ```ts
1249
- build:before: (context) => void | Promise<void>;
1250
- ```
1251
-
1252
- ###### Parameters
1253
-
1254
- • **context**: [`BuildContext`](packem.md#buildcontext)
1255
-
1256
- ###### Returns
1257
-
1258
- `void` \| `Promise`\<`void`\>
1259
-
1260
- ###### Defined in
1261
-
1262
- [types.ts:237](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L237)
1263
-
1264
- ##### build:done()
1265
-
1266
- ```ts
1267
- build:done: (context) => void | Promise<void>;
1268
- ```
1269
-
1270
- ###### Parameters
1271
-
1272
- • **context**: [`BuildContext`](packem.md#buildcontext)
1273
-
1274
- ###### Returns
1275
-
1276
- `void` \| `Promise`\<`void`\>
1277
-
1278
- ###### Defined in
1279
-
1280
- [types.ts:238](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L238)
1281
-
1282
- ##### build:prepare()
1283
-
1284
- ```ts
1285
- build:prepare: (context) => void | Promise<void>;
1286
- ```
1287
-
1288
- ###### Parameters
1289
-
1290
- • **context**: [`BuildContext`](packem.md#buildcontext)
1291
-
1292
- ###### Returns
1293
-
1294
- `void` \| `Promise`\<`void`\>
1295
-
1296
- ###### Defined in
1297
-
1298
- [types.ts:239](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L239)
1299
-
1300
- ##### builder:before()
1301
-
1302
- ```ts
1303
- builder:before: (name, context) => void | Promise<void>;
1304
- ```
1305
-
1306
- ###### Parameters
1307
-
1308
- • **name**: `string`
1309
-
1310
- • **context**: [`BuildContext`](packem.md#buildcontext)
1311
-
1312
- ###### Returns
1313
-
1314
- `void` \| `Promise`\<`void`\>
1315
-
1316
- ###### Defined in
1317
-
1318
- [types.ts:241](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L241)
1319
-
1320
- ##### builder:done()
1321
-
1322
- ```ts
1323
- builder:done: (name, context) => void | Promise<void>;
1324
- ```
1325
-
1326
- ###### Parameters
1327
-
1328
- • **name**: `string`
1329
-
1330
- • **context**: [`BuildContext`](packem.md#buildcontext)
1331
-
1332
- ###### Returns
1333
-
1334
- `void` \| `Promise`\<`void`\>
1335
-
1336
- ###### Defined in
1337
-
1338
- [types.ts:242](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L242)
1339
-
1340
- ##### rollup:build()
1341
-
1342
- ```ts
1343
- rollup:build: (context, build) => void | Promise<void>;
1344
- ```
1345
-
1346
- ###### Parameters
1347
-
1348
- • **context**: [`BuildContext`](packem.md#buildcontext)
1349
-
1350
- • **build**: `RollupBuild`
1351
-
1352
- ###### Returns
1353
-
1354
- `void` \| `Promise`\<`void`\>
1355
-
1356
- ###### Defined in
1357
-
1358
- [types.ts:244](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L244)
1359
-
1360
- ##### rollup:done()
1361
-
1362
- ```ts
1363
- rollup:done: (context) => void | Promise<void>;
1364
- ```
1365
-
1366
- ###### Parameters
1367
-
1368
- • **context**: [`BuildContext`](packem.md#buildcontext)
1369
-
1370
- ###### Returns
1371
-
1372
- `void` \| `Promise`\<`void`\>
1373
-
1374
- ###### Defined in
1375
-
1376
- [types.ts:245](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L245)
1377
-
1378
- ##### rollup:dts:build()
1379
-
1380
- ```ts
1381
- rollup:dts:build: (context, build) => void | Promise<void>;
1382
- ```
1383
-
1384
- ###### Parameters
1385
-
1386
- • **context**: [`BuildContext`](packem.md#buildcontext)
1387
-
1388
- • **build**: `RollupBuild`
1389
-
1390
- ###### Returns
1391
-
1392
- `void` \| `Promise`\<`void`\>
1393
-
1394
- ###### Defined in
1395
-
1396
- [types.ts:246](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L246)
1397
-
1398
- ##### rollup:dts:done()
1399
-
1400
- ```ts
1401
- rollup:dts:done: (context) => void | Promise<void>;
1402
- ```
1403
-
1404
- ###### Parameters
1405
-
1406
- • **context**: [`BuildContext`](packem.md#buildcontext)
1407
-
1408
- ###### Returns
1409
-
1410
- `void` \| `Promise`\<`void`\>
1411
-
1412
- ###### Defined in
1413
-
1414
- [types.ts:248](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L248)
1415
-
1416
- ##### rollup:dts:options()
1417
-
1418
- ```ts
1419
- rollup:dts:options: (context, options) => void | Promise<void>;
1420
- ```
1421
-
1422
- ###### Parameters
1423
-
1424
- • **context**: [`BuildContext`](packem.md#buildcontext)
1425
-
1426
- • **options**: `RollupOptions`
1427
-
1428
- ###### Returns
1429
-
1430
- `void` \| `Promise`\<`void`\>
1431
-
1432
- ###### Defined in
1433
-
1434
- [types.ts:249](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L249)
1435
-
1436
- ##### rollup:options()
1437
-
1438
- ```ts
1439
- rollup:options: (context, options) => void | Promise<void>;
1440
- ```
1441
-
1442
- ###### Parameters
1443
-
1444
- • **context**: [`BuildContext`](packem.md#buildcontext)
1445
-
1446
- • **options**: `RollupOptions`
1447
-
1448
- ###### Returns
1449
-
1450
- `void` \| `Promise`\<`void`\>
1451
-
1452
- ###### Defined in
1453
-
1454
- [types.ts:251](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L251)
1455
-
1456
- ##### rollup:watch()
1457
-
1458
- ```ts
1459
- rollup:watch: (context, watcher) => void | Promise<void>;
1460
- ```
1461
-
1462
- ###### Parameters
1463
-
1464
- • **context**: [`BuildContext`](packem.md#buildcontext)
1465
-
1466
- • **watcher**: `RollupWatcher`
1467
-
1468
- ###### Returns
1469
-
1470
- `void` \| `Promise`\<`void`\>
1471
-
1472
- ###### Defined in
1473
-
1474
- [types.ts:252](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L252)
1475
-
1476
- ##### typedoc:before()
1477
-
1478
- ```ts
1479
- typedoc:before: (context) => void | Promise<void>;
1480
- ```
1481
-
1482
- ###### Parameters
1483
-
1484
- • **context**: [`BuildContext`](packem.md#buildcontext)
1485
-
1486
- ###### Returns
1487
-
1488
- `void` \| `Promise`\<`void`\>
1489
-
1490
- ###### Defined in
1491
-
1492
- [types.ts:255](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L255)
1493
-
1494
- ##### typedoc:done()
1495
-
1496
- ```ts
1497
- typedoc:done: (context) => void | Promise<void>;
1498
- ```
1499
-
1500
- ###### Parameters
1501
-
1502
- • **context**: [`BuildContext`](packem.md#buildcontext)
1503
-
1504
- ###### Returns
1505
-
1506
- `void` \| `Promise`\<`void`\>
1507
-
1508
- ###### Defined in
1509
-
1510
- [types.ts:257](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L257)
1511
-
1512
- ##### validate:before()
1513
-
1514
- ```ts
1515
- validate:before: (context) => void | Promise<void>;
1516
- ```
1517
-
1518
- ###### Parameters
1519
-
1520
- • **context**: [`BuildContext`](packem.md#buildcontext)
1521
-
1522
- ###### Returns
1523
-
1524
- `void` \| `Promise`\<`void`\>
1525
-
1526
- ###### Defined in
1527
-
1528
- [types.ts:259](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L259)
1529
-
1530
- ##### validate:done()
1531
-
1532
- ```ts
1533
- validate:done: (context) => void | Promise<void>;
1534
- ```
1535
-
1536
- ###### Parameters
1537
-
1538
- • **context**: [`BuildContext`](packem.md#buildcontext)
1539
-
1540
- ###### Returns
1541
-
1542
- `void` \| `Promise`\<`void`\>
1543
-
1544
- ###### Defined in
1545
-
1546
- [types.ts:260](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L260)
1547
-
1548
- ***
1549
-
1550
- ### BuildOptions
1551
-
1552
- #### Properties
1553
-
1554
- ##### alias
1555
-
1556
- ```ts
1557
- alias: Record<string, string>;
1558
- ```
1559
-
1560
- ###### Defined in
1561
-
1562
- [types.ts:181](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L181)
1563
-
1564
- ##### analyze?
1565
-
1566
- ```ts
1567
- optional analyze: boolean;
1568
- ```
1569
-
1570
- ###### Defined in
1571
-
1572
- [types.ts:182](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L182)
1573
-
1574
- ##### builder?
1575
-
1576
- ```ts
1577
- optional builder: Record<string, (context, cachePath, fileCache, logged) => Promise<void>>;
1578
- ```
1579
-
1580
- ###### Defined in
1581
-
1582
- [types.ts:183](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L183)
1583
-
1584
- ##### cjsInterop?
1585
-
1586
- ```ts
1587
- optional cjsInterop: boolean;
1588
- ```
1589
-
1590
- ###### Defined in
1591
-
1592
- [types.ts:184](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L184)
1593
-
1594
- ##### clean
1595
-
1596
- ```ts
1597
- clean: boolean;
1598
- ```
1599
-
1600
- ###### Defined in
1601
-
1602
- [types.ts:185](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L185)
1603
-
1604
- ##### debug
1605
-
1606
- ```ts
1607
- debug: boolean;
1608
- ```
1609
-
1610
- ###### Defined in
1611
-
1612
- [types.ts:186](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L186)
1613
-
1614
- ##### declaration?
1615
-
1616
- ```ts
1617
- optional declaration: boolean | "compatible" | "node16";
1618
- ```
1619
-
1620
- `compatible` means "src/gather.ts" will generate "dist/index.d.mts", "dist/index.d.cts" and "dist/index.d.ts".
1621
- `node16` means "src/gather.ts" will generate "dist/index.d.mts" and "dist/index.d.cts".
1622
- `true` is equivalent to `compatible`.
1623
- `false` will disable declaration generation.
1624
- `undefined` will auto-detect based on "package.json". If "package.json" has "types" field, it will be `"compatible"`, otherwise `false`.
1625
-
1626
- ###### Defined in
1627
-
1628
- [types.ts:194](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L194)
1629
-
1630
- ##### dtsOnly?
1631
-
1632
- ```ts
1633
- optional dtsOnly: boolean;
1634
- ```
1635
-
1636
- If `true`, only generate declaration files.
1637
- If `false` or `undefined`, generate both declaration and source files.
1638
-
1639
- ###### Defined in
1640
-
1641
- [types.ts:199](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L199)
1642
-
1643
- ##### emitCJS?
1644
-
1645
- ```ts
1646
- optional emitCJS: boolean;
1647
- ```
1648
-
1649
- ###### Defined in
1650
-
1651
- [types.ts:200](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L200)
1652
-
1653
- ##### emitESM?
1654
-
1655
- ```ts
1656
- optional emitESM: boolean;
1657
- ```
1658
-
1659
- ###### Defined in
1660
-
1661
- [types.ts:201](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L201)
1662
-
1663
- ##### entries
1664
-
1665
- ```ts
1666
- entries: BuildEntry[];
1667
- ```
1668
-
1669
- ###### Defined in
1670
-
1671
- [types.ts:202](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L202)
1672
-
1673
- ##### externals
1674
-
1675
- ```ts
1676
- externals: (string | RegExp)[];
1677
- ```
1678
-
1679
- ###### Defined in
1680
-
1681
- [types.ts:203](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L203)
1682
-
1683
- ##### failOnWarn?
1684
-
1685
- ```ts
1686
- optional failOnWarn: boolean;
1687
- ```
1688
-
1689
- ###### Defined in
1690
-
1691
- [types.ts:204](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L204)
1692
-
1693
- ##### fileCache?
1694
-
1695
- ```ts
1696
- optional fileCache: boolean;
1697
- ```
1698
-
1699
- ###### Defined in
1700
-
1701
- [types.ts:205](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L205)
1702
-
1703
- ##### isolatedDeclarationTransformer()?
1704
-
1705
- ```ts
1706
- optional isolatedDeclarationTransformer: (code, id) => Promise<IsolatedDeclarationsResult>;
1707
- ```
1708
-
1709
- **`Experimental`**
1710
-
1711
- ###### Parameters
1712
-
1713
- • **code**: `string`
1714
-
1715
- • **id**: `string`
1716
-
1717
- ###### Returns
1718
-
1719
- `Promise`\<`IsolatedDeclarationsResult`\>
1720
-
1721
- ###### Defined in
1722
-
1723
- [types.ts:207](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L207)
1724
-
1725
- ##### jiti
1726
-
1727
- ```ts
1728
- jiti: Omit<JitiOptions, "transform" | "onError">;
1729
- ```
1730
-
1731
- Jiti options, where [jiti](https://github.com/unjs/jiti) is used to load the entry files.
1732
-
1733
- ###### Defined in
1734
-
1735
- [types.ts:211](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L211)
1736
-
1737
- ##### minify?
1738
-
1739
- ```ts
1740
- optional minify: boolean;
1741
- ```
1742
-
1743
- ###### Defined in
1744
-
1745
- [types.ts:212](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L212)
1746
-
1747
- ##### name
1748
-
1749
- ```ts
1750
- name: string;
1751
- ```
1752
-
1753
- ###### Defined in
1754
-
1755
- [types.ts:213](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L213)
1756
-
1757
- ##### outDir
1758
-
1759
- ```ts
1760
- outDir: string;
1761
- ```
1762
-
1763
- ###### Defined in
1764
-
1765
- [types.ts:214](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L214)
1766
-
1767
- ##### rollup
1768
-
1769
- ```ts
1770
- rollup: RollupBuildOptions;
1771
- ```
1772
-
1773
- ###### Defined in
1774
-
1775
- [types.ts:215](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L215)
1776
-
1777
- ##### rootDir
1778
-
1779
- ```ts
1780
- rootDir: string;
1781
- ```
1782
-
1783
- ###### Defined in
1784
-
1785
- [types.ts:216](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L216)
1786
-
1787
- ##### sourceDir
1788
-
1789
- ```ts
1790
- sourceDir: string;
1791
- ```
1792
-
1793
- ###### Defined in
1794
-
1795
- [types.ts:217](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L217)
1796
-
1797
- ##### sourcemap
1798
-
1799
- ```ts
1800
- sourcemap: boolean;
1801
- ```
1802
-
1803
- ###### Defined in
1804
-
1805
- [types.ts:218](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L218)
1806
-
1807
- ##### transformer()
1808
-
1809
- ```ts
1810
- transformer: (config) => Plugin<any>;
1811
- ```
1812
-
1813
- ###### Parameters
1814
-
1815
- • **config**: `EsbuildPluginConfig` \| `SucrasePluginConfig` \| `SwcPluginConfig`
1816
-
1817
- ###### Returns
1818
-
1819
- `Plugin`\<`any`\>
1820
-
1821
- ###### Defined in
1822
-
1823
- [types.ts:219](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L219)
1824
-
1825
- ##### typedoc
1826
-
1827
- ```ts
1828
- typedoc: false | TypeDocumentOptions;
1829
- ```
1830
-
1831
- ###### Defined in
1832
-
1833
- [types.ts:220](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L220)
1834
-
1835
- ##### validation?
1836
-
1837
- ```ts
1838
- optional validation: object;
1839
- ```
1840
-
1841
- ###### packageJson?
1842
-
1843
- ```ts
1844
- optional packageJson: object;
1845
- ```
1846
-
1847
- ###### packageJson.bin?
1848
-
1849
- ```ts
1850
- optional bin: boolean;
1851
- ```
1852
-
1853
- ###### packageJson.dependencies?
1854
-
1855
- ```ts
1856
- optional dependencies: boolean;
1857
- ```
1858
-
1859
- ###### packageJson.exports?
1860
-
1861
- ```ts
1862
- optional exports: boolean;
1863
- ```
1864
-
1865
- ###### packageJson.files?
1866
-
1867
- ```ts
1868
- optional files: boolean;
1869
- ```
1870
-
1871
- ###### packageJson.main?
1872
-
1873
- ```ts
1874
- optional main: boolean;
1875
- ```
1876
-
1877
- ###### packageJson.module?
1878
-
1879
- ```ts
1880
- optional module: boolean;
1881
- ```
1882
-
1883
- ###### packageJson.name?
1884
-
1885
- ```ts
1886
- optional name: boolean;
1887
- ```
1888
-
1889
- ###### packageJson.types?
1890
-
1891
- ```ts
1892
- optional types: boolean;
1893
- ```
1894
-
1895
- ###### packageJson.typesVersions?
1896
-
1897
- ```ts
1898
- optional typesVersions: boolean;
1899
- ```
1900
-
1901
- ###### Defined in
1902
-
1903
- [types.ts:221](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L221)
1904
-
1905
- ***
1906
-
1907
- ### RollupBuildOptions
1908
-
1909
- #### Properties
1910
-
1911
- ##### alias
1912
-
1913
- ```ts
1914
- alias: false | RollupAliasOptions;
1915
- ```
1916
-
1917
- ###### Defined in
1918
-
1919
- [types.ts:104](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L104)
1920
-
1921
- ##### cjsInterop?
1922
-
1923
- ```ts
1924
- optional cjsInterop: CJSInteropOptions;
1925
- ```
1926
-
1927
- ###### Defined in
1928
-
1929
- [types.ts:105](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L105)
1930
-
1931
- ##### commonjs
1932
-
1933
- ```ts
1934
- commonjs: false | RollupCommonJSOptions;
1935
- ```
1936
-
1937
- ###### Defined in
1938
-
1939
- [types.ts:106](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L106)
1940
-
1941
- ##### copy?
1942
-
1943
- ```ts
1944
- optional copy: false | CopyPluginOptions;
1945
- ```
1946
-
1947
- ###### Defined in
1948
-
1949
- [types.ts:107](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L107)
1950
-
1951
- ##### dts
1952
-
1953
- ```ts
1954
- dts: Options;
1955
- ```
1956
-
1957
- ###### Defined in
1958
-
1959
- [types.ts:108](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L108)
1960
-
1961
- ##### dynamicVars?
1962
-
1963
- ```ts
1964
- optional dynamicVars: false | RollupDynamicImportVariablesOptions;
1965
- ```
1966
-
1967
- ###### Defined in
1968
-
1969
- [types.ts:109](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L109)
1970
-
1971
- ##### esbuild
1972
-
1973
- ```ts
1974
- esbuild: false | Options;
1975
- ```
1976
-
1977
- ###### Defined in
1978
-
1979
- [types.ts:110](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L110)
1980
-
1981
- ##### isolatedDeclarations?
1982
-
1983
- ```ts
1984
- optional isolatedDeclarations: IsolatedDeclarationsOptions;
1985
- ```
1986
-
1987
- ###### Defined in
1988
-
1989
- [types.ts:111](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L111)
1990
-
1991
- ##### json
1992
-
1993
- ```ts
1994
- json: false | RollupJsonOptions;
1995
- ```
1996
-
1997
- ###### Defined in
1998
-
1999
- [types.ts:112](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L112)
2000
-
2001
- ##### jsxRemoveAttributes?
2002
-
2003
- ```ts
2004
- optional jsxRemoveAttributes: false | JSXRemoveAttributesPlugin;
2005
- ```
2006
-
2007
- ###### Defined in
2008
-
2009
- [types.ts:113](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L113)
2010
-
2011
- ##### license?
2012
-
2013
- ```ts
2014
- optional license: false | LicenseOptions;
2015
- ```
2016
-
2017
- ###### Defined in
2018
-
2019
- [types.ts:114](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L114)
2020
-
2021
- ##### metafile?
2022
-
2023
- ```ts
2024
- optional metafile: boolean;
2025
- ```
2026
-
2027
- ###### Defined in
2028
-
2029
- [types.ts:115](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L115)
2030
-
2031
- ##### node10Compatibility?
2032
-
2033
- ```ts
2034
- optional node10Compatibility: false | Node10CompatibilityOptions;
2035
- ```
2036
-
2037
- ###### Defined in
2038
-
2039
- [types.ts:116](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L116)
2040
-
2041
- ##### output?
2042
-
2043
- ```ts
2044
- optional output: OutputOptions;
2045
- ```
2046
-
2047
- ###### Defined in
2048
-
2049
- [types.ts:117](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L117)
2050
-
2051
- ##### patchTypes
2052
-
2053
- ```ts
2054
- patchTypes: false | PatchTypesOptions;
2055
- ```
2056
-
2057
- ###### Defined in
2058
-
2059
- [types.ts:118](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L118)
2060
-
2061
- ##### plugins?
2062
-
2063
- ```ts
2064
- optional plugins: RollupPlugins;
2065
- ```
2066
-
2067
- ###### Defined in
2068
-
2069
- [types.ts:119](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L119)
2070
-
2071
- ##### polyfillNode?
2072
-
2073
- ```ts
2074
- optional polyfillNode: false | NodePolyfillsOptions;
2075
- ```
2076
-
2077
- ###### Defined in
2078
-
2079
- [types.ts:120](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L120)
2080
-
2081
- ##### preserveDirectives?
2082
-
2083
- ```ts
2084
- optional preserveDirectives: object;
2085
- ```
2086
-
2087
- ###### directiveRegex?
2088
-
2089
- ```ts
2090
- optional directiveRegex: RegExp;
2091
- ```
2092
-
2093
- ###### exclude?
2094
-
2095
- ```ts
2096
- optional exclude: FilterPattern;
2097
- ```
2098
-
2099
- ###### include?
2100
-
2101
- ```ts
2102
- optional include: FilterPattern;
2103
- ```
2104
-
2105
- ###### Defined in
2106
-
2107
- [types.ts:121](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L121)
2108
-
2109
- ##### preserveDynamicImports?
2110
-
2111
- ```ts
2112
- optional preserveDynamicImports: boolean;
2113
- ```
2114
-
2115
- ###### Defined in
2116
-
2117
- [types.ts:126](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L126)
2118
-
2119
- ##### raw?
2120
-
2121
- ```ts
2122
- optional raw: false | RawLoaderOptions;
2123
- ```
2124
-
2125
- ###### Defined in
2126
-
2127
- [types.ts:127](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L127)
2128
-
2129
- ##### replace
2130
-
2131
- ```ts
2132
- replace: false | RollupReplaceOptions;
2133
- ```
2134
-
2135
- ###### Defined in
2136
-
2137
- [types.ts:128](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L128)
2138
-
2139
- ##### resolve
2140
-
2141
- ```ts
2142
- resolve: false | RollupNodeResolveOptions;
2143
- ```
2144
-
2145
- ###### Defined in
2146
-
2147
- [types.ts:129](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L129)
2148
-
2149
- ##### shebang?
2150
-
2151
- ```ts
2152
- optional shebang: false | Partial<ShebangOptions>;
2153
- ```
2154
-
2155
- ###### Defined in
2156
-
2157
- [types.ts:130](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L130)
2158
-
2159
- ##### shim?
2160
-
2161
- ```ts
2162
- optional shim: false | EsmShimCjsSyntaxOptions;
2163
- ```
2164
-
2165
- ###### Defined in
2166
-
2167
- [types.ts:131](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L131)
2168
-
2169
- ##### sucrase?
2170
-
2171
- ```ts
2172
- optional sucrase: false | SucrasePluginConfig;
2173
- ```
2174
-
2175
- ###### Defined in
2176
-
2177
- [types.ts:132](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L132)
2178
-
2179
- ##### swc?
2180
-
2181
- ```ts
2182
- optional swc: false | SwcPluginConfig;
2183
- ```
2184
-
2185
- ###### Defined in
2186
-
2187
- [types.ts:133](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L133)
2188
-
2189
- ##### treeshake?
2190
-
2191
- ```ts
2192
- optional treeshake: boolean | TreeshakingPreset | TreeshakingOptions;
2193
- ```
2194
-
2195
- ###### Defined in
2196
-
2197
- [types.ts:134](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L134)
2198
-
2199
- ##### visualizer?
2200
-
2201
- ```ts
2202
- optional visualizer: false | PluginVisualizerOptions;
2203
- ```
2204
-
2205
- ###### Defined in
2206
-
2207
- [types.ts:135](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L135)
2208
-
2209
- ##### wasm?
2210
-
2211
- ```ts
2212
- optional wasm: false | RollupWasmOptions;
2213
- ```
2214
-
2215
- ###### Defined in
2216
-
2217
- [types.ts:136](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L136)
2218
-
2219
- ##### watch?
2220
-
2221
- ```ts
2222
- optional watch: false | WatcherOptions;
2223
- ```
2224
-
2225
- ###### Defined in
2226
-
2227
- [types.ts:137](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L137)
2228
-
2229
- ## Type Aliases
2230
-
2231
- ### BuildContextBuildAssetAndChunk
2232
-
2233
- ```ts
2234
- type BuildContextBuildAssetAndChunk: object;
2235
- ```
2236
-
2237
- #### Type declaration
2238
-
2239
- ##### bytes?
2240
-
2241
- ```ts
2242
- optional bytes: number;
2243
- ```
2244
-
2245
- ##### chunk?
2246
-
2247
- ```ts
2248
- optional chunk: boolean;
2249
- ```
2250
-
2251
- ##### chunks?
2252
-
2253
- ```ts
2254
- optional chunks: string[];
2255
- ```
2256
-
2257
- ##### exports?
2258
-
2259
- ```ts
2260
- optional exports: string[];
2261
- ```
2262
-
2263
- ##### modules?
2264
-
2265
- ```ts
2266
- optional modules: object[];
2267
- ```
2268
-
2269
- ##### path
2270
-
2271
- ```ts
2272
- path: string;
2273
- ```
2274
-
2275
- ##### type?
2276
-
2277
- ```ts
2278
- optional type: "asset" | "chunk";
2279
- ```
2280
-
2281
- #### Defined in
2282
-
2283
- [types.ts:273](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L273)
2284
-
2285
- ***
2286
-
2287
- ### BuildContextBuildEntry
2288
-
2289
- ```ts
2290
- type BuildContextBuildEntry: object;
2291
- ```
2292
-
2293
- #### Type declaration
2294
-
2295
- ##### bytes?
2296
-
2297
- ```ts
2298
- optional bytes: number;
2299
- ```
2300
-
2301
- ##### chunk?
2302
-
2303
- ```ts
2304
- optional chunk: boolean;
2305
- ```
2306
-
2307
- ##### chunks?
2308
-
2309
- ```ts
2310
- optional chunks: string[];
2311
- ```
2312
-
2313
- ##### exports?
2314
-
2315
- ```ts
2316
- optional exports: string[];
2317
- ```
2318
-
2319
- ##### modules?
2320
-
2321
- ```ts
2322
- optional modules: object[];
2323
- ```
2324
-
2325
- ##### path
2326
-
2327
- ```ts
2328
- path: string;
2329
- ```
2330
-
2331
- ##### type?
2332
-
2333
- ```ts
2334
- optional type: "entry";
2335
- ```
2336
-
2337
- #### Defined in
2338
-
2339
- [types.ts:263](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L263)
2340
-
2341
- ***
2342
-
2343
- ### BuildEntry
2344
-
2345
- ```ts
2346
- type BuildEntry: object;
2347
- ```
2348
-
2349
- #### Type declaration
2350
-
2351
- ##### cjs?
2352
-
2353
- ```ts
2354
- optional cjs: boolean;
2355
- ```
2356
-
2357
- ##### declaration?
2358
-
2359
- ```ts
2360
- optional declaration: boolean | "compatible" | "node16";
2361
- ```
2362
-
2363
- ##### environment?
2364
-
2365
- ```ts
2366
- optional environment: Environment;
2367
- ```
2368
-
2369
- ##### esm?
2370
-
2371
- ```ts
2372
- optional esm: boolean;
2373
- ```
2374
-
2375
- ##### executable?
2376
-
2377
- ```ts
2378
- optional executable: true;
2379
- ```
2380
-
2381
- ##### exportKey?
2382
-
2383
- ```ts
2384
- optional exportKey: Set<string>;
2385
- ```
2386
-
2387
- ##### fileAlias?
2388
-
2389
- ```ts
2390
- optional fileAlias: string;
2391
- ```
2392
-
2393
- ##### input
2394
-
2395
- ```ts
2396
- input: string;
2397
- ```
2398
-
2399
- ##### isGlob?
2400
-
2401
- ```ts
2402
- optional isGlob: boolean;
2403
- ```
2404
-
2405
- ##### name?
2406
-
2407
- ```ts
2408
- optional name: string;
2409
- ```
2410
-
2411
- ##### outDir?
2412
-
2413
- ```ts
2414
- optional outDir: string;
2415
- ```
2416
-
2417
- ##### runtime?
2418
-
2419
- ```ts
2420
- optional runtime: Runtime;
529
+ ```bash
530
+ packem build --watch --onSuccess "node dist/index.js"
2421
531
  ```
2422
532
 
2423
- #### Defined in
2424
-
2425
- [types.ts:165](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L165)
2426
-
2427
- ***
2428
-
2429
- ### BuildPreset
533
+ `onSuccess` can also be a `function` that returns `Promise`. For this to work, you need to use `packem.config.ts` instead of the cli flag:
2430
534
 
2431
535
  ```ts
2432
- type BuildPreset: BuildConfig | () => BuildConfig;
2433
- ```
2434
-
2435
- #### Defined in
536
+ import { defineConfig } from "@visulima/packem/config";
2436
537
 
2437
- [types.ts:302](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L302)
2438
-
2439
- ***
2440
-
2441
- ### Environment
2442
-
2443
- ```ts
2444
- type Environment: "production" | "development" | undefined;
538
+ export default defineConfig({
539
+ // ...
540
+ async onSuccess() {
541
+ // Start some long running task
542
+ // Like a server
543
+ },
544
+ });
2445
545
  ```
2446
546
 
2447
- #### Defined in
2448
-
2449
- [types.ts:90](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L90)
2450
-
2451
- ***
2452
-
2453
- ### Mode
547
+ You can return a cleanup function in `onSuccess`:
2454
548
 
2455
549
  ```ts
2456
- type Mode: "build" | "jit" | "watch" | "tsdoc";
2457
- ```
2458
-
2459
- #### Defined in
2460
-
2461
- [types.ts:319](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L319)
2462
-
2463
- ***
2464
-
2465
- ### Runtime
550
+ import { defineConfig } from "@visulima/packem/config";
2466
551
 
2467
- ```ts
2468
- type Runtime: "react-server" | "react-native" | "edge-light" | "node";
552
+ export default defineConfig({
553
+ // ...
554
+ onSuccess() {
555
+ const server = http.createServer((req, res) => {
556
+ res.end("Hello World!");
557
+ });
558
+ server.listen(3000);
559
+ return () => {
560
+ server.close();
561
+ };
562
+ },
563
+ });
2469
564
  ```
2470
565
 
2471
- #### Defined in
2472
-
2473
- [types.ts:163](https://github.com/visulima/packem/blob/885eca49ac5183271c23315b601f9bb373f0e4b1/packages/packem/src/types.ts#L163)
2474
-
2475
- <!-- /TYPEDOC -->
2476
-
2477
566
  ## Related
2478
567
 
2479
568
  - [bunchee](https://github.com/huozhi/bunchee) - Zero config bundler for ECMAScript and TypeScript packages