@normed/bundle 2.0.1 → 2.0.4

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.
@@ -0,0 +1,8 @@
1
+ declare type LogFunction = (...message: any[]) => void;
2
+ declare type LogLevel = 'debug' | 'verbose' | 'info' | 'warn' | 'error' | 'critical';
3
+ export declare function setMinLogLevel(level: number | LogLevel): void;
4
+ declare const logFunctions: {
5
+ [level in LogLevel]: LogFunction;
6
+ };
7
+ declare const activeLogFunctions: typeof logFunctions;
8
+ export default activeLogFunctions;
@@ -0,0 +1,46 @@
1
+ import { Chalk } from "chalk";
2
+ export declare type Platform = 'web' | 'server';
3
+ export declare type Builder = {
4
+ inExt: (string | RegExp)[];
5
+ outExt: string | null;
6
+ build(entrypoints: Entrypoint[], extra: BuildConfig['extra']): Promise<void>;
7
+ name: string;
8
+ color: Chalk;
9
+ };
10
+ export declare type Entrypoint = {
11
+ infile: string;
12
+ outfile: string;
13
+ inbase: string;
14
+ outbase: string;
15
+ builder: Builder;
16
+ platform: Platform;
17
+ };
18
+ export declare type BuildConfig = {
19
+ dir: {
20
+ in: string;
21
+ out: string;
22
+ root: string;
23
+ };
24
+ platform: Platform;
25
+ builders: Builder[];
26
+ extra: {
27
+ analyse: boolean;
28
+ typescript: {
29
+ external: string[];
30
+ declarations: boolean;
31
+ };
32
+ };
33
+ };
34
+ export declare type APIOptions_Bundle = {
35
+ builders?: Builder[];
36
+ outdir?: string;
37
+ indir?: string;
38
+ platform?: Platform;
39
+ analyse?: boolean;
40
+ tscDeclarations?: boolean;
41
+ };
42
+ export declare type APIOptions_Clean = {
43
+ analyse?: boolean;
44
+ outdir?: string;
45
+ };
46
+ export declare type APIOptions = APIOptions_Bundle & APIOptions_Clean;
@@ -0,0 +1,39 @@
1
+ import '@normed/json-types';
2
+ import { RefinementFunctionType } from '@normed/refinements';
3
+ import { Platform, BuildConfig } from './types';
4
+ export declare function groupBy<O>(objs: O[], keys: (keyof O)[]): O[][];
5
+ export declare function readPackageJson(buildConfig: BuildConfig): Promise<PackageJson>;
6
+ export declare function getPlatformPart(file: string): null | 'static' | 'browser' | 'node' | 'web' | 'server';
7
+ export declare function getPlatform(file: string, basePlatform: Platform): Platform;
8
+ export declare function divide<A, B>(list: (A | B)[], divider: (v: A | B) => v is A): [A[], B[]];
9
+ export declare function join(...parts: (string | undefined)[]): string;
10
+ export declare const refinePackageJson: import("@normed/refinements").RefinementFunction<{
11
+ bundle: {
12
+ entrypoints: string[] | undefined;
13
+ analyse: boolean | undefined;
14
+ typescript: {
15
+ external: string[] | undefined;
16
+ declarations: boolean | undefined;
17
+ } | undefined;
18
+ } | undefined;
19
+ }>;
20
+ export declare type PackageJson = RefinementFunctionType<typeof refinePackageJson>;
21
+ export declare const canRefinePackageJson: {
22
+ getLastError: () => import("@normed/refinements").RefinementError;
23
+ } & ((path: import("@normed/refinements").Path, v: unknown) => v is {
24
+ bundle: {
25
+ entrypoints: string[] | undefined;
26
+ analyse: boolean | undefined;
27
+ typescript: {
28
+ external: string[] | undefined;
29
+ declarations: boolean | undefined;
30
+ } | undefined;
31
+ } | undefined;
32
+ });
33
+ /**
34
+ * Get the extension of the file
35
+ * note that for a file with no extension; e.g. "my/file/is", "is" will be the file extension
36
+ */
37
+ export declare function getExtension(file: string): string;
38
+ export declare function write(to: string, data: string): Promise<void>;
39
+ export declare function copy(from: string, to: string): Promise<void>;
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "@normed/bundle",
3
3
  "author": "Normal Gaussian <normed.bundle@normal-gaussian.com>",
4
- "version": "2.0.1",
4
+ "version": "2.0.4",
5
5
  "bin": "bundles/bin/cli.js",
6
6
  "main": "bundles/index.js",
7
+ "types": "dist",
7
8
  "scripts": {
8
9
  "test": "jest",
9
10
  "clean": "echo \"Not cleaning\"",
10
11
  "really-clean": "rm -rf dist bundles bundles-a",
11
- "build": "tsc --project tsconfig.json && node dist/bin/cli.js --outdir bundles-a && node bundles-a/bin/cli.js"
12
+ "publish": "yarn npm publish --tolerate-republish",
13
+ "build": "time tsc --project tsconfig.json && time node dist/bin/cli.js --outdir bundles-a && time node bundles-a/bin/cli.js && diff -r bundles-a bundles"
12
14
  },
13
15
  "bundle": {
14
16
  "entrypoints": [
@@ -18,7 +20,8 @@
18
20
  "typescript": {
19
21
  "declarations": true,
20
22
  "external": [
21
- "esbuild"
23
+ "esbuild",
24
+ "typescript"
22
25
  ]
23
26
  }
24
27
  },
@@ -26,18 +29,17 @@
26
29
  "@normed/json-types": "^1.0.8",
27
30
  "@normed/refinements": "^0.8.0",
28
31
  "@types/fs-extra": "^9.0.13",
29
- "@types/jest": "^27.0.2",
30
- "@types/node": "^16.10.4",
31
- "@types/pug": "^2.0.5",
32
+ "@types/jest": "^27.4.1",
33
+ "@types/node": "^16.11.26",
34
+ "@types/pug": "^2.0.6",
32
35
  "chalk": "^4.1.2",
33
36
  "filesystem-traverse": "^2.0.2",
34
- "fs-extra": "^10.0.0",
35
- "jest": "27.2.5",
36
- "jest-junit": "^12.3.0",
37
+ "fs-extra": "^10.0.1",
38
+ "jest": "27.5.1",
39
+ "jest-junit": "^13.0.0",
37
40
  "less": "^4.1.2",
38
41
  "pug": "^3.0.2",
39
- "ts-jest": "^27.0.5",
40
- "typescript": "^4.4.4"
42
+ "ts-jest": "^27.1.3"
41
43
  },
42
44
  "files": [
43
45
  "bundles/**/*"
@@ -46,7 +48,8 @@
46
48
  "access": "public"
47
49
  },
48
50
  "dependencies": {
49
- "@yarnpkg/esbuild-plugin-pnp": "^2.0.0-rc.1",
50
- "esbuild": "^0.13.4"
51
+ "@yarnpkg/esbuild-plugin-pnp": "^2.0.1",
52
+ "esbuild": "^0.14.27",
53
+ "typescript": "^4.4.4"
51
54
  }
52
55
  }