@ms-cloudpack/bundler-rollup 0.6.3 → 0.6.5
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/NOTICE.txt +61 -0
- package/lib/getRollupPlugins.d.ts.map +1 -1
- package/lib/getRollupPlugins.js +7 -1
- package/lib/getRollupPlugins.js.map +1 -1
- package/lib/plugins/json/index.js +1 -1
- package/lib/plugins/json/index.js.map +1 -1
- package/lib/plugins/postcss/index.d.ts +3 -10
- package/lib/plugins/postcss/index.d.ts.map +1 -1
- package/lib/plugins/postcss/index.js +37 -48
- package/lib/plugins/postcss/index.js.map +1 -1
- package/lib/plugins/postcss/less-loader.d.ts +2 -8
- package/lib/plugins/postcss/less-loader.d.ts.map +1 -1
- package/lib/plugins/postcss/less-loader.js +8 -11
- package/lib/plugins/postcss/less-loader.js.map +1 -1
- package/lib/plugins/postcss/loaders.d.ts +15 -21
- package/lib/plugins/postcss/loaders.d.ts.map +1 -1
- package/lib/plugins/postcss/loaders.js +14 -34
- package/lib/plugins/postcss/loaders.js.map +1 -1
- package/lib/plugins/postcss/postcss-loader.d.ts +2 -9
- package/lib/plugins/postcss/postcss-loader.d.ts.map +1 -1
- package/lib/plugins/postcss/postcss-loader.js +30 -36
- package/lib/plugins/postcss/postcss-loader.js.map +1 -1
- package/lib/plugins/postcss/sass-loader.d.ts +5 -8
- package/lib/plugins/postcss/sass-loader.d.ts.map +1 -1
- package/lib/plugins/postcss/sass-loader.js +50 -52
- package/lib/plugins/postcss/sass-loader.js.map +1 -1
- package/lib/plugins/postcss/types.d.ts +96 -25
- package/lib/plugins/postcss/types.d.ts.map +1 -1
- package/lib/plugins/postcss/types.js +0 -1
- package/lib/plugins/postcss/types.js.map +1 -1
- package/lib/plugins/postcss/utils/load-module.d.ts +10 -4
- package/lib/plugins/postcss/utils/load-module.d.ts.map +1 -1
- package/lib/plugins/postcss/utils/load-module.js +10 -11
- package/lib/plugins/postcss/utils/load-module.js.map +1 -1
- package/lib/plugins/postcss/utils/normalize-path.d.ts +7 -2
- package/lib/plugins/postcss/utils/normalize-path.d.ts.map +1 -1
- package/lib/plugins/postcss/utils/normalize-path.js +12 -3
- package/lib/plugins/postcss/utils/normalize-path.js.map +1 -1
- package/package.json +5 -4
- package/lib/plugins/postcss/utils/humanlize-path.d.ts +0 -3
- package/lib/plugins/postcss/utils/humanlize-path.d.ts.map +0 -1
- package/lib/plugins/postcss/utils/humanlize-path.js +0 -7
- package/lib/plugins/postcss/utils/humanlize-path.js.map +0 -1
|
@@ -1,42 +1,113 @@
|
|
|
1
|
+
import type { WithRequired } from '@ms-cloudpack/common-types';
|
|
1
2
|
import type { CreateFilter } from '@rollup/pluginutils';
|
|
2
|
-
type
|
|
3
|
-
type
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import type { Options as CssNanoOptions } from 'cssnano';
|
|
4
|
+
import type postcss from 'postcss';
|
|
5
|
+
import type postcssModulesPlugin from 'postcss-modules';
|
|
6
|
+
import type { SourceMapInput, TransformPluginContext } from 'rollup';
|
|
7
|
+
import type * as Sass from 'sass';
|
|
8
|
+
/** Partial `less` options (can use real type if we add official less support) */
|
|
9
|
+
export type LessOptions = {
|
|
10
|
+
sourceMap?: object | false;
|
|
11
|
+
filename: string;
|
|
12
|
+
[key: string]: unknown;
|
|
13
|
+
};
|
|
14
|
+
/** Partial `less` module (can use real type if we add official less support) */
|
|
15
|
+
export type LessModule = {
|
|
16
|
+
render: (code: string, options: LessOptions, callback: (err: Error | null, output: {
|
|
17
|
+
css: string;
|
|
18
|
+
map?: string;
|
|
19
|
+
imports: string[];
|
|
20
|
+
}) => void) => void;
|
|
21
|
+
};
|
|
22
|
+
export type Resource = {
|
|
23
|
+
code: string;
|
|
24
|
+
map?: SourceMapInput;
|
|
25
|
+
};
|
|
26
|
+
export type ResourceResult = {
|
|
27
|
+
code: string;
|
|
28
|
+
map?: SourceMapInput;
|
|
29
|
+
extracted?: ExtractResult;
|
|
30
|
+
};
|
|
31
|
+
export type ExtractResult = {
|
|
32
|
+
id: string;
|
|
33
|
+
code: string;
|
|
34
|
+
map?: SourceMapInput;
|
|
35
|
+
};
|
|
36
|
+
export type ExtractedAsset = {
|
|
37
|
+
code: string;
|
|
38
|
+
map: string | undefined;
|
|
6
39
|
codeFileName: string;
|
|
7
40
|
mapFileName: string;
|
|
8
|
-
}
|
|
41
|
+
};
|
|
42
|
+
/** Definition of `*-loader.ts` or custom loaders */
|
|
43
|
+
export type Loader<TOptions> = {
|
|
44
|
+
name: string;
|
|
45
|
+
test?: RegExp | ((filepath: string) => boolean);
|
|
46
|
+
alwaysProcess?: boolean;
|
|
47
|
+
process(this: LoaderContext<TOptions>, resource: Resource): Promise<ResourceResult>;
|
|
48
|
+
};
|
|
49
|
+
export type BaseLoaderContext = Pick<TransformPluginContext, 'warn'> & WithRequired<Pick<PostCSSPluginConf, 'resolveCwd' | 'inputCwd' | 'sourceMap'>, 'resolveCwd' | 'inputCwd'> & {
|
|
50
|
+
/** Absolute path to the resource */
|
|
51
|
+
id: string;
|
|
52
|
+
/** A set of dependencies to watch */
|
|
53
|
+
dependencies: Set<string>;
|
|
54
|
+
plugin: TransformPluginContext;
|
|
55
|
+
};
|
|
56
|
+
export type LoaderContext<TOptions = unknown> = BaseLoaderContext & {
|
|
57
|
+
options: TOptions;
|
|
58
|
+
};
|
|
9
59
|
export type PostCSSPluginConf = {
|
|
60
|
+
/**
|
|
61
|
+
* Working directory for input files.
|
|
62
|
+
* @default process.cwd()
|
|
63
|
+
*/
|
|
64
|
+
inputCwd?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Working directory for resolving dependencies/peers such as `sass` or `less` (defaults to `inputCwd`).
|
|
67
|
+
* Note that resolution will be tried from the `bundler-rollup` package context first, then fall back
|
|
68
|
+
* to this directory.
|
|
69
|
+
*/
|
|
70
|
+
resolveCwd?: string;
|
|
71
|
+
/** Inject CSS as `<style>` to `<head>` */
|
|
10
72
|
inject?: boolean | Record<string, any> | ((cssVariableName: string, id: string) => string);
|
|
73
|
+
/** Extract CSS */
|
|
11
74
|
extract?: boolean | string;
|
|
12
|
-
onExtract?:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
75
|
+
onExtract?: (asset: Readonly<ExtractedAsset>) => boolean | Promise<boolean>;
|
|
76
|
+
/** CSS modules options */
|
|
77
|
+
modules?: boolean | Parameters<typeof postcssModulesPlugin>[0];
|
|
78
|
+
/** If true, only treat `.module.xxx` files as CSS modules. */
|
|
16
79
|
autoModules?: boolean;
|
|
80
|
+
onlyModules?: boolean;
|
|
81
|
+
/** Extensions to process as postcss files */
|
|
82
|
+
extensions?: string[];
|
|
83
|
+
plugins?: postcss.AcceptedPlugin[];
|
|
17
84
|
namedExports?: boolean | ((id: string) => string);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
85
|
+
/** Options for cssnano */
|
|
86
|
+
minimize?: boolean | CssNanoOptions;
|
|
87
|
+
parser?: string | postcss.ProcessOptions['parser'];
|
|
88
|
+
stringifier?: string | postcss.ProcessOptions['stringifier'];
|
|
89
|
+
syntax?: string | postcss.ProcessOptions['syntax'];
|
|
22
90
|
exec?: boolean;
|
|
23
|
-
config
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
91
|
+
/** postcss config file, disabled in this fork */
|
|
92
|
+
config?: false;
|
|
93
|
+
/** PostCSS target filename hint, for plugins that are relying on it */
|
|
27
94
|
to?: string;
|
|
28
|
-
|
|
29
|
-
loaders?:
|
|
95
|
+
/** Additional custom loaders */
|
|
96
|
+
loaders?: Loader<unknown>[];
|
|
30
97
|
onImport?: (id: string) => void;
|
|
31
|
-
use?: string[] | {
|
|
32
|
-
|
|
98
|
+
use?: Array<string | [name: string, options?: object]> | {
|
|
99
|
+
less?: Partial<LessOptions>;
|
|
100
|
+
sass?: Partial<Sass.LegacyOptions<'async'>>;
|
|
33
101
|
};
|
|
34
|
-
/**
|
|
35
|
-
* @default: false
|
|
36
|
-
**/
|
|
102
|
+
/** @default false */
|
|
37
103
|
sourceMap?: boolean | 'inline';
|
|
38
104
|
include?: Parameters<CreateFilter>[0];
|
|
39
105
|
exclude?: Parameters<CreateFilter>[1];
|
|
40
106
|
};
|
|
41
|
-
|
|
107
|
+
/** Options for `postcss-loader.ts` */
|
|
108
|
+
export type InternalPostCSSLoaderOptions = Required<Pick<PostCSSPluginConf, 'inject' | 'extract' | 'onlyModules' | 'config'>> & Pick<PostCSSPluginConf, 'namedExports' | 'autoModules' | 'to'> & {
|
|
109
|
+
[k in 'minimize' | 'modules']: Exclude<PostCSSPluginConf[k], true>;
|
|
110
|
+
} & {
|
|
111
|
+
postcss: Pick<PostCSSPluginConf, 'parser' | 'syntax' | 'stringifier' | 'exec' | 'plugins'>;
|
|
112
|
+
};
|
|
42
113
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/postcss/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/postcss/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,oBAAoB,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,KAAK,KAAK,IAAI,MAAM,MAAM,CAAC;AAElC,iFAAiF;AACjF,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IA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U,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;CACvC,CAAC;AAEF,sCAAsC;AACtC,MAAM,MAAM,4BAA4B,GAAG,QAAQ,CACjD,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,SAAS,GAAG,aAAa,GAAG,QAAQ,CAAC,CACzE,GACC,IAAI,CAAC,iBAAiB,EAAE,cAAc,GAAG,aAAa,GAAG,IAAI,CAAC,GAAG;KAC9D,CAAC,IAAI,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;CACnE,GAAG;IACF,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,QAAQ,GAAG,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;CAC5F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plugins/postcss/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/plugins/postcss/types.ts"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { WithRequired } from '@ms-cloudpack/common-types';\nimport type { CreateFilter } from '@rollup/pluginutils';\nimport type { Options as CssNanoOptions } from 'cssnano';\nimport type postcss from 'postcss';\nimport type postcssModulesPlugin from 'postcss-modules';\nimport type { SourceMapInput, TransformPluginContext } from 'rollup';\nimport type * as Sass from 'sass';\n\n/** Partial `less` options (can use real type if we add official less support) */\nexport type LessOptions = {\n sourceMap?: object | false;\n filename: string;\n [key: string]: unknown;\n};\n/** Partial `less` module (can use real type if we add official less support) */\nexport type LessModule = {\n render: (\n code: string,\n options: LessOptions,\n callback: (err: Error | null, output: { css: string; map?: string; imports: string[] }) => void,\n ) => void;\n};\n\nexport type Resource = { code: string; map?: SourceMapInput };\nexport type ResourceResult = { code: string; map?: SourceMapInput; extracted?: ExtractResult };\nexport type ExtractResult = { id: string; code: string; map?: SourceMapInput };\nexport type ExtractedAsset = { code: string; map: string | undefined; codeFileName: string; mapFileName: string };\n\n/** Definition of `*-loader.ts` or custom loaders */\nexport type Loader<TOptions> = {\n name: string;\n test?: RegExp | ((filepath: string) => boolean);\n alwaysProcess?: boolean;\n process(this: LoaderContext<TOptions>, resource: Resource): Promise<ResourceResult>;\n};\n\nexport type BaseLoaderContext = Pick<TransformPluginContext, 'warn'> &\n WithRequired<Pick<PostCSSPluginConf, 'resolveCwd' | 'inputCwd' | 'sourceMap'>, 'resolveCwd' | 'inputCwd'> & {\n /** Absolute path to the resource */\n id: string;\n /** A set of dependencies to watch */\n dependencies: Set<string>;\n plugin: TransformPluginContext;\n };\n\nexport type LoaderContext<TOptions = unknown> = BaseLoaderContext & {\n options: TOptions;\n};\n\nexport type PostCSSPluginConf = {\n /**\n * Working directory for input files.\n * @default process.cwd()\n */\n inputCwd?: string;\n /**\n * Working directory for resolving dependencies/peers such as `sass` or `less` (defaults to `inputCwd`).\n * Note that resolution will be tried from the `bundler-rollup` package context first, then fall back\n * to this directory.\n */\n resolveCwd?: string;\n /** Inject CSS as `<style>` to `<head>` */\n inject?: boolean | Record<string, any> | ((cssVariableName: string, id: string) => string);\n /** Extract CSS */\n extract?: boolean | string;\n onExtract?: (asset: Readonly<ExtractedAsset>) => boolean | Promise<boolean>;\n /** CSS modules options */\n modules?: boolean | Parameters<typeof postcssModulesPlugin>[0];\n /** If true, only treat `.module.xxx` files as CSS modules. */\n autoModules?: boolean;\n onlyModules?: boolean;\n /** Extensions to process as postcss files */\n extensions?: string[];\n plugins?: postcss.AcceptedPlugin[];\n namedExports?: boolean | ((id: string) => string);\n /** Options for cssnano */\n minimize?: boolean | CssNanoOptions;\n parser?: string | postcss.ProcessOptions['parser'];\n stringifier?: string | postcss.ProcessOptions['stringifier'];\n syntax?: string | postcss.ProcessOptions['syntax'];\n exec?: boolean;\n /** postcss config file, disabled in this fork */\n config?: false; // boolean | { path: string; ctx: any; };\n /** PostCSS target filename hint, for plugins that are relying on it */\n to?: string;\n /** Additional custom loaders */\n loaders?: Loader<unknown>[];\n onImport?: (id: string) => void;\n use?:\n | Array<string | [name: string, options?: object]>\n | {\n less?: Partial<LessOptions>;\n // eslint-disable-next-line etc/no-deprecated\n sass?: Partial<Sass.LegacyOptions<'async'>>;\n };\n /** @default false */\n sourceMap?: boolean | 'inline';\n include?: Parameters<CreateFilter>[0];\n exclude?: Parameters<CreateFilter>[1];\n};\n\n/** Options for `postcss-loader.ts` */\nexport type InternalPostCSSLoaderOptions = Required<\n Pick<PostCSSPluginConf, 'inject' | 'extract' | 'onlyModules' | 'config'>\n> &\n Pick<PostCSSPluginConf, 'namedExports' | 'autoModules' | 'to'> & {\n [k in 'minimize' | 'modules']: Exclude<PostCSSPluginConf[k], true>;\n } & {\n postcss: Pick<PostCSSPluginConf, 'parser' | 'syntax' | 'stringifier' | 'exec' | 'plugins'>;\n };\n"]}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Load a module using modern ESM dynamic imports
|
|
3
|
-
*
|
|
4
|
-
* @returns
|
|
2
|
+
* Load a module using modern ESM dynamic imports. It will try to import from the `bundler-rollup`
|
|
3
|
+
* package context first, or fall back to importing from `cwd`.
|
|
4
|
+
* @returns The loaded module, or null if not found. Depending on the module format, the expected
|
|
5
|
+
* contents may be either at the top level or under `default`.
|
|
5
6
|
*/
|
|
6
|
-
export declare function loadModule(
|
|
7
|
+
export declare function loadModule<TModule>(params: {
|
|
8
|
+
moduleId: string;
|
|
9
|
+
cwd: string;
|
|
10
|
+
}): Promise<TModule | {
|
|
11
|
+
default: TModule;
|
|
12
|
+
} | null>;
|
|
7
13
|
//# sourceMappingURL=load-module.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-module.d.ts","sourceRoot":"","sources":["../../../../src/plugins/postcss/utils/load-module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"load-module.d.ts","sourceRoot":"","sources":["../../../../src/plugins/postcss/utils/load-module.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE;IAChD,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb,GAAG,OAAO,CAAC,OAAO,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAAC,CAgBjD"}
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
import { createRequire } from 'module';
|
|
4
|
-
const require = createRequire(import.meta.url);
|
|
1
|
+
import { resolveModule } from '@ms-cloudpack/path-utilities';
|
|
5
2
|
/**
|
|
6
|
-
* Load a module using modern ESM dynamic imports
|
|
7
|
-
*
|
|
8
|
-
* @returns
|
|
3
|
+
* Load a module using modern ESM dynamic imports. It will try to import from the `bundler-rollup`
|
|
4
|
+
* package context first, or fall back to importing from `cwd`.
|
|
5
|
+
* @returns The loaded module, or null if not found. Depending on the module format, the expected
|
|
6
|
+
* contents may be either at the top level or under `default`.
|
|
9
7
|
*/
|
|
10
|
-
export async function loadModule(
|
|
8
|
+
export async function loadModule(params) {
|
|
9
|
+
const { moduleId, cwd } = params;
|
|
11
10
|
try {
|
|
12
11
|
// Try to import the module directly
|
|
13
|
-
return await import(moduleId);
|
|
12
|
+
return (await import(moduleId));
|
|
14
13
|
}
|
|
15
14
|
catch {
|
|
16
15
|
// If direct import fails, try resolving from current working directory
|
|
17
16
|
try {
|
|
18
|
-
const
|
|
19
|
-
return await import(
|
|
17
|
+
const resolvedUrl = resolveModule({ importSpecifier: moduleId, parentPath: cwd });
|
|
18
|
+
return (await import(resolvedUrl.toString()));
|
|
20
19
|
}
|
|
21
20
|
catch {
|
|
22
21
|
// Return null if module cannot be loaded
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-module.js","sourceRoot":"","sources":["../../../../src/plugins/postcss/utils/load-module.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"load-module.js","sourceRoot":"","sources":["../../../../src/plugins/postcss/utils/load-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAU,MAGzC;IACC,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IAEjC,IAAI,CAAC;QACH,oCAAoC;QACpC,OAAO,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAmC,CAAC;IACpE,CAAC;IAAC,MAAM,CAAC;QACP,uEAAuE;QACvE,IAAI,CAAC;YACH,MAAM,WAAW,GAAG,aAAa,CAAC,EAAE,eAAe,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;YAClF,OAAO,CAAC,MAAM,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAmC,CAAC;QAClF,CAAC;QAAC,MAAM,CAAC;YACP,yCAAyC;YACzC,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import { resolveModule } from '@ms-cloudpack/path-utilities';\n\n/**\n * Load a module using modern ESM dynamic imports. It will try to import from the `bundler-rollup`\n * package context first, or fall back to importing from `cwd`.\n * @returns The loaded module, or null if not found. Depending on the module format, the expected\n * contents may be either at the top level or under `default`.\n */\nexport async function loadModule<TModule>(params: {\n moduleId: string;\n cwd: string;\n}): Promise<TModule | { default: TModule } | null> {\n const { moduleId, cwd } = params;\n\n try {\n // Try to import the module directly\n return (await import(moduleId)) as TModule | { default: TModule };\n } catch {\n // If direct import fails, try resolving from current working directory\n try {\n const resolvedUrl = resolveModule({ importSpecifier: moduleId, parentPath: cwd });\n return (await import(resolvedUrl.toString())) as TModule | { default: TModule };\n } catch {\n // Return null if module cannot be loaded\n return null;\n }\n }\n}\n"]}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Normalize separators to forward slashes, and normalize multiple backslashes to a single forward slash.
|
|
3
|
+
*/
|
|
4
|
+
export declare function normalizePath(p: string, options?: {
|
|
5
|
+
/** Convert `p` from an absolute path to being relative to this directory */
|
|
6
|
+
relativeTo?: string;
|
|
7
|
+
}): string;
|
|
3
8
|
//# sourceMappingURL=normalize-path.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-path.d.ts","sourceRoot":"","sources":["../../../../src/plugins/postcss/utils/normalize-path.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"normalize-path.d.ts","sourceRoot":"","sources":["../../../../src/plugins/postcss/utils/normalize-path.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,aAAa,CAC3B,CAAC,EAAE,MAAM,EACT,OAAO,CAAC,EAAE;IACR,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACA,MAAM,CAQR"}
|
|
@@ -1,4 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import path from 'path';
|
|
2
|
+
/**
|
|
3
|
+
* Normalize separators to forward slashes, and normalize multiple backslashes to a single forward slash.
|
|
4
|
+
*/
|
|
5
|
+
export function normalizePath(p, options) {
|
|
6
|
+
if (options?.relativeTo) {
|
|
7
|
+
p = path.relative(options.relativeTo, p);
|
|
8
|
+
}
|
|
9
|
+
// Keep the original logic including the falsey check and multi-slash replacement for now
|
|
10
|
+
// (not clear if either is necessary)
|
|
11
|
+
return p && p.replace(/\\+/g, '/');
|
|
12
|
+
}
|
|
4
13
|
//# sourceMappingURL=normalize-path.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-path.js","sourceRoot":"","sources":["../../../../src/plugins/postcss/utils/normalize-path.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"normalize-path.js","sourceRoot":"","sources":["../../../../src/plugins/postcss/utils/normalize-path.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;GAEG;AACH,MAAM,UAAU,aAAa,CAC3B,CAAS,EACT,OAGC;IAED,IAAI,OAAO,EAAE,UAAU,EAAE,CAAC;QACxB,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED,yFAAyF;IACzF,qCAAqC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import path from 'path';\n\n/**\n * Normalize separators to forward slashes, and normalize multiple backslashes to a single forward slash.\n */\nexport function normalizePath(\n p: string,\n options?: {\n /** Convert `p` from an absolute path to being relative to this directory */\n relativeTo?: string;\n },\n): string {\n if (options?.relativeTo) {\n p = path.relative(options.relativeTo, p);\n }\n\n // Keep the original logic including the falsey check and multi-slash replacement for now\n // (not clear if either is necessary)\n return p && p.replace(/\\\\+/g, '/');\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ms-cloudpack/bundler-rollup",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.5",
|
|
4
4
|
"description": "Cloudpack's wrapper for the Rollup bundler",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@ms-cloudpack/path-string-parsing": "^1.2.7",
|
|
35
35
|
"@ms-cloudpack/path-utilities": "^3.2.2",
|
|
36
36
|
"@rollup/plugin-alias": "^5.0.1",
|
|
37
|
-
"@rollup/plugin-commonjs": "^
|
|
37
|
+
"@rollup/plugin-commonjs": "^29.0.0",
|
|
38
38
|
"@rollup/plugin-dynamic-import-vars": "^2.0.0",
|
|
39
39
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
40
40
|
"@rollup/plugin-replace": "^6.0.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@rollup/plugin-url": "^8.0.0",
|
|
44
44
|
"@rollup/pluginutils": "^5.0.1",
|
|
45
45
|
"@swc/core": "^1.3.0",
|
|
46
|
-
"@swc/plugin-relay": "
|
|
46
|
+
"@swc/plugin-relay": ">= 6.0.0",
|
|
47
47
|
"concat-with-sourcemaps": "^1.1.0",
|
|
48
48
|
"cssnano": "^6.0.0",
|
|
49
49
|
"magic-string": "^0.30.5",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"lodash": "^4.17.21"
|
|
68
68
|
},
|
|
69
69
|
"files": [
|
|
70
|
-
"lib/**/!(*.test.*)"
|
|
70
|
+
"lib/**/!(*.test.*)",
|
|
71
|
+
"NOTICE.txt"
|
|
71
72
|
]
|
|
72
73
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"humanlize-path.d.ts","sourceRoot":"","sources":["../../../../src/plugins/postcss/utils/humanlize-path.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,aAAa,GAAI,aAAQ,QAA0D,CAAC;AAE1F,eAAe,aAAa,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import normalizePath from './normalize-path.js';
|
|
5
|
-
const humanlizePath = (filepath) => normalizePath(path.relative(process.cwd(), filepath));
|
|
6
|
-
export default humanlizePath;
|
|
7
|
-
//# sourceMappingURL=humanlize-path.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"humanlize-path.js","sourceRoot":"","sources":["../../../../src/plugins/postcss/utils/humanlize-path.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,cAAc;AACd,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAEhD,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE1F,eAAe,aAAa,CAAC","sourcesContent":["/* eslint-disable */\n// @ts-nocheck\nimport path from 'path';\nimport normalizePath from './normalize-path.js';\n\nconst humanlizePath = (filepath) => normalizePath(path.relative(process.cwd(), filepath));\n\nexport default humanlizePath;\n"]}
|