@ms-cloudpack/bundler-rollup 0.2.21 → 0.2.23

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.
@@ -1 +1 @@
1
- {"version":3,"file":"getRollupPlugins.d.ts","sourceRoot":"","sources":["../src/getRollupPlugins.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAqBrC,wBAAsB,gBAAgB,CAAC,OAAO,EAAE;IAC9C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,oBAAoB,EAAE,OAAO,CAAC;CAC/B,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAsFpB"}
1
+ {"version":3,"file":"getRollupPlugins.d.ts","sourceRoot":"","sources":["../src/getRollupPlugins.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAqBrC,wBAAsB,gBAAgB,CAAC,OAAO,EAAE;IAC9C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,SAAS,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,oBAAoB,EAAE,OAAO,CAAC;CAC/B,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA4FpB"}
@@ -1,6 +1,6 @@
1
1
  import { getSwcConfig } from '@ms-cloudpack/bundler-utilities';
2
2
  import _dynamicImportVariables from '@rollup/plugin-dynamic-import-vars';
3
- import _json from '@rollup/plugin-json';
3
+ import json from './plugins/json/index.js';
4
4
  import { nodeResolve } from '@rollup/plugin-node-resolve';
5
5
  import _replace from '@rollup/plugin-replace';
6
6
  import _terser from '@rollup/plugin-terser';
@@ -8,11 +8,11 @@ import _nodePolyfills from 'rollup-plugin-polyfill-node';
8
8
  import _postcss from 'rollup-plugin-postcss';
9
9
  import commonjs from './plugins/commonjs/index.js';
10
10
  import { normalizeRequireStatements } from './plugins/normalizeRequireStatements.js';
11
+ import { importAsString } from './plugins/importAsString.js';
11
12
  // Workaround for https://github.com/microsoft/TypeScript/issues/49189#issuecomment-1137756847
12
13
  // (https://arethetypeswrong.github.io/?p=%40rollup%2Fplugin-replace%405.0.2)
13
14
  // At runtime, we should always be using the ESM version of these packages, which use `export default`.
14
15
  // However, typescript interprets the types as CJS modules with a `default` property (which will fail at runtime).
15
- const json = _json;
16
16
  const replace = _replace;
17
17
  const terser = _terser;
18
18
  const nodePolyfills = _nodePolyfills;
@@ -50,7 +50,9 @@ export async function getRollupPlugins(options) {
50
50
  requireReturnsDefault: false,
51
51
  }),
52
52
  // Used to compile json files into javascript exports.
53
- json(),
53
+ json({
54
+ extensions: ['.json', '.resjson'],
55
+ }),
54
56
  // // Used to resolve node_modules.
55
57
  nodeResolve({
56
58
  preferBuiltins: false,
@@ -92,6 +94,9 @@ export async function getRollupPlugins(options) {
92
94
  }),
93
95
  // Minify production builds as a last step.
94
96
  !!isProduction && terser(),
97
+ importAsString({
98
+ include: '**/*.glsl',
99
+ }),
95
100
  ].filter((plugin) => !!plugin);
96
101
  }
