@ms-cloudpack/bundler-ori 0.3.4 → 0.3.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.
@@ -1 +1 @@
1
- {"version":3,"file":"getOriOptions.d.ts","sourceRoot":"","sources":["../src/getOriOptions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAA8B,MAAM,4BAA4B,CAAC;AAK3G,OAAO,KAAK,EAAE,YAAY,EAAyC,MAAM,UAAU,CAAC;AAIpF,wFAAwF;AACxF,MAAM,MAAM,eAAe,GAAG,YAAY,GACxC,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,eAAe,GAAG,2BAA2B,CAAC,CAAC,CAAC;AAyB9E;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE1D;AAyJD;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,GACrC,OAAO,CAAC,eAAe,CAAC,CAqB1B"}
1
+ {"version":3,"file":"getOriOptions.d.ts","sourceRoot":"","sources":["../src/getOriOptions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAA8B,MAAM,4BAA4B,CAAC;AAK3G,OAAO,KAAK,EAAE,YAAY,EAAyC,MAAM,UAAU,CAAC;AAIpF,wFAAwF;AACxF,MAAM,MAAM,eAAe,GAAG,YAAY,GACxC,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,eAAe,GAAG,2BAA2B,CAAC,CAAC,CAAC;AAyB9E;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE1D;AA2JD;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,GACrC,OAAO,CAAC,eAAe,CAAC,CAqB1B"}
@@ -146,6 +146,7 @@ function getOriOptionsInternal(options, context) {
146
146
  plugins,
147
147
  resolveExtensions: mergeArrayDefaults(bundlerOptions.resolveExtensions, resolveExtensions),
148
148
  nodePaths: config.resolve?.modules,
149
+ alias: options.dedupeAliases,
149
150
  };
150
151
  }
151
152
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"getOriOptions.js","sourceRoot":"","sources":["../src/getOriOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAMvD,MAAM,YAAY,GAAG,CAAC,GAAG,cAAc,EAAE,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC;AAI1F,MAAM,cAAc,GAAuB;IACzC;QACE,MAAM,EAAE,aAAa;QACrB,aAAa,EAAE,KAAK;KACrB;IACD;QACE,MAAM,EAAE,MAAM;QACd,aAAa,EAAE,KAAK;KACrB;IACD;QACE,MAAM,EAAE,2BAA2B;KACpC;IACD;QACE,MAAM,EAAE,uBAAuB;KAChC;CACF,CAAC;AAEF,MAAM,wBAAwB,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC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AAC,CAAC,CAAC,eAAe;YACjE,GAAG,cAAc,CAAC,MAAM;SACzB;QAED,MAAM,EAAE;YACN,6FAA6F;YAC7F,uFAAuF;YACvF,qEAAqE;YACrE,UAAU,EAAE,MAAa;YACzB,OAAO,EAAE,MAAM;YACf,UAAU,EAAE,MAAM;YAClB,GAAG,cAAc,CAAC,MAAM;SACzB;QAED,OAAO;QAEP,iBAAiB,EAAE,kBAAkB,CAAC,cAAc,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;QAE1F,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO;KACnC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAAsB,EACtB,OAAsC;IAEtC,MAAM,cAAc,GAAG,CAAC,OAAO,CAAC,cAAc,IAAI,EAAE,CAA6B,CAAC;IAElF,MAAM,mBAAmB,GAA+B;QACtD,sDAAsD;QACtD,cAAc,EAAE;YACd,sFAAsF;YACtF,UAAU,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC;SACjF;QACD,GAAG,OAAO,CAAC,mBAAmB;KAC/B,CAAC;IAEF,MAAM,KAAK,GAAG,MAAM,mBAAmB,CAAC;QACtC,WAAW,EAAE,KAAK;QAClB,UAAU,EAAE,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC;QACnD,0BAA0B,EAAE,mBAAmB;QAC/C,oBAAoB,EAAE,eAAe;QACrC,2BAA2B,EAAE,OAAO,CAAC,MAAM,CAAC,2BAA2B;KACxE,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { processCapabilities } from '@ms-cloudpack/bundler-capabilities';\nimport { base64AssetExtensions, defaultTargetSyntax } from '@ms-cloudpack/bundler-utilities';\nimport type { BundleContext, BundleOptions, BundlerCapabilitiesOptions } from '@ms-cloudpack/common-types';\nimport { mergeArrayDefaults } from '@ms-cloudpack/package-utilities';\nimport { normalizeRelativePath, slash } from '@ms-cloudpack/path-string-parsing';\nimport { findProjectRoot } from '@ms-cloudpack/path-utilities';\nimport { builtinModules } from 'module';\nimport type { BuildOptions, PluginJSONConfig as _PluginJSONConfig } from 'oribuild';\nimport path from 'path';\nimport { oriCapabilities } from './oriCapabilities.js';\n\n/** Ori options with important properties always set by cloudpack marked as required. */\nexport type OriBuildOptions = BuildOptions &\n Required<Pick<BuildOptions, 'absWorkingDir' | 'buildAcknowledgeTimeoutMs'>>;\n\nconst nodeBuiltins = [...builtinModules, ...builtinModules.map((name) => `node:${name}`)];\n\n// The type from ori is now missing the extra properties\ntype PluginJSONConfig = _PluginJSONConfig & Record<string, string | boolean>;\nconst defaultPlugins: PluginJSONConfig[] = [\n {\n plugin: 'css-modules',\n prefixClasses: false,\n },\n {\n plugin: 'sass',\n prefixClasses: false,\n },\n {\n plugin: 'source-map-sources-prefix',\n },\n {\n plugin: 'deferred-write-on-end',\n },\n];\n\nconst defaultResolveExtensions = ['.tsx', '.ts', '.jsx', '.js', '.css', '.json'];\n\n/**\n * The intended use of `absWorkingDir` in esbuild is to resolve relative paths from options.\n * However, ori also uses `absWorkingDir` as the virtual FS root for module resolution in plugins.\n * This means if `inputPath` is an individual package in a monorepo, ori won't be able to resolve\n * scss `@import`s from other packages (which are often in `node_modules` at the git root).\n * As a workaround, we use the git root (if available) as `absWorkingDir` and adjust all other paths.\n * https://github.com/microsoft/cloudpack/issues/1174\n */\nexport function getAbsWorkingDir(inputPath: string): string {\n return findProjectRoot(inputPath, { noPackageRoot: true }) || inputPath;\n}\n\n/**\n * Join two relative paths, with forward slashes and removing any extra segments.\n */\nfunction joinRelativePaths(p1: string, p2: string): string {\n return normalizeRelativePath(path.normalize(path.join(p1, p2)));\n}\n\n/**\n * Get a slash-normalized relative path from the calculated `absWorkingDir` to the item.\n */\nfunction getRelativePath(absWorkingDir: string, absItemPath: string): string {\n return slash(path.relative(absWorkingDir, absItemPath));\n}\n\nfunction buildDynamicImportsFilter(dynamicImports: string[]): string {\n // Using the basename works good enough for now, we might want to include the path in the future,\n // but we would need to make sure it matches successfully in the dynamic import plugin.\n const joined = dynamicImports.map((s) => path.basename(s)).join('|');\n // Add the default dynamic import extensions to the list of dynamic imports.\n return `(${joined}|.dynamic.(js|mjs|ts|tsx))$`;\n}\n\n/**\n * @returns The options for the ori bundler, without capabilities applied.\n */\nfunction getOriOptionsInternal(options: BundleOptions, context: Pick<BundleContext, 'config'>): OriBuildOptions {\n const {\n inputPath,\n sourcemap,\n entries,\n outputPath,\n external = [],\n inlined = [],\n minify,\n incremental,\n dynamicImports,\n bundlerCapabilities,\n } = options;\n const { config } = context;\n const { features, mode } = config;\n\n const bundlerOptions = (options.bundlerOptions || {}) as Partial<OriBuildOptions>;\n\n const absWorkingDir = getAbsWorkingDir(inputPath);\n const relInputPath = getRelativePath(absWorkingDir, inputPath);\n\n // Normalize outputPath to be absolute (the passed value can either already be absolute, or be\n // relative to inputPath). Or if it's not specified, use inputPath.\n const finalOutputPath = outputPath ? path.resolve(inputPath, outputPath) : inputPath;\n\n // Enable this if the capability is not set but the feature is to continue supporting the deprecated feature.\n const resolveWebExtensions =\n // eslint-disable-next-line etc/no-deprecated\n !bundlerCapabilities?.['resolve-web-extensions'] && Boolean(features?.resolveWebExtensions);\n const resolveExtensions = resolveWebExtensions\n ? ['.web.tsx', '.web.ts', '.web.jsx', '.web.js', ...defaultResolveExtensions]\n : defaultResolveExtensions;\n\n const plugins = mergeArrayDefaults(bundlerOptions.plugins, defaultPlugins) as PluginJSONConfig[];\n if (dynamicImports?.length) {\n plugins.push({\n plugin: 'dynamic-imports',\n filter: buildDynamicImportsFilter(dynamicImports),\n });\n }\n\n // Translate options into ori config.\n return {\n splitting: true,\n serviceOptions: {\n // Disable the log file, as it is not used and can cause issues when running with elevated permissions.\n noLogFile: true,\n },\n buildAcknowledgeTimeoutMs: 10000,\n sourcemap: sourcemap ? 'linked' : 'none',\n // Default to es2022 so top-level await works\n target: defaultTargetSyntax,\n\n // bundlerOptions takes precedence over the defaults above\n ...bundlerOptions,\n\n // BundleOptions values take precedence over bundlerOptions\n incremental,\n minify,\n\n // Critical options that shouldn't be overridden\n metafile: true,\n write: true,\n\n // Calculated or manually merged options\n absWorkingDir,\n\n entryPoints: Object.fromEntries(\n Object.entries(entries).map(([outFile, inFile]) => [\n // outFile is relative to outputPath, which will still be correct because we updated outputPath\n outFile,\n // Either esbuild or ori appears to require entries to be prefixed with ./\n joinRelativePaths(relInputPath, inFile),\n ]),\n ),\n\n outdir: finalOutputPath,\n\n // outbase is probably only relevant for an array of entry point paths, not the full entryPoints\n // mapping (output path to input path) that ori uses, but go ahead and correct it if provided\n outbase: typeof bundlerOptions.outbase === 'string' ? path.resolve(inputPath, bundlerOptions.outbase) : undefined,\n\n // Enabling this automatically marks all import paths that look like npm packages as external.\n packages: !inlined.length && mode === 'library' ? 'external' : undefined,\n\n // These can be either package names or paths/globs (see https://esbuild.github.io/api/#external).\n // For any paths starting with a dot or slash, add relInputPath to the start.\n // TODO: Improve it so we always external all known and unknown packages by default, and only inline the ones we know we need.\n external: external\n .filter((e) => !inlined.includes(e))\n .map((e) => {\n if (e[0] === '/') {\n return `/${relInputPath}${e}`;\n }\n\n if (e[0] === '.') {\n return joinRelativePaths(relInputPath, e);\n }\n\n return e;\n })\n .concat(nodeBuiltins),\n define: {\n global: 'window',\n 'process.env.NODE_ENV': minify ? `\"production\"` : '\"development\"',\n ...bundlerOptions.define,\n },\n\n loader: {\n // By default, ori handles graphql files as data-urls. This is specific to the way graphql is\n // set up in the primary repo ori was designed for, and doesn't apply to most projects.\n // eslint-disable-next-line -- 'none' is valid but missing from types\n '.graphql': 'none' as any,\n '.glsl': 'text',\n '.resjson': 'json',\n ...bundlerOptions.loader,\n },\n\n plugins,\n\n resolveExtensions: mergeArrayDefaults(bundlerOptions.resolveExtensions, resolveExtensions),\n\n nodePaths: config.resolve?.modules,\n };\n}\n\n/**\n * @returns The options for the ori bundler, with capabilities applied.\n */\nexport async function getOriOptions(\n options: BundleOptions,\n context: Pick<BundleContext, 'config'>,\n): Promise<OriBuildOptions> {\n const bundlerOptions = (options.bundlerOptions || {}) as Partial<OriBuildOptions>;\n\n const capabilitiesOptions: BundlerCapabilitiesOptions = {\n // Enable asset inlining for the specified extensions.\n 'asset-inline': {\n // Filter out the default asset extensions that are already handled by bundlerOptions.\n extensions: base64AssetExtensions.filter((ext) => !bundlerOptions.loader?.[ext]),\n },\n ...options.bundlerCapabilities,\n };\n\n const input = await processCapabilities({\n bundlerName: 'ori',\n baseConfig: getOriOptionsInternal(options, context),\n bundlerCapabilitiesOptions: capabilitiesOptions,\n internalCapabilities: oriCapabilities,\n bundlerCapabilitiesRegistry: context.config.bundlerCapabilitiesRegistry,\n });\n\n return input;\n}\n"]}
1
+ {"version":3,"file":"getOriOptions.js","sourceRoot":"","sources":["../src/getOriOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAMvD,MAAM,YAAY,GAAG,CAAC,GAAG,cAAc,EAAE,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,CAAC;AAI1F,MAAM,cAAc,GAAuB;IACzC;QACE,MAAM,EAAE,aAAa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AA0B,EAAE,mBAAmB;QAC/C,oBAAoB,EAAE,eAAe;QACrC,2BAA2B,EAAE,OAAO,CAAC,MAAM,CAAC,2BAA2B;KACxE,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { processCapabilities } from '@ms-cloudpack/bundler-capabilities';\nimport { base64AssetExtensions, defaultTargetSyntax } from '@ms-cloudpack/bundler-utilities';\nimport type { BundleContext, BundleOptions, BundlerCapabilitiesOptions } from '@ms-cloudpack/common-types';\nimport { mergeArrayDefaults } from '@ms-cloudpack/package-utilities';\nimport { normalizeRelativePath, slash } from '@ms-cloudpack/path-string-parsing';\nimport { findProjectRoot } from '@ms-cloudpack/path-utilities';\nimport { builtinModules } from 'module';\nimport type { BuildOptions, PluginJSONConfig as _PluginJSONConfig } from 'oribuild';\nimport path from 'path';\nimport { oriCapabilities } from './oriCapabilities.js';\n\n/** Ori options with important properties always set by cloudpack marked as required. */\nexport type OriBuildOptions = BuildOptions &\n Required<Pick<BuildOptions, 'absWorkingDir' | 'buildAcknowledgeTimeoutMs'>>;\n\nconst nodeBuiltins = [...builtinModules, ...builtinModules.map((name) => `node:${name}`)];\n\n// The type from ori is now missing the extra properties\ntype PluginJSONConfig = _PluginJSONConfig & Record<string, string | boolean>;\nconst defaultPlugins: PluginJSONConfig[] = [\n {\n plugin: 'css-modules',\n prefixClasses: false,\n },\n {\n plugin: 'sass',\n prefixClasses: false,\n },\n {\n plugin: 'source-map-sources-prefix',\n },\n {\n plugin: 'deferred-write-on-end',\n },\n];\n\nconst defaultResolveExtensions = ['.tsx', '.ts', '.jsx', '.js', '.css', '.json'];\n\n/**\n * The intended use of `absWorkingDir` in esbuild is to resolve relative paths from options.\n * However, ori also uses `absWorkingDir` as the virtual FS root for module resolution in plugins.\n * This means if `inputPath` is an individual package in a monorepo, ori won't be able to resolve\n * scss `@import`s from other packages (which are often in `node_modules` at the git root).\n * As a workaround, we use the git root (if available) as `absWorkingDir` and adjust all other paths.\n * https://github.com/microsoft/cloudpack/issues/1174\n */\nexport function getAbsWorkingDir(inputPath: string): string {\n return findProjectRoot(inputPath, { noPackageRoot: true }) || inputPath;\n}\n\n/**\n * Join two relative paths, with forward slashes and removing any extra segments.\n */\nfunction joinRelativePaths(p1: string, p2: string): string {\n return normalizeRelativePath(path.normalize(path.join(p1, p2)));\n}\n\n/**\n * Get a slash-normalized relative path from the calculated `absWorkingDir` to the item.\n */\nfunction getRelativePath(absWorkingDir: string, absItemPath: string): string {\n return slash(path.relative(absWorkingDir, absItemPath));\n}\n\nfunction buildDynamicImportsFilter(dynamicImports: string[]): string {\n // Using the basename works good enough for now, we might want to include the path in the future,\n // but we would need to make sure it matches successfully in the dynamic import plugin.\n const joined = dynamicImports.map((s) => path.basename(s)).join('|');\n // Add the default dynamic import extensions to the list of dynamic imports.\n return `(${joined}|.dynamic.(js|mjs|ts|tsx))$`;\n}\n\n/**\n * @returns The options for the ori bundler, without capabilities applied.\n */\nfunction getOriOptionsInternal(options: BundleOptions, context: Pick<BundleContext, 'config'>): OriBuildOptions {\n const {\n inputPath,\n sourcemap,\n entries,\n outputPath,\n external = [],\n inlined = [],\n minify,\n incremental,\n dynamicImports,\n bundlerCapabilities,\n } = options;\n const { config } = context;\n const { features, mode } = config;\n\n const bundlerOptions = (options.bundlerOptions || {}) as Partial<OriBuildOptions>;\n\n const absWorkingDir = getAbsWorkingDir(inputPath);\n const relInputPath = getRelativePath(absWorkingDir, inputPath);\n\n // Normalize outputPath to be absolute (the passed value can either already be absolute, or be\n // relative to inputPath). Or if it's not specified, use inputPath.\n const finalOutputPath = outputPath ? path.resolve(inputPath, outputPath) : inputPath;\n\n // Enable this if the capability is not set but the feature is to continue supporting the deprecated feature.\n const resolveWebExtensions =\n // eslint-disable-next-line etc/no-deprecated\n !bundlerCapabilities?.['resolve-web-extensions'] && Boolean(features?.resolveWebExtensions);\n const resolveExtensions = resolveWebExtensions\n ? ['.web.tsx', '.web.ts', '.web.jsx', '.web.js', ...defaultResolveExtensions]\n : defaultResolveExtensions;\n\n const plugins = mergeArrayDefaults(bundlerOptions.plugins, defaultPlugins) as PluginJSONConfig[];\n if (dynamicImports?.length) {\n plugins.push({\n plugin: 'dynamic-imports',\n filter: buildDynamicImportsFilter(dynamicImports),\n });\n }\n\n // Translate options into ori config.\n return {\n splitting: true,\n serviceOptions: {\n // Disable the log file, as it is not used and can cause issues when running with elevated permissions.\n noLogFile: true,\n },\n buildAcknowledgeTimeoutMs: 10000,\n sourcemap: sourcemap ? 'linked' : 'none',\n // Default to es2022 so top-level await works\n target: defaultTargetSyntax,\n\n // bundlerOptions takes precedence over the defaults above\n ...bundlerOptions,\n\n // BundleOptions values take precedence over bundlerOptions\n incremental,\n minify,\n\n // Critical options that shouldn't be overridden\n metafile: true,\n write: true,\n\n // Calculated or manually merged options\n absWorkingDir,\n\n entryPoints: Object.fromEntries(\n Object.entries(entries).map(([outFile, inFile]) => [\n // outFile is relative to outputPath, which will still be correct because we updated outputPath\n outFile,\n // Either esbuild or ori appears to require entries to be prefixed with ./\n joinRelativePaths(relInputPath, inFile),\n ]),\n ),\n\n outdir: finalOutputPath,\n\n // outbase is probably only relevant for an array of entry point paths, not the full entryPoints\n // mapping (output path to input path) that ori uses, but go ahead and correct it if provided\n outbase: typeof bundlerOptions.outbase === 'string' ? path.resolve(inputPath, bundlerOptions.outbase) : undefined,\n\n // Enabling this automatically marks all import paths that look like npm packages as external.\n packages: !inlined.length && mode === 'library' ? 'external' : undefined,\n\n // These can be either package names or paths/globs (see https://esbuild.github.io/api/#external).\n // For any paths starting with a dot or slash, add relInputPath to the start.\n // TODO: Improve it so we always external all known and unknown packages by default, and only inline the ones we know we need.\n external: external\n .filter((e) => !inlined.includes(e))\n .map((e) => {\n if (e[0] === '/') {\n return `/${relInputPath}${e}`;\n }\n\n if (e[0] === '.') {\n return joinRelativePaths(relInputPath, e);\n }\n\n return e;\n })\n .concat(nodeBuiltins),\n define: {\n global: 'window',\n 'process.env.NODE_ENV': minify ? `\"production\"` : '\"development\"',\n ...bundlerOptions.define,\n },\n\n loader: {\n // By default, ori handles graphql files as data-urls. This is specific to the way graphql is\n // set up in the primary repo ori was designed for, and doesn't apply to most projects.\n // eslint-disable-next-line -- 'none' is valid but missing from types\n '.graphql': 'none' as any,\n '.glsl': 'text',\n '.resjson': 'json',\n ...bundlerOptions.loader,\n },\n\n plugins,\n\n resolveExtensions: mergeArrayDefaults(bundlerOptions.resolveExtensions, resolveExtensions),\n\n nodePaths: config.resolve?.modules,\n\n alias: options.dedupeAliases,\n };\n}\n\n/**\n * @returns The options for the ori bundler, with capabilities applied.\n */\nexport async function getOriOptions(\n options: BundleOptions,\n context: Pick<BundleContext, 'config'>,\n): Promise<OriBuildOptions> {\n const bundlerOptions = (options.bundlerOptions || {}) as Partial<OriBuildOptions>;\n\n const capabilitiesOptions: BundlerCapabilitiesOptions = {\n // Enable asset inlining for the specified extensions.\n 'asset-inline': {\n // Filter out the default asset extensions that are already handled by bundlerOptions.\n extensions: base64AssetExtensions.filter((ext) => !bundlerOptions.loader?.[ext]),\n },\n ...options.bundlerCapabilities,\n };\n\n const input = await processCapabilities({\n bundlerName: 'ori',\n baseConfig: getOriOptionsInternal(options, context),\n bundlerCapabilitiesOptions: capabilitiesOptions,\n internalCapabilities: oriCapabilities,\n bundlerCapabilitiesRegistry: context.config.bundlerCapabilitiesRegistry,\n });\n\n return input;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"oriCapabilities.d.ts","sourceRoot":"","sources":["../src/oriCapabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAK1D,eAAO,MAAM,eAAe,EAAE,wCAAwC,CAAC,eAAe,CAwCrF,CAAC"}
1
+ {"version":3,"file":"oriCapabilities.d.ts","sourceRoot":"","sources":["../src/oriCapabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wCAAwC,EAAE,MAAM,4BAA4B,CAAC;AAC3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAM1D,eAAO,MAAM,eAAe,EAAE,wCAAwC,CAAC,eAAe,CAwCrF,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import { mergeObjects } from '@ms-cloudpack/package-utilities';
2
2
  import { webExtensions } from '@ms-cloudpack/bundler-capabilities';
3
+ import { processAssetInlineExtensions } from '@ms-cloudpack/bundler-utilities';
3
4
  export const oriCapabilities = {
4
5
  'asset-inline': (config, options) => {
5
- // Make sure that the leading dot exists in the extensions
6
- const extensions = options.extensions.map((ext) => (!ext.startsWith('.') ? `.${ext}` : ext));
6
+ // Process extensions based on format (array or object)
7
+ const extensions = processAssetInlineExtensions(options.extensions);
7
8
  config.loader = {
8
9
  ...config.loader,
9
10
  ...Object.fromEntries(extensions.map((ext) => [ext, 'dataurl'])),
@@ -1 +1 @@
1
- {"version":3,"file":"oriCapabilities.js","sourceRoot":"","sources":["../src/oriCapabilities.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAGnE,MAAM,CAAC,MAAM,eAAe,GAA8D;IACxF,cAAc,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;QAClC,0DAA0D;QAC1D,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAE7F,MAAM,CAAC,MAAM,GAAG;YACd,GAAG,MAAM,CAAC,MAAM;YAChB,GAAG,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC;SACjE,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;QACzB,uCAAuC;QACvC,MAAM,CAAC,KAAK,GAAG,YAAY,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;QAC3D,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,wBAAwB,EAAE,CAAC,MAAM,EAAE,EAAE;QACnC,MAAM,CAAC,iBAAiB,KAAK,EAAE,CAAC;QAChC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,GAAG,aAAa,CAAC,CAAC;QACnD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,MAAM,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;QAC1B,MAAM,CAAC,MAAM,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;QACzD,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,KAAK,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;QACzB,MAAM,CAAC,OAAO,KAAK,EAAE,CAAC;QACtB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;YAClB,MAAM,EAAE,4BAA4B;YACpC,MAAM,EAAE,kBAAkB;YAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;YAC5C,4DAA4D;SACzC,CAAC,CAAC;QACvB,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,2FAA2F;IAC3F,qGAAqG;IACrG,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM;CAC5B,CAAC","sourcesContent":["import type { InternalBundlerCapabilityImplementations } from '@ms-cloudpack/common-types';\nimport type { OriBuildOptions } from './getOriOptions.ts';\nimport { mergeObjects } from '@ms-cloudpack/package-utilities';\nimport { webExtensions } from '@ms-cloudpack/bundler-capabilities';\nimport type { PluginJSONConfig } from 'oribuild';\n\nexport const oriCapabilities: InternalBundlerCapabilityImplementations<OriBuildOptions> = {\n 'asset-inline': (config, options) => {\n // Make sure that the leading dot exists in the extensions\n const extensions = options.extensions.map((ext) => (!ext.startsWith('.') ? `.${ext}` : ext));\n\n config.loader = {\n ...config.loader,\n ...Object.fromEntries(extensions.map((ext) => [ext, 'dataurl'])),\n };\n\n return config;\n },\n alias: (config, options) => {\n // Add aliases to the ori configuration\n config.alias = mergeObjects([config.alias || {}, options]);\n return config;\n },\n 'resolve-web-extensions': (config) => {\n config.resolveExtensions ??= [];\n config.resolveExtensions.unshift(...webExtensions);\n return config;\n },\n define: (config, options) => {\n config.define = { ...(config.define || {}), ...options };\n return config;\n },\n relay: (config, options) => {\n config.plugins ??= [];\n config.plugins.push({\n plugin: 'embedded-document-artefact',\n filter: '\\\\.[cm]?[jt]sx?$',\n rootDir: options.rootDir,\n artifactDirectory: options.artifactDirectory,\n // Type cast since extra properties are not part of the type\n } as PluginJSONConfig);\n return config;\n },\n // This is a placeholder for the density capability. It doesn't do anything in the bundler.\n // It's just a workaround for a post-bundle task. This will be replaced with 'plugins' in the future.\n density: (config) => config,\n};\n"]}
1
+ {"version":3,"file":"oriCapabilities.js","sourceRoot":"","sources":["../src/oriCapabilities.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAC;AAG/E,MAAM,CAAC,MAAM,eAAe,GAA8D;IACxF,cAAc,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;QAClC,uDAAuD;QACvD,MAAM,UAAU,GAAG,4BAA4B,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QA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,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM;CAC5B,CAAC","sourcesContent":["import type { InternalBundlerCapabilityImplementations } from '@ms-cloudpack/common-types';\nimport type { OriBuildOptions } from './getOriOptions.ts';\nimport { mergeObjects } from '@ms-cloudpack/package-utilities';\nimport { webExtensions } from '@ms-cloudpack/bundler-capabilities';\nimport { processAssetInlineExtensions } from '@ms-cloudpack/bundler-utilities';\nimport type { PluginJSONConfig } from 'oribuild';\n\nexport const oriCapabilities: InternalBundlerCapabilityImplementations<OriBuildOptions> = {\n 'asset-inline': (config, options) => {\n // Process extensions based on format (array or object)\n const extensions = processAssetInlineExtensions(options.extensions);\n\n config.loader = {\n ...config.loader,\n ...Object.fromEntries(extensions.map((ext) => [ext, 'dataurl'])),\n };\n\n return config;\n },\n alias: (config, options) => {\n // Add aliases to the ori configuration\n config.alias = mergeObjects([config.alias || {}, options]);\n return config;\n },\n 'resolve-web-extensions': (config) => {\n config.resolveExtensions ??= [];\n config.resolveExtensions.unshift(...webExtensions);\n return config;\n },\n define: (config, options) => {\n config.define = { ...(config.define || {}), ...options };\n return config;\n },\n relay: (config, options) => {\n config.plugins ??= [];\n config.plugins.push({\n plugin: 'embedded-document-artefact',\n filter: '\\\\.[cm]?[jt]sx?$',\n rootDir: options.rootDir,\n artifactDirectory: options.artifactDirectory,\n // Type cast since extra properties are not part of the type\n } as PluginJSONConfig);\n return config;\n },\n // This is a placeholder for the density capability. It doesn't do anything in the bundler.\n // It's just a workaround for a post-bundle task. This will be replaced with 'plugins' in the future.\n density: (config) => config,\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/bundler-ori",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Cloudpack's wrapper for the ori bundler",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,13 +14,13 @@
14
14
  }
15
15
  },
16
16
  "dependencies": {
17
- "@ms-cloudpack/bundler-capabilities": "^0.4.4",
18
- "@ms-cloudpack/bundler-utilities": "^0.6.6",
19
- "@ms-cloudpack/common-types": "^0.31.1",
17
+ "@ms-cloudpack/bundler-capabilities": "^0.4.5",
18
+ "@ms-cloudpack/bundler-utilities": "^0.6.7",
19
+ "@ms-cloudpack/common-types": "^0.31.2",
20
20
  "@ms-cloudpack/json-utilities": "^0.1.11",
21
- "@ms-cloudpack/package-utilities": "^13.1.4",
21
+ "@ms-cloudpack/package-utilities": "^13.1.5",
22
22
  "@ms-cloudpack/path-string-parsing": "^1.2.7",
23
- "@ms-cloudpack/path-utilities": "^3.1.30",
23
+ "@ms-cloudpack/path-utilities": "^3.1.31",
24
24
  "@ms-cloudpack/retry": "^0.1.3",
25
25
  "oribuild": "0.0.0-pre-alpha.15-2025092615-31c2ebe"
26
26
  },