97
102
  //# sourceMappingURL=getRollupPlugins.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getRollupPlugins.js","sourceRoot":"","sources":["../src/getRollupPlugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,uBAAuB,MAAM,oCAAoC,CAAC;AACzE,OAAO,KAAK,MAAM,qBAAqB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,Q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;gBACvD,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;aACxF;SACF,CAAC;QAEF,2CAA2C;QAC3C,CAAC,CAAC,YAAY,IAAI,MAAM,EAAE;KAC3B,CAAC,MAAM,CAAC,CAAC,MAAM,EAAoB,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC","sourcesContent":["import { getSwcConfig } from '@ms-cloudpack/bundler-utilities';\nimport _dynamicImportVariables from '@rollup/plugin-dynamic-import-vars';\nimport _json from '@rollup/plugin-json';\nimport { nodeResolve } from '@rollup/plugin-node-resolve';\nimport _replace from '@rollup/plugin-replace';\nimport type _swc from '@rollup/plugin-swc';\nimport _terser from '@rollup/plugin-terser';\nimport type { Plugin } from 'rollup';\nimport _nodePolyfills from 'rollup-plugin-polyfill-node';\nimport _postcss from 'rollup-plugin-postcss';\nimport commonjs from './plugins/commonjs/index.js';\nimport { normalizeRequireStatements } from './plugins/normalizeRequireStatements.js';\n\n// Workaround for https://github.com/microsoft/TypeScript/issues/49189#issuecomment-1137756847\n// (https://arethetypeswrong.github.io/?p=%40rollup%2Fplugin-replace%405.0.2)\n// At runtime, we should always be using the ESM version of these packages, which use `export default`.\n// However, typescript interprets the types as CJS modules with a `default` property (which will fail at runtime).\nconst json = _json as unknown as typeof _json.default;\nconst replace = _replace as unknown as typeof _replace.default;\nconst terser = _terser as unknown as typeof _terser.default;\nconst nodePolyfills = _nodePolyfills as unknown as typeof _nodePolyfills.default;\nconst postcss = _postcss as unknown as typeof _postcss.default;\nconst dynamicImportVariables = _dynamicImportVariables as unknown as typeof _dynamicImportVariables.default;\n\nfunction getSwcPlugin() {\n return import('@rollup/plugin-swc').then((m) => m.default) as Promise<typeof _swc.default>;\n}\n\nexport async function getRollupPlugins(options: {\n isProduction?: boolean;\n packagePath: string;\n enableTypescript?: boolean;\n dynamicImports?: string[];\n sourcemap: boolean | undefined;\n resolveWebExtensions: boolean;\n}): Promise<Plugin[]> {\n const { isProduction, packagePath, enableTypescript, dynamicImports = [], sourcemap, resolveWebExtensions } = options;\n\n const swcConfigsForTs = enableTypescript ? getSwcConfig({ packagePath, sourcemap }) : undefined;\n\n return [\n // Used to replaces constants in the code.\n replace({\n values: {\n 'process.env.NODE_ENV': isProduction ? `\"production\"` : `\"development\"`,\n DEPRECATED_UNIT_TEST: 'true',\n },\n preventAssignment: true,\n }),\n\n normalizeRequireStatements(),\n\n postcss({\n modules: {\n globalModulePaths: [/global\\.css$/],\n },\n }),\n\n // Used to parse commonjs.\n commonjs({\n // Treat all dependencies as external esm modules (since we'll be bundling them.)\n esmExternals: true,\n\n // When __esModule is true, the default export is `exports.default`; otherwise it's `module.exports`.\n defaultIsModuleExports: true,\n\n // Convert `require('library')` to `import * as library from 'library'` always, because `import library from\n // 'library' risks runtime failure if the dependency is ESM that doesn't export a default.\n requireReturnsDefault: false,\n }),\n\n // Used to compile json files into javascript exports.\n json(),\n\n // // Used to resolve node_modules.\n nodeResolve({\n preferBuiltins: false,\n browser: true,\n // TODO: Align with other bundlers https://github.com/microsoft/cloudpack/issues/2687\n extensions: [\n ...(resolveWebExtensions ? ['.web.js'] : []),\n '.js',\n '.json',\n ...(enableTypescript && resolveWebExtensions ? ['.web.ts', '.web.tsx'] : []),\n ...(enableTypescript ? ['.ts', '.tsx'] : []),\n ],\n }),\n\n // Used to browserify node globals (process, global, etc.)\n nodePolyfills(),\n\n // The rollup swc plugin gets confused by angle bracket casts like `const x = <T>value;`\n // in .ts files if the tsx option is enabled, so use separate rules for .ts and .tsx files.\n // https://github.com/microsoft/cloudpack/pull/2555\n swcConfigsForTs &&\n (await getSwcPlugin())({\n swc: swcConfigsForTs.tsOnly,\n include: /\\.ts$/,\n }),\n\n swcConfigsForTs &&\n (await getSwcPlugin())({\n swc: swcConfigsForTs.tsx,\n include: /\\.tsx$/,\n }),\n\n // Only run this plugin on **/*.dynamic.* files (plus others as specified) to avoid an extra\n // parsing/processing step on all files.\n // Must be done AFTER the TS step because it can only handle JS syntax.\n dynamicImportVariables({\n include: [\n '**/*.dynamic.*',\n // Convert the dynamic imports options to globs starting with **\n // (the plugin seems to be matching against full paths)\n ...dynamicImports.map((d) => (d.startsWith('**/') ? d : d.replace(/^(\\.?\\/)?/, '**/'))),\n ],\n }),\n\n // Minify production builds as a last step.\n !!isProduction && terser(),\n ].filter((plugin): plugin is Plugin => !!plugin);\n}\n"]}
1
+ {"version":3,"file":"getRollupPlugins.js","sourceRoot":"","sources":["../src/getRollupPlugins.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,uBAAuB,MAAM,oCAAoC,CAAC;AACzE,OAAO,IAAI,MAAM,yBAAyB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,QAAQ,MAAM,wBAAwB,CAAC;AAE9C,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAE5C,OAAO,cAAc,MAAM,6BAA6B,CAAC;AACzD,OAAO,QAAQ,MAAM,uBAAuB,CAAC;AAC7C,OAAO,QAAQ,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,yCAAyC,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,8FAA8F;AAC9F,6EAA6E;AAC7E,uGAAuG;AACvG,kHAAkH;AAClH,MAAM,OAAO,GAAG,QAA8C,CAAC;AAC/D,MAAM,MAAM,GAAG,OAA4C,CAAC;AAC5D,MAAM,aAAa,GAAG,cAA0D,CAAC;AACjF,MAAM,OAAO,GAAG,QAA8C,CAAC;AAC/D,MAAM,sBAAsB,GAAG,uBAA4E,CAAC;AAE5G,SAAS,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nimport _dynamicImportVariables from '@rollup/plugin-dynamic-import-vars';\nimport json from './plugins/json/index.js';\nimport { nodeResolve } from '@rollup/plugin-node-resolve';\nimport _replace from '@rollup/plugin-replace';\nimport type _swc from '@rollup/plugin-swc';\nimport _terser from '@rollup/plugin-terser';\nimport type { Plugin } from 'rollup';\nimport _nodePolyfills from 'rollup-plugin-polyfill-node';\nimport _postcss from 'rollup-plugin-postcss';\nimport commonjs from './plugins/commonjs/index.js';\nimport { normalizeRequireStatements } from './plugins/normalizeRequireStatements.js';\nimport { importAsString } from './plugins/importAsString.js';\n\n// Workaround for https://github.com/microsoft/TypeScript/issues/49189#issuecomment-1137756847\n// (https://arethetypeswrong.github.io/?p=%40rollup%2Fplugin-replace%405.0.2)\n// At runtime, we should always be using the ESM version of these packages, which use `export default`.\n// However, typescript interprets the types as CJS modules with a `default` property (which will fail at runtime).\nconst replace = _replace as unknown as typeof _replace.default;\nconst terser = _terser as unknown as typeof _terser.default;\nconst nodePolyfills = _nodePolyfills as unknown as typeof _nodePolyfills.default;\nconst postcss = _postcss as unknown as typeof _postcss.default;\nconst dynamicImportVariables = _dynamicImportVariables as unknown as typeof _dynamicImportVariables.default;\n\nfunction getSwcPlugin() {\n return import('@rollup/plugin-swc').then((m) => m.default) as Promise<typeof _swc.default>;\n}\n\nexport async function getRollupPlugins(options: {\n isProduction?: boolean;\n packagePath: string;\n enableTypescript?: boolean;\n dynamicImports?: string[];\n sourcemap: boolean | undefined;\n resolveWebExtensions: boolean;\n}): Promise<Plugin[]> {\n const { isProduction, packagePath, enableTypescript, dynamicImports = [], sourcemap, resolveWebExtensions } = options;\n\n const swcConfigsForTs = enableTypescript ? getSwcConfig({ packagePath, sourcemap }) : undefined;\n\n return [\n // Used to replaces constants in the code.\n replace({\n values: {\n 'process.env.NODE_ENV': isProduction ? `\"production\"` : `\"development\"`,\n DEPRECATED_UNIT_TEST: 'true',\n },\n preventAssignment: true,\n }),\n\n normalizeRequireStatements(),\n\n postcss({\n modules: {\n globalModulePaths: [/global\\.css$/],\n },\n }),\n\n // Used to parse commonjs.\n commonjs({\n // Treat all dependencies as external esm modules (since we'll be bundling them.)\n esmExternals: true,\n\n // When __esModule is true, the default export is `exports.default`; otherwise it's `module.exports`.\n defaultIsModuleExports: true,\n\n // Convert `require('library')` to `import * as library from 'library'` always, because `import library from\n // 'library' risks runtime failure if the dependency is ESM that doesn't export a default.\n requireReturnsDefault: false,\n }),\n\n // Used to compile json files into javascript exports.\n json({\n extensions: ['.json', '.resjson'],\n }),\n\n // // Used to resolve node_modules.\n nodeResolve({\n preferBuiltins: false,\n browser: true,\n // TODO: Align with other bundlers https://github.com/microsoft/cloudpack/issues/2687\n extensions: [\n ...(resolveWebExtensions ? ['.web.js'] : []),\n '.js',\n '.json',\n ...(enableTypescript && resolveWebExtensions ? ['.web.ts', '.web.tsx'] : []),\n ...(enableTypescript ? ['.ts', '.tsx'] : []),\n ],\n }),\n\n // Used to browserify node globals (process, global, etc.)\n nodePolyfills(),\n\n // The rollup swc plugin gets confused by angle bracket casts like `const x = <T>value;`\n // in .ts files if the tsx option is enabled, so use separate rules for .ts and .tsx files.\n // https://github.com/microsoft/cloudpack/pull/2555\n swcConfigsForTs &&\n (await getSwcPlugin())({\n swc: swcConfigsForTs.tsOnly,\n include: /\\.ts$/,\n }),\n\n swcConfigsForTs &&\n (await getSwcPlugin())({\n swc: swcConfigsForTs.tsx,\n include: /\\.tsx$/,\n }),\n\n // Only run this plugin on **/*.dynamic.* files (plus others as specified) to avoid an extra\n // parsing/processing step on all files.\n // Must be done AFTER the TS step because it can only handle JS syntax.\n dynamicImportVariables({\n include: [\n '**/*.dynamic.*',\n // Convert the dynamic imports options to globs starting with **\n // (the plugin seems to be matching against full paths)\n ...dynamicImports.map((d) => (d.startsWith('**/') ? d : d.replace(/^(\\.?\\/)?/, '**/'))),\n ],\n }),\n\n // Minify production builds as a last step.\n !!isProduction && terser(),\n\n importAsString({\n include: '**/*.glsl',\n }),\n ].filter((plugin): plugin is Plugin => !!plugin);\n}\n"]}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * This is the fork of https://www.npmjs.com/package/rollup-plugin-string-import?activeTab=readme
3
+ * The original plugin only support rollup v4.
4
+ * This fork will be removed when https://github.com/ExposedCat/rollup-plugin-string-import/pull/4 goes live.
5
+ */
6
+ import type { Plugin } from 'rollup';
7
+ import type { FilterPattern } from '@rollup/pluginutils';
8
+ export type ImportAsStringOptions = {
9
+ include: FilterPattern;
10
+ exclude?: FilterPattern;
11
+ transform?: (content: string, file: string) => string;
12
+ };
13
+ export declare function importAsString(options: ImportAsStringOptions): Plugin;
14
+ export default importAsString;
15
+ //# sourceMappingURL=importAsString.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importAsString.d.ts","sourceRoot":"","sources":["../../src/plugins/importAsString.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,aAAa,CAAC;IACvB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACvD,CAAC;AAEF,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM,CAoBrE;AAED,eAAe,cAAc,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { createFilter } from '@rollup/pluginutils';
2
+ export function importAsString(options) {
3
+ const { include, exclude, transform = (content) => content } = options;
4
+ const filter = createFilter(include, exclude);
5
+ return {
6
+ name: 'importAsString',
7
+ transform(code, id) {
8
+ if (filter(id)) {
9
+ const content = transform(code, id) //
10
+ .replaceAll('\\', '\\\\')
11
+ .replaceAll('`', '\\`');
12
+ return {
13
+ code: `export default \`${content}\`;`,
14
+ map: { mappings: '' },
15
+ };
16
+ }
17
+ },
18
+ };
19
+ }
20
+ export default importAsString;
21
+ //# sourceMappingURL=importAsString.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importAsString.js","sourceRoot":"","sources":["../../src/plugins/importAsString.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AASnD,MAAM,UAAU,cAAc,CAAC,OAA8B;IAC3D,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,GAAG,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC;IAEvE,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAE9C,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,SAAS,CAAC,IAAI,EAAE,EAAE;YAChB,IAAI,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;gBACf,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE;qBACnC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC;qBACxB,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;gBAE1B,OAAO;oBACL,IAAI,EAAE,oBAAoB,OAAO,KAAK;oBACtC,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;iBACtB,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,eAAe,cAAc,CAAC","sourcesContent":["/**\n * This is the fork of https://www.npmjs.com/package/rollup-plugin-string-import?activeTab=readme\n * The original plugin only support rollup v4.\n * This fork will be removed when https://github.com/ExposedCat/rollup-plugin-string-import/pull/4 goes live.\n */\nimport type { Plugin } from 'rollup';\nimport { createFilter } from '@rollup/pluginutils';\nimport type { FilterPattern } from '@rollup/pluginutils';\n\nexport type ImportAsStringOptions = {\n include: FilterPattern;\n exclude?: FilterPattern;\n transform?: (content: string, file: string) => string;\n};\n\nexport function importAsString(options: ImportAsStringOptions): Plugin {\n const { include, exclude, transform = (content) => content } = options;\n\n const filter = createFilter(include, exclude);\n\n return {\n name: 'importAsString',\n transform(code, id) {\n if (filter(id)) {\n const content = transform(code, id) //\n .replaceAll('\\\\', '\\\\\\\\')\n .replaceAll('`', '\\\\`');\n\n return {\n code: `export default \\`${content}\\`;`,\n map: { mappings: '' },\n };\n }\n },\n };\n}\n\nexport default importAsString;\n"]}
@@ -0,0 +1,10 @@
1
+ export default function json(options?: {}): {
2
+ name: string;
3
+ transform(code: any, id: any): {
4
+ code: string;
5
+ map: {
6
+ mappings: string;
7
+ };
8
+ } | null;
9
+ };
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/json/index.js"],"names":[],"mappings":"AAQA;;;;;;;;EAgCC"}
@@ -0,0 +1,39 @@
1
+ // Fork of @rollup/json to be able to define custom extensions such as resjson.
2
+ // TODO: Remove this fork when this PR is merged and released: https://github.com/rollup/plugins/pull/1857
3
+ /* tslint:disable */
4
+ /* eslint-disable */
5
+ // @ts-nocheck
6
+ import { createFilter, dataToEsm } from '@rollup/pluginutils';
7
+ import { extname } from 'path';
8
+ export default function json(options = {}) {
9
+ const filter = createFilter(options.include, options.exclude);
10
+ const indent = 'indent' in options ? options.indent : '\t';
11
+ const extensions = new Set('extensions' in options ? options.extensions : ['.json']);
12
+ return {
13
+ name: 'json',
14
+ transform(code, id) {
15
+ const extension = extname(id);
16
+ if (!extensions.has(extension) || !filter(id))
17
+ return null;
18
+ try {
19
+ const parsed = JSON.parse(code);
20
+ return {
21
+ code: dataToEsm(parsed, {
22
+ preferConst: options.preferConst,
23
+ compact: options.compact,
24
+ namedExports: options.namedExports,
25
+ includeArbitraryNames: options.includeArbitraryNames,
26
+ indent,
27
+ }),
28
+ map: { mappings: '' },
29
+ };
30
+ }
31
+ catch (err) {
32
+ const message = 'Could not parse JSON file';
33
+ this.error({ message, id, cause: err });
34
+ return null;
35
+ }
36
+ },
37
+ };
38
+ }
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/json/index.js"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,0GAA0G;AAC1G,oBAAoB;AACpB,oBAAoB;AACpB,cAAc;AACd,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,OAAO,GAAG,EAAE;IACvC,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9D,MAAM,MAAM,GAAG,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IAC3D,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,YAAY,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAErF,OAAO;QACL,IAAI,EAAE,MAAM;QAEZ,SAAS,CAAC,IAAI,EAAE,EAAE;YAChB,MAAM,SAAS,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC;YAE9B,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;gBAAE,OAAO,IAAI,CAAC;YAE3D,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAChC,OAAO;oBACL,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE;wBACtB,WAAW,EAAE,OAAO,CAAC,WAAW;wBAChC,OAAO,EAAE,OAAO,CAAC,OAAO;wBACxB,YAAY,EAAE,OAAO,CAAC,YAAY;wBAClC,qBAAqB,EAAE,OAAO,CAAC,qBAAqB;wBACpD,MAAM;qBACP,CAAC;oBACF,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE;iBACtB,CAAC;YACJ,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,OAAO,GAAG,2BAA2B,CAAC;gBAC5C,IAAI,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;gBACxC,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Fork of @rollup/json to be able to define custom extensions such as resjson.\n// TODO: Remove this fork when this PR is merged and released: https://github.com/rollup/plugins/pull/1857\n/* tslint:disable */\n/* eslint-disable */\n// @ts-nocheck\nimport { createFilter, dataToEsm } from '@rollup/pluginutils';\nimport { extname } from 'path';\n\nexport default function json(options = {}) {\n const filter = createFilter(options.include, options.exclude);\n const indent = 'indent' in options ? options.indent : '\\t';\n const extensions = new Set('extensions' in options ? options.extensions : ['.json']);\n\n return {\n name: 'json',\n\n transform(code, id) {\n const extension = extname(id);\n\n if (!extensions.has(extension) || !filter(id)) return null;\n\n try {\n const parsed = JSON.parse(code);\n return {\n code: dataToEsm(parsed, {\n preferConst: options.preferConst,\n compact: options.compact,\n namedExports: options.namedExports,\n includeArbitraryNames: options.includeArbitraryNames,\n indent,\n }),\n map: { mappings: '' },\n };\n } catch (err) {\n const message = 'Could not parse JSON file';\n this.error({ message, id, cause: err });\n return null;\n }\n },\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/bundler-rollup",
3
- "version": "0.2.21",
3
+ "version": "0.2.23",
4
4
  "description": "A cloudpack plugin for abstracting rollup.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -22,12 +22,11 @@
22
22
  "@ms-cloudpack/bundler-capabilities": "^0.2.15",
23
23
  "@ms-cloudpack/bundler-utilities": "^0.2.5",
24
24
  "@ms-cloudpack/common-types": "^0.24.10",
25
- "@ms-cloudpack/esm-stub-utilities": "^0.14.13",
25
+ "@ms-cloudpack/esm-stub-utilities": "^0.14.14",
26
26
  "@ms-cloudpack/package-utilities": "^12.0.1",
27
27
  "@ms-cloudpack/path-string-parsing": "^1.2.6",
28
28
  "@ms-cloudpack/path-utilities": "^3.0.7",
29
29
  "@rollup/plugin-dynamic-import-vars": "^2.0.0",
30
- "@rollup/plugin-json": "^6.0.0",
31
30
  "@rollup/plugin-node-resolve": "^15.0.0",
32
31
  "@rollup/plugin-replace": "^5.0.0",
33
32
  "@rollup/plugin-swc": "^0.3.0",