@intlayer/webpack 8.2.3 → 8.3.0-canary.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/dist/cjs/getEntries.cjs.map +1 -1
- package/dist/cjs/webpack-plugin.cjs.map +1 -1
- package/dist/cjs/webpack.config.cjs.map +1 -1
- package/dist/esm/getEntries.mjs.map +1 -1
- package/dist/esm/webpack-plugin.mjs.map +1 -1
- package/dist/esm/webpack.config.mjs.map +1 -1
- package/dist/types/getEntries.d.ts +1 -1
- package/dist/types/webpack-plugin.d.ts +1 -1
- package/dist/types/webpack.config.d.ts +1 -1
- package/package.json +15 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEntries.cjs","names":["fg"],"sources":["../../src/getEntries.ts"],"sourcesContent":["import { getPathHash } from '@intlayer/chokidar/utils';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport fg from 'fast-glob';\nimport type { EntryObject } from 'webpack';\n\nexport const getEntries = (configuration: IntlayerConfig) => {\n const { content } = configuration;\n const { watchedFilesPatternWithPath } = content;\n\n const entries = fg.sync(watchedFilesPatternWithPath).reduce((obj, el) => {\n const hash = getPathHash(el);\n\n obj[`intlayer-content/${hash}`] = {\n import: el,\n dependOn: undefined,\n };\n\n return obj;\n }, {} as EntryObject);\n\n return entries;\n};\n"],"mappings":"uMAKA,MAAa,EAAc,GAAkC,CAC3D,GAAM,CAAE,WAAY,EACd,CAAE,+BAAgC,EAaxC,OAXgBA,EAAAA,QAAG,KAAK,EAA4B,CAAC,QAAQ,EAAK,IAAO,CACvE,IAAM,GAAA,EAAA,EAAA,aAAmB,EAAG,CAO5B,MALA,GAAI,oBAAoB,KAAU,CAChC,OAAQ,EACR,SAAU,IAAA,GACX,CAEM,GACN,EAAE,CAAgB"}
|
|
1
|
+
{"version":3,"file":"getEntries.cjs","names":["fg"],"sources":["../../src/getEntries.ts"],"sourcesContent":["import { getPathHash } from '@intlayer/chokidar/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport fg from 'fast-glob';\nimport type { EntryObject } from 'webpack';\n\nexport const getEntries = (configuration: IntlayerConfig) => {\n const { content } = configuration;\n const { watchedFilesPatternWithPath } = content;\n\n const entries = fg.sync(watchedFilesPatternWithPath).reduce((obj, el) => {\n const hash = getPathHash(el);\n\n obj[`intlayer-content/${hash}`] = {\n import: el,\n dependOn: undefined,\n };\n\n return obj;\n }, {} as EntryObject);\n\n return entries;\n};\n"],"mappings":"uMAKA,MAAa,EAAc,GAAkC,CAC3D,GAAM,CAAE,WAAY,EACd,CAAE,+BAAgC,EAaxC,OAXgBA,EAAAA,QAAG,KAAK,EAA4B,CAAC,QAAQ,EAAK,IAAO,CACvE,IAAM,GAAA,EAAA,EAAA,aAAmB,EAAG,CAO5B,MALA,GAAI,oBAAoB,KAAU,CAChC,OAAQ,EACR,SAAU,IAAA,GACX,CAEM,GACN,EAAE,CAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-plugin.cjs","names":[],"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { logger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport type { Compiler } from 'webpack';\n\n// Watch mode or on time build\nexport class IntlayerPlugin {\n private isWatching = false; // Flag to ensure we only start the watcher after the first build\n private configuration;\n\n constructor(configuration: IntlayerConfig) {\n this.configuration = configuration;\n }\n\n async apply(compiler: Compiler): Promise<void> {\n if (this.configuration.content.watch) {\n // Start watching (assuming watch is also async)\n watch({ configuration: this.configuration });\n }\n\n compiler.hooks.beforeCompile.tapPromise('IntlayerPlugin', async () => {\n if (!this.isWatching) {\n try {\n await prepareIntlayer(this.configuration);\n this.isWatching = true;\n } catch (error) {\n logger(`Error in IntlayerPlugin: ${error}`, {\n level: 'error',\n });\n }\n }\n });\n }\n}\n"],"mappings":"sOAOA,IAAa,EAAb,KAA4B,CAC1B,WAAqB,GACrB,cAEA,YAAY,EAA+B,CACzC,KAAK,cAAgB,EAGvB,MAAM,MAAM,EAAmC,CACzC,KAAK,cAAc,QAAQ,QAE7B,EAAA,EAAA,OAAM,CAAE,cAAe,KAAK,cAAe,CAAC,CAG9C,EAAS,MAAM,cAAc,WAAW,iBAAkB,SAAY,CACpE,GAAI,CAAC,KAAK,WACR,GAAI,CACF,MAAA,EAAA,EAAA,iBAAsB,KAAK,cAAc,CACzC,KAAK,WAAa,SACX,EAAO,EACd,EAAA,EAAA,QAAO,4BAA4B,IAAS,CAC1C,MAAO,QACR,CAAC,GAGN"}
|
|
1
|
+
{"version":3,"file":"webpack-plugin.cjs","names":[],"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { logger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Compiler } from 'webpack';\n\n// Watch mode or on time build\nexport class IntlayerPlugin {\n private isWatching = false; // Flag to ensure we only start the watcher after the first build\n private configuration;\n\n constructor(configuration: IntlayerConfig) {\n this.configuration = configuration;\n }\n\n async apply(compiler: Compiler): Promise<void> {\n if (this.configuration.content.watch) {\n // Start watching (assuming watch is also async)\n watch({ configuration: this.configuration });\n }\n\n compiler.hooks.beforeCompile.tapPromise('IntlayerPlugin', async () => {\n if (!this.isWatching) {\n try {\n await prepareIntlayer(this.configuration);\n this.isWatching = true;\n } catch (error) {\n logger(`Error in IntlayerPlugin: ${error}`, {\n level: 'error',\n });\n }\n }\n });\n }\n}\n"],"mappings":"sOAOA,IAAa,EAAb,KAA4B,CAC1B,WAAqB,GACrB,cAEA,YAAY,EAA+B,CACzC,KAAK,cAAgB,EAGvB,MAAM,MAAM,EAAmC,CACzC,KAAK,cAAc,QAAQ,QAE7B,EAAA,EAAA,OAAM,CAAE,cAAe,KAAK,cAAe,CAAC,CAG9C,EAAS,MAAM,cAAc,WAAW,iBAAkB,SAAY,CACpE,GAAI,CAAC,KAAK,WACR,GAAI,CACF,MAAA,EAAA,EAAA,iBAAsB,KAAK,cAAc,CACzC,KAAK,WAAa,SACX,EAAO,EACd,EAAA,EAAA,QAAO,4BAA4B,IAAS,CAC1C,MAAO,QACR,CAAC,GAGN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.config.cjs","names":["getEntries","IntlayerPlugin"],"sources":["../../src/webpack.config.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { IntlayerConfig } from '@intlayer/types';\n// @ts-ignore - Export exists\nimport type { Configuration as WebPackConfiguration } from 'webpack';\nimport type { Configuration as DevServerConfiguration } from 'webpack-dev-server';\nimport { getEntries } from './getEntries';\nimport { defineDirname } from './utils';\nimport { IntlayerPlugin } from './webpack-plugin';\n\n// For web interface\nexport const devServerConfig: DevServerConfiguration = {\n // Enable hot module replacement\n hot: true,\n // Open the browser\n open: false,\n liveReload: false,\n\n // Enable compression\n compress: true,\n\n // History API fallback\n historyApiFallback: false,\n\n // Host and port\n host: 'localhost',\n port: 8080,\n\n watchFiles: './src/', // watchedFilesPatternWithPath,\n\n devMiddleware: {\n // Enable write to disk to reuse the output\n writeToDisk: true,\n },\n\n // Content base\n static: {},\n};\n\nexport const getWebpackConfig = (\n configuration: IntlayerConfig = getConfiguration()\n): WebPackConfiguration => {\n const { fileExtensions } = configuration.content;\n\n /**\n * Set the __dirname global variable to make the config work in both ESM and CJS environments\n */\n defineDirname();\n\n const entries = getEntries(configuration);\n\n const webpackConfig: WebPackConfiguration = {\n // Define the environment mode (development or production)\n mode: 'production', // or 'production'\n // Entry point of the application\n target: 'node', // Specifies the target environment\n\n entry: entries,\n output: {\n clean: true, // Clean the output directory before emit\n library: 'IntlLayerContent',\n libraryTarget: 'umd',\n filename: `[name].bundle.js`,\n },\n\n cache: false,\n\n devtool: 'source-map',\n\n // stats: {\n // preset: 'errors-only',\n // warnings: false,\n // },\n ignoreWarnings: [/./],\n resolve: {\n // Resolve TypeScript, JavaScript and JSON files\n extensions: [\n '.ts',\n '.js',\n '.json',\n '.wasm',\n '.ts',\n '.tsx',\n '.mjs',\n '.cjs',\n ],\n modules: [\n // To find the loader module\n join(globalThis.__dirname, '..', 'node_modules'), // In the project node_modules\n join(process.cwd(), 'node_modules'), // In the project node_modules\n join(process.cwd(), 'node_modules', 'intlayer-cli', 'node_modules'), // Or via another project by importing intlayer\n join(\n process.cwd(),\n 'node_modules',\n 'intlayer-cli',\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing intlayer\n ],\n },\n\n resolveLoader: {\n // Configure how Webpack finds `loader` modules.\n modules: [\n // To find the loader module\n join(process.cwd(), 'node_modules'), // In the project node_modules\n join(\n process.cwd(),\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing @intlayer/webpack\n join(\n process.cwd(),\n 'node_modules',\n 'intlayer-cli',\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing intlayer\n ],\n },\n\n module: {\n rules: [\n {\n // Rule for .content.ts files\n test: new RegExp(`(${fileExtensions.join('|')})$`),\n use: [\n {\n // Transpile with esbuild-loader\n loader: 'esbuild-loader',\n options: {\n // JavaScript version to compile to\n target: 'es2015',\n },\n },\n // {\n // // Custom loader to process the transpiled code\n // loader: resolve('./intlayer-loader'),\n // },\n ],\n },\n {\n test: /\\.node$/,\n loader: 'node-loader',\n },\n // Use esbuild to compile JavaScript & TypeScript\n {\n // Match `.js`, `.jsx`, `.ts` or `.tsx` files\n test: /\\.(jsx|js|ts|tsx|mjs|cjs)?$/,\n loader: 'esbuild-loader',\n options: {\n // JavaScript version to compile to\n target: 'es2015',\n },\n },\n\n // JSON files are supported natively by Webpack 5, no specific loader required\n ],\n },\n devServer: devServerConfig,\n\n plugins: [new IntlayerPlugin(configuration)],\n };\n\n return webpackConfig;\n};\n\nexport default getWebpackConfig;\n"],"mappings":"wSAWA,MAAa,EAA0C,CAErD,IAAK,GAEL,KAAM,GACN,WAAY,GAGZ,SAAU,GAGV,mBAAoB,GAGpB,KAAM,YACN,KAAM,KAEN,WAAY,SAEZ,cAAe,CAEb,YAAa,GACd,CAGD,OAAQ,EAAE,CACX,CAEY,GACX,GAAA,EAAA,EAAA,mBAAkD,GACzB,CACzB,GAAM,CAAE,kBAAmB,EAAc,QA6HzC,OAxHA,EAAA,eAAe,CAI6B,CAE1C,KAAM,aAEN,OAAQ,OAER,MARcA,EAAAA,WAAW,EAAc,CASvC,OAAQ,CACN,MAAO,GACP,QAAS,mBACT,cAAe,MACf,SAAU,mBACX,CAED,MAAO,GAEP,QAAS,aAMT,eAAgB,CAAC,IAAI,CACrB,QAAS,CAEP,WAAY,CACV,MACA,MACA,QACA,QACA,MACA,OACA,OACA,OACD,CACD,QAAS,YAEF,WAAW,UAAW,KAAM,eAAe,YAC3C,QAAQ,KAAK,CAAE,eAAe,YAC9B,QAAQ,KAAK,CAAE,eAAgB,eAAgB,eAAe,YAEjE,QAAQ,KAAK,CACb,eACA,eACA,eACA,oBACA,eACD,CACF,CACF,CAED,cAAe,CAEb,QAAS,YAEF,QAAQ,KAAK,CAAE,eAAe,YAEjC,QAAQ,KAAK,CACb,eACA,oBACA,eACD,YAEC,QAAQ,KAAK,CACb,eACA,eACA,eACA,oBACA,eACD,CACF,CACF,CAED,OAAQ,CACN,MAAO,CACL,CAEE,KAAU,OAAO,IAAI,EAAe,KAAK,IAAI,CAAC,IAAI,CAClD,IAAK,CACH,CAEE,OAAQ,iBACR,QAAS,CAEP,OAAQ,SACT,CACF,CAKF,CACF,CACD,CACE,KAAM,UACN,OAAQ,cACT,CAED,CAEE,KAAM,8BACN,OAAQ,iBACR,QAAS,CAEP,OAAQ,SACT,CACF,CAGF,CACF,CACD,UAAW,EAEX,QAAS,CAAC,IAAIC,EAAAA,eAAe,EAAc,CAAC,CAC7C"}
|
|
1
|
+
{"version":3,"file":"webpack.config.cjs","names":["getEntries","IntlayerPlugin"],"sources":["../../src/webpack.config.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { IntlayerConfig } from '@intlayer/types/config';\n// @ts-ignore - Export exists\nimport type { Configuration as WebPackConfiguration } from 'webpack';\nimport type { Configuration as DevServerConfiguration } from 'webpack-dev-server';\nimport { getEntries } from './getEntries';\nimport { defineDirname } from './utils';\nimport { IntlayerPlugin } from './webpack-plugin';\n\n// For web interface\nexport const devServerConfig: DevServerConfiguration = {\n // Enable hot module replacement\n hot: true,\n // Open the browser\n open: false,\n liveReload: false,\n\n // Enable compression\n compress: true,\n\n // History API fallback\n historyApiFallback: false,\n\n // Host and port\n host: 'localhost',\n port: 8080,\n\n watchFiles: './src/', // watchedFilesPatternWithPath,\n\n devMiddleware: {\n // Enable write to disk to reuse the output\n writeToDisk: true,\n },\n\n // Content base\n static: {},\n};\n\nexport const getWebpackConfig = (\n configuration: IntlayerConfig = getConfiguration()\n): WebPackConfiguration => {\n const { fileExtensions } = configuration.content;\n\n /**\n * Set the __dirname global variable to make the config work in both ESM and CJS environments\n */\n defineDirname();\n\n const entries = getEntries(configuration);\n\n const webpackConfig: WebPackConfiguration = {\n // Define the environment mode (development or production)\n mode: 'production', // or 'production'\n // Entry point of the application\n target: 'node', // Specifies the target environment\n\n entry: entries,\n output: {\n clean: true, // Clean the output directory before emit\n library: 'IntlLayerContent',\n libraryTarget: 'umd',\n filename: `[name].bundle.js`,\n },\n\n cache: false,\n\n devtool: 'source-map',\n\n // stats: {\n // preset: 'errors-only',\n // warnings: false,\n // },\n ignoreWarnings: [/./],\n resolve: {\n // Resolve TypeScript, JavaScript and JSON files\n extensions: [\n '.ts',\n '.js',\n '.json',\n '.wasm',\n '.ts',\n '.tsx',\n '.mjs',\n '.cjs',\n ],\n modules: [\n // To find the loader module\n join(globalThis.__dirname, '..', 'node_modules'), // In the project node_modules\n join(process.cwd(), 'node_modules'), // In the project node_modules\n join(process.cwd(), 'node_modules', 'intlayer-cli', 'node_modules'), // Or via another project by importing intlayer\n join(\n process.cwd(),\n 'node_modules',\n 'intlayer-cli',\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing intlayer\n ],\n },\n\n resolveLoader: {\n // Configure how Webpack finds `loader` modules.\n modules: [\n // To find the loader module\n join(process.cwd(), 'node_modules'), // In the project node_modules\n join(\n process.cwd(),\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing @intlayer/webpack\n join(\n process.cwd(),\n 'node_modules',\n 'intlayer-cli',\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing intlayer\n ],\n },\n\n module: {\n rules: [\n {\n // Rule for .content.ts files\n test: new RegExp(`(${fileExtensions.join('|')})$`),\n use: [\n {\n // Transpile with esbuild-loader\n loader: 'esbuild-loader',\n options: {\n // JavaScript version to compile to\n target: 'es2015',\n },\n },\n // {\n // // Custom loader to process the transpiled code\n // loader: resolve('./intlayer-loader'),\n // },\n ],\n },\n {\n test: /\\.node$/,\n loader: 'node-loader',\n },\n // Use esbuild to compile JavaScript & TypeScript\n {\n // Match `.js`, `.jsx`, `.ts` or `.tsx` files\n test: /\\.(jsx|js|ts|tsx|mjs|cjs)?$/,\n loader: 'esbuild-loader',\n options: {\n // JavaScript version to compile to\n target: 'es2015',\n },\n },\n\n // JSON files are supported natively by Webpack 5, no specific loader required\n ],\n },\n devServer: devServerConfig,\n\n plugins: [new IntlayerPlugin(configuration)],\n };\n\n return webpackConfig;\n};\n\nexport default getWebpackConfig;\n"],"mappings":"wSAWA,MAAa,EAA0C,CAErD,IAAK,GAEL,KAAM,GACN,WAAY,GAGZ,SAAU,GAGV,mBAAoB,GAGpB,KAAM,YACN,KAAM,KAEN,WAAY,SAEZ,cAAe,CAEb,YAAa,GACd,CAGD,OAAQ,EAAE,CACX,CAEY,GACX,GAAA,EAAA,EAAA,mBAAkD,GACzB,CACzB,GAAM,CAAE,kBAAmB,EAAc,QA6HzC,OAxHA,EAAA,eAAe,CAI6B,CAE1C,KAAM,aAEN,OAAQ,OAER,MARcA,EAAAA,WAAW,EAAc,CASvC,OAAQ,CACN,MAAO,GACP,QAAS,mBACT,cAAe,MACf,SAAU,mBACX,CAED,MAAO,GAEP,QAAS,aAMT,eAAgB,CAAC,IAAI,CACrB,QAAS,CAEP,WAAY,CACV,MACA,MACA,QACA,QACA,MACA,OACA,OACA,OACD,CACD,QAAS,YAEF,WAAW,UAAW,KAAM,eAAe,YAC3C,QAAQ,KAAK,CAAE,eAAe,YAC9B,QAAQ,KAAK,CAAE,eAAgB,eAAgB,eAAe,YAEjE,QAAQ,KAAK,CACb,eACA,eACA,eACA,oBACA,eACD,CACF,CACF,CAED,cAAe,CAEb,QAAS,YAEF,QAAQ,KAAK,CAAE,eAAe,YAEjC,QAAQ,KAAK,CACb,eACA,oBACA,eACD,YAEC,QAAQ,KAAK,CACb,eACA,eACA,eACA,oBACA,eACD,CACF,CACF,CAED,OAAQ,CACN,MAAO,CACL,CAEE,KAAU,OAAO,IAAI,EAAe,KAAK,IAAI,CAAC,IAAI,CAClD,IAAK,CACH,CAEE,OAAQ,iBACR,QAAS,CAEP,OAAQ,SACT,CACF,CAKF,CACF,CACD,CACE,KAAM,UACN,OAAQ,cACT,CAED,CAEE,KAAM,8BACN,OAAQ,iBACR,QAAS,CAEP,OAAQ,SACT,CACF,CAGF,CACF,CACD,UAAW,EAEX,QAAS,CAAC,IAAIC,EAAAA,eAAe,EAAc,CAAC,CAC7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEntries.mjs","names":[],"sources":["../../src/getEntries.ts"],"sourcesContent":["import { getPathHash } from '@intlayer/chokidar/utils';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport fg from 'fast-glob';\nimport type { EntryObject } from 'webpack';\n\nexport const getEntries = (configuration: IntlayerConfig) => {\n const { content } = configuration;\n const { watchedFilesPatternWithPath } = content;\n\n const entries = fg.sync(watchedFilesPatternWithPath).reduce((obj, el) => {\n const hash = getPathHash(el);\n\n obj[`intlayer-content/${hash}`] = {\n import: el,\n dependOn: undefined,\n };\n\n return obj;\n }, {} as EntryObject);\n\n return entries;\n};\n"],"mappings":"gFAKA,MAAa,EAAc,GAAkC,CAC3D,GAAM,CAAE,WAAY,EACd,CAAE,+BAAgC,EAaxC,OAXgB,EAAG,KAAK,EAA4B,CAAC,QAAQ,EAAK,IAAO,CACvE,IAAM,EAAO,EAAY,EAAG,CAO5B,MALA,GAAI,oBAAoB,KAAU,CAChC,OAAQ,EACR,SAAU,IAAA,GACX,CAEM,GACN,EAAE,CAAgB"}
|
|
1
|
+
{"version":3,"file":"getEntries.mjs","names":[],"sources":["../../src/getEntries.ts"],"sourcesContent":["import { getPathHash } from '@intlayer/chokidar/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport fg from 'fast-glob';\nimport type { EntryObject } from 'webpack';\n\nexport const getEntries = (configuration: IntlayerConfig) => {\n const { content } = configuration;\n const { watchedFilesPatternWithPath } = content;\n\n const entries = fg.sync(watchedFilesPatternWithPath).reduce((obj, el) => {\n const hash = getPathHash(el);\n\n obj[`intlayer-content/${hash}`] = {\n import: el,\n dependOn: undefined,\n };\n\n return obj;\n }, {} as EntryObject);\n\n return entries;\n};\n"],"mappings":"gFAKA,MAAa,EAAc,GAAkC,CAC3D,GAAM,CAAE,WAAY,EACd,CAAE,+BAAgC,EAaxC,OAXgB,EAAG,KAAK,EAA4B,CAAC,QAAQ,EAAK,IAAO,CACvE,IAAM,EAAO,EAAY,EAAG,CAO5B,MALA,GAAI,oBAAoB,KAAU,CAChC,OAAQ,EACR,SAAU,IAAA,GACX,CAEM,GACN,EAAE,CAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack-plugin.mjs","names":[],"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { logger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types';\nimport type { Compiler } from 'webpack';\n\n// Watch mode or on time build\nexport class IntlayerPlugin {\n private isWatching = false; // Flag to ensure we only start the watcher after the first build\n private configuration;\n\n constructor(configuration: IntlayerConfig) {\n this.configuration = configuration;\n }\n\n async apply(compiler: Compiler): Promise<void> {\n if (this.configuration.content.watch) {\n // Start watching (assuming watch is also async)\n watch({ configuration: this.configuration });\n }\n\n compiler.hooks.beforeCompile.tapPromise('IntlayerPlugin', async () => {\n if (!this.isWatching) {\n try {\n await prepareIntlayer(this.configuration);\n this.isWatching = true;\n } catch (error) {\n logger(`Error in IntlayerPlugin: ${error}`, {\n level: 'error',\n });\n }\n }\n });\n }\n}\n"],"mappings":"+JAOA,IAAa,EAAb,KAA4B,CAC1B,WAAqB,GACrB,cAEA,YAAY,EAA+B,CACzC,KAAK,cAAgB,EAGvB,MAAM,MAAM,EAAmC,CACzC,KAAK,cAAc,QAAQ,OAE7B,EAAM,CAAE,cAAe,KAAK,cAAe,CAAC,CAG9C,EAAS,MAAM,cAAc,WAAW,iBAAkB,SAAY,CACpE,GAAI,CAAC,KAAK,WACR,GAAI,CACF,MAAM,EAAgB,KAAK,cAAc,CACzC,KAAK,WAAa,SACX,EAAO,CACd,EAAO,4BAA4B,IAAS,CAC1C,MAAO,QACR,CAAC,GAGN"}
|
|
1
|
+
{"version":3,"file":"webpack-plugin.mjs","names":[],"sources":["../../src/webpack-plugin.ts"],"sourcesContent":["import { prepareIntlayer } from '@intlayer/chokidar/build';\nimport { watch } from '@intlayer/chokidar/watcher';\nimport { logger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Compiler } from 'webpack';\n\n// Watch mode or on time build\nexport class IntlayerPlugin {\n private isWatching = false; // Flag to ensure we only start the watcher after the first build\n private configuration;\n\n constructor(configuration: IntlayerConfig) {\n this.configuration = configuration;\n }\n\n async apply(compiler: Compiler): Promise<void> {\n if (this.configuration.content.watch) {\n // Start watching (assuming watch is also async)\n watch({ configuration: this.configuration });\n }\n\n compiler.hooks.beforeCompile.tapPromise('IntlayerPlugin', async () => {\n if (!this.isWatching) {\n try {\n await prepareIntlayer(this.configuration);\n this.isWatching = true;\n } catch (error) {\n logger(`Error in IntlayerPlugin: ${error}`, {\n level: 'error',\n });\n }\n }\n });\n }\n}\n"],"mappings":"+JAOA,IAAa,EAAb,KAA4B,CAC1B,WAAqB,GACrB,cAEA,YAAY,EAA+B,CACzC,KAAK,cAAgB,EAGvB,MAAM,MAAM,EAAmC,CACzC,KAAK,cAAc,QAAQ,OAE7B,EAAM,CAAE,cAAe,KAAK,cAAe,CAAC,CAG9C,EAAS,MAAM,cAAc,WAAW,iBAAkB,SAAY,CACpE,GAAI,CAAC,KAAK,WACR,GAAI,CACF,MAAM,EAAgB,KAAK,cAAc,CACzC,KAAK,WAAa,SACX,EAAO,CACd,EAAO,4BAA4B,IAAS,CAC1C,MAAO,QACR,CAAC,GAGN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.config.mjs","names":[],"sources":["../../src/webpack.config.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { IntlayerConfig } from '@intlayer/types';\n// @ts-ignore - Export exists\nimport type { Configuration as WebPackConfiguration } from 'webpack';\nimport type { Configuration as DevServerConfiguration } from 'webpack-dev-server';\nimport { getEntries } from './getEntries';\nimport { defineDirname } from './utils';\nimport { IntlayerPlugin } from './webpack-plugin';\n\n// For web interface\nexport const devServerConfig: DevServerConfiguration = {\n // Enable hot module replacement\n hot: true,\n // Open the browser\n open: false,\n liveReload: false,\n\n // Enable compression\n compress: true,\n\n // History API fallback\n historyApiFallback: false,\n\n // Host and port\n host: 'localhost',\n port: 8080,\n\n watchFiles: './src/', // watchedFilesPatternWithPath,\n\n devMiddleware: {\n // Enable write to disk to reuse the output\n writeToDisk: true,\n },\n\n // Content base\n static: {},\n};\n\nexport const getWebpackConfig = (\n configuration: IntlayerConfig = getConfiguration()\n): WebPackConfiguration => {\n const { fileExtensions } = configuration.content;\n\n /**\n * Set the __dirname global variable to make the config work in both ESM and CJS environments\n */\n defineDirname();\n\n const entries = getEntries(configuration);\n\n const webpackConfig: WebPackConfiguration = {\n // Define the environment mode (development or production)\n mode: 'production', // or 'production'\n // Entry point of the application\n target: 'node', // Specifies the target environment\n\n entry: entries,\n output: {\n clean: true, // Clean the output directory before emit\n library: 'IntlLayerContent',\n libraryTarget: 'umd',\n filename: `[name].bundle.js`,\n },\n\n cache: false,\n\n devtool: 'source-map',\n\n // stats: {\n // preset: 'errors-only',\n // warnings: false,\n // },\n ignoreWarnings: [/./],\n resolve: {\n // Resolve TypeScript, JavaScript and JSON files\n extensions: [\n '.ts',\n '.js',\n '.json',\n '.wasm',\n '.ts',\n '.tsx',\n '.mjs',\n '.cjs',\n ],\n modules: [\n // To find the loader module\n join(globalThis.__dirname, '..', 'node_modules'), // In the project node_modules\n join(process.cwd(), 'node_modules'), // In the project node_modules\n join(process.cwd(), 'node_modules', 'intlayer-cli', 'node_modules'), // Or via another project by importing intlayer\n join(\n process.cwd(),\n 'node_modules',\n 'intlayer-cli',\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing intlayer\n ],\n },\n\n resolveLoader: {\n // Configure how Webpack finds `loader` modules.\n modules: [\n // To find the loader module\n join(process.cwd(), 'node_modules'), // In the project node_modules\n join(\n process.cwd(),\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing @intlayer/webpack\n join(\n process.cwd(),\n 'node_modules',\n 'intlayer-cli',\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing intlayer\n ],\n },\n\n module: {\n rules: [\n {\n // Rule for .content.ts files\n test: new RegExp(`(${fileExtensions.join('|')})$`),\n use: [\n {\n // Transpile with esbuild-loader\n loader: 'esbuild-loader',\n options: {\n // JavaScript version to compile to\n target: 'es2015',\n },\n },\n // {\n // // Custom loader to process the transpiled code\n // loader: resolve('./intlayer-loader'),\n // },\n ],\n },\n {\n test: /\\.node$/,\n loader: 'node-loader',\n },\n // Use esbuild to compile JavaScript & TypeScript\n {\n // Match `.js`, `.jsx`, `.ts` or `.tsx` files\n test: /\\.(jsx|js|ts|tsx|mjs|cjs)?$/,\n loader: 'esbuild-loader',\n options: {\n // JavaScript version to compile to\n target: 'es2015',\n },\n },\n\n // JSON files are supported natively by Webpack 5, no specific loader required\n ],\n },\n devServer: devServerConfig,\n\n plugins: [new IntlayerPlugin(configuration)],\n };\n\n return webpackConfig;\n};\n\nexport default getWebpackConfig;\n"],"mappings":"0OAWA,MAAa,EAA0C,CAErD,IAAK,GAEL,KAAM,GACN,WAAY,GAGZ,SAAU,GAGV,mBAAoB,GAGpB,KAAM,YACN,KAAM,KAEN,WAAY,SAEZ,cAAe,CAEb,YAAa,GACd,CAGD,OAAQ,EAAE,CACX,CAEY,GACX,EAAgC,GAAkB,GACzB,CACzB,GAAM,CAAE,kBAAmB,EAAc,QA6HzC,OAxHA,GAAe,CAI6B,CAE1C,KAAM,aAEN,OAAQ,OAER,MARc,EAAW,EAAc,CASvC,OAAQ,CACN,MAAO,GACP,QAAS,mBACT,cAAe,MACf,SAAU,mBACX,CAED,MAAO,GAEP,QAAS,aAMT,eAAgB,CAAC,IAAI,CACrB,QAAS,CAEP,WAAY,CACV,MACA,MACA,QACA,QACA,MACA,OACA,OACA,OACD,CACD,QAAS,CAEP,EAAK,WAAW,UAAW,KAAM,eAAe,CAChD,EAAK,QAAQ,KAAK,CAAE,eAAe,CACnC,EAAK,QAAQ,KAAK,CAAE,eAAgB,eAAgB,eAAe,CACnE,EACE,QAAQ,KAAK,CACb,eACA,eACA,eACA,oBACA,eACD,CACF,CACF,CAED,cAAe,CAEb,QAAS,CAEP,EAAK,QAAQ,KAAK,CAAE,eAAe,CACnC,EACE,QAAQ,KAAK,CACb,eACA,oBACA,eACD,CACD,EACE,QAAQ,KAAK,CACb,eACA,eACA,eACA,oBACA,eACD,CACF,CACF,CAED,OAAQ,CACN,MAAO,CACL,CAEE,KAAU,OAAO,IAAI,EAAe,KAAK,IAAI,CAAC,IAAI,CAClD,IAAK,CACH,CAEE,OAAQ,iBACR,QAAS,CAEP,OAAQ,SACT,CACF,CAKF,CACF,CACD,CACE,KAAM,UACN,OAAQ,cACT,CAED,CAEE,KAAM,8BACN,OAAQ,iBACR,QAAS,CAEP,OAAQ,SACT,CACF,CAGF,CACF,CACD,UAAW,EAEX,QAAS,CAAC,IAAI,EAAe,EAAc,CAAC,CAC7C"}
|
|
1
|
+
{"version":3,"file":"webpack.config.mjs","names":[],"sources":["../../src/webpack.config.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { IntlayerConfig } from '@intlayer/types/config';\n// @ts-ignore - Export exists\nimport type { Configuration as WebPackConfiguration } from 'webpack';\nimport type { Configuration as DevServerConfiguration } from 'webpack-dev-server';\nimport { getEntries } from './getEntries';\nimport { defineDirname } from './utils';\nimport { IntlayerPlugin } from './webpack-plugin';\n\n// For web interface\nexport const devServerConfig: DevServerConfiguration = {\n // Enable hot module replacement\n hot: true,\n // Open the browser\n open: false,\n liveReload: false,\n\n // Enable compression\n compress: true,\n\n // History API fallback\n historyApiFallback: false,\n\n // Host and port\n host: 'localhost',\n port: 8080,\n\n watchFiles: './src/', // watchedFilesPatternWithPath,\n\n devMiddleware: {\n // Enable write to disk to reuse the output\n writeToDisk: true,\n },\n\n // Content base\n static: {},\n};\n\nexport const getWebpackConfig = (\n configuration: IntlayerConfig = getConfiguration()\n): WebPackConfiguration => {\n const { fileExtensions } = configuration.content;\n\n /**\n * Set the __dirname global variable to make the config work in both ESM and CJS environments\n */\n defineDirname();\n\n const entries = getEntries(configuration);\n\n const webpackConfig: WebPackConfiguration = {\n // Define the environment mode (development or production)\n mode: 'production', // or 'production'\n // Entry point of the application\n target: 'node', // Specifies the target environment\n\n entry: entries,\n output: {\n clean: true, // Clean the output directory before emit\n library: 'IntlLayerContent',\n libraryTarget: 'umd',\n filename: `[name].bundle.js`,\n },\n\n cache: false,\n\n devtool: 'source-map',\n\n // stats: {\n // preset: 'errors-only',\n // warnings: false,\n // },\n ignoreWarnings: [/./],\n resolve: {\n // Resolve TypeScript, JavaScript and JSON files\n extensions: [\n '.ts',\n '.js',\n '.json',\n '.wasm',\n '.ts',\n '.tsx',\n '.mjs',\n '.cjs',\n ],\n modules: [\n // To find the loader module\n join(globalThis.__dirname, '..', 'node_modules'), // In the project node_modules\n join(process.cwd(), 'node_modules'), // In the project node_modules\n join(process.cwd(), 'node_modules', 'intlayer-cli', 'node_modules'), // Or via another project by importing intlayer\n join(\n process.cwd(),\n 'node_modules',\n 'intlayer-cli',\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing intlayer\n ],\n },\n\n resolveLoader: {\n // Configure how Webpack finds `loader` modules.\n modules: [\n // To find the loader module\n join(process.cwd(), 'node_modules'), // In the project node_modules\n join(\n process.cwd(),\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing @intlayer/webpack\n join(\n process.cwd(),\n 'node_modules',\n 'intlayer-cli',\n 'node_modules',\n '@intlayer/webpack',\n 'node_modules'\n ), // Or via another project by importing intlayer\n ],\n },\n\n module: {\n rules: [\n {\n // Rule for .content.ts files\n test: new RegExp(`(${fileExtensions.join('|')})$`),\n use: [\n {\n // Transpile with esbuild-loader\n loader: 'esbuild-loader',\n options: {\n // JavaScript version to compile to\n target: 'es2015',\n },\n },\n // {\n // // Custom loader to process the transpiled code\n // loader: resolve('./intlayer-loader'),\n // },\n ],\n },\n {\n test: /\\.node$/,\n loader: 'node-loader',\n },\n // Use esbuild to compile JavaScript & TypeScript\n {\n // Match `.js`, `.jsx`, `.ts` or `.tsx` files\n test: /\\.(jsx|js|ts|tsx|mjs|cjs)?$/,\n loader: 'esbuild-loader',\n options: {\n // JavaScript version to compile to\n target: 'es2015',\n },\n },\n\n // JSON files are supported natively by Webpack 5, no specific loader required\n ],\n },\n devServer: devServerConfig,\n\n plugins: [new IntlayerPlugin(configuration)],\n };\n\n return webpackConfig;\n};\n\nexport default getWebpackConfig;\n"],"mappings":"0OAWA,MAAa,EAA0C,CAErD,IAAK,GAEL,KAAM,GACN,WAAY,GAGZ,SAAU,GAGV,mBAAoB,GAGpB,KAAM,YACN,KAAM,KAEN,WAAY,SAEZ,cAAe,CAEb,YAAa,GACd,CAGD,OAAQ,EAAE,CACX,CAEY,GACX,EAAgC,GAAkB,GACzB,CACzB,GAAM,CAAE,kBAAmB,EAAc,QA6HzC,OAxHA,GAAe,CAI6B,CAE1C,KAAM,aAEN,OAAQ,OAER,MARc,EAAW,EAAc,CASvC,OAAQ,CACN,MAAO,GACP,QAAS,mBACT,cAAe,MACf,SAAU,mBACX,CAED,MAAO,GAEP,QAAS,aAMT,eAAgB,CAAC,IAAI,CACrB,QAAS,CAEP,WAAY,CACV,MACA,MACA,QACA,QACA,MACA,OACA,OACA,OACD,CACD,QAAS,CAEP,EAAK,WAAW,UAAW,KAAM,eAAe,CAChD,EAAK,QAAQ,KAAK,CAAE,eAAe,CACnC,EAAK,QAAQ,KAAK,CAAE,eAAgB,eAAgB,eAAe,CACnE,EACE,QAAQ,KAAK,CACb,eACA,eACA,eACA,oBACA,eACD,CACF,CACF,CAED,cAAe,CAEb,QAAS,CAEP,EAAK,QAAQ,KAAK,CAAE,eAAe,CACnC,EACE,QAAQ,KAAK,CACb,eACA,oBACA,eACD,CACD,EACE,QAAQ,KAAK,CACb,eACA,eACA,eACA,oBACA,eACD,CACF,CACF,CAED,OAAQ,CACN,MAAO,CACL,CAEE,KAAU,OAAO,IAAI,EAAe,KAAK,IAAI,CAAC,IAAI,CAClD,IAAK,CACH,CAEE,OAAQ,iBACR,QAAS,CAEP,OAAQ,SACT,CACF,CAKF,CACF,CACD,CACE,KAAM,UACN,OAAQ,cACT,CAED,CAEE,KAAM,8BACN,OAAQ,iBACR,QAAS,CAEP,OAAQ,SACT,CACF,CAGF,CACF,CACD,UAAW,EAEX,QAAS,CAAC,IAAI,EAAe,EAAc,CAAC,CAC7C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/webpack",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.0-canary.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Webpack plugin for seamless integration with Intlayer, enhancing JavaScript apps built with React, Next.js and more.",
|
|
6
6
|
"keywords": [
|
|
@@ -57,29 +57,29 @@
|
|
|
57
57
|
"./package.json"
|
|
58
58
|
],
|
|
59
59
|
"scripts": {
|
|
60
|
-
"build": "tsdown --config tsdown.config.ts",
|
|
61
|
-
"build:ci": "tsdown --config tsdown.config.ts",
|
|
62
|
-
"clean": "rimraf ./dist .turbo",
|
|
63
|
-
"dev": "tsdown --config tsdown.config.ts --watch",
|
|
64
|
-
"format": "biome format . --check",
|
|
65
|
-
"format:fix": "biome format --write .",
|
|
66
|
-
"lint": "biome lint .",
|
|
67
|
-
"lint:fix": "biome lint --write .",
|
|
60
|
+
"build": "bun --bun tsdown --config tsdown.config.ts",
|
|
61
|
+
"build:ci": "bun --bun tsdown --config tsdown.config.ts",
|
|
62
|
+
"clean": "bun --bun rimraf ./dist .turbo",
|
|
63
|
+
"dev": "bun --bun tsdown --config tsdown.config.ts --watch",
|
|
64
|
+
"format": "bun --bun biome format . --check",
|
|
65
|
+
"format:fix": "bun --bun biome format --write .",
|
|
66
|
+
"lint": "bun --bun biome lint .",
|
|
67
|
+
"lint:fix": "bun --bun biome lint --write .",
|
|
68
68
|
"prepublish": "cp -f ../../../README.md ./README.md",
|
|
69
69
|
"publish": "bun publish || true",
|
|
70
70
|
"publish:canary": "bun publish --access public --tag canary || true",
|
|
71
71
|
"publish:latest": "bun publish --access public --tag latest || true",
|
|
72
72
|
"serve": "webpack serve --config ./webpack.config.ts",
|
|
73
|
-
"test": "vitest run",
|
|
74
|
-
"test:watch": "vitest",
|
|
73
|
+
"test": "bun --bun vitest run",
|
|
74
|
+
"test:watch": "bun --bun vitest",
|
|
75
75
|
"transpile": "webpack --config ./webpack.config.ts",
|
|
76
76
|
"typecheck": "tsc --noEmit --project tsconfig.types.json",
|
|
77
77
|
"watch": "webpack --config ./webpack.config.ts --watch"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"@intlayer/chokidar": "8.
|
|
81
|
-
"@intlayer/config": "8.
|
|
82
|
-
"@intlayer/types": "8.
|
|
80
|
+
"@intlayer/chokidar": "8.3.0-canary.0",
|
|
81
|
+
"@intlayer/config": "8.3.0-canary.0",
|
|
82
|
+
"@intlayer/types": "8.3.0-canary.0",
|
|
83
83
|
"fast-glob": "3.3.3",
|
|
84
84
|
"webpack": "5.104.1",
|
|
85
85
|
"webpack-dev-server": "5.2.2"
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"@utils/ts-config-types": "1.0.4",
|
|
91
91
|
"@utils/tsdown-config": "1.0.4",
|
|
92
92
|
"rimraf": "6.1.3",
|
|
93
|
-
"tsdown": "0.21.
|
|
93
|
+
"tsdown": "0.21.1",
|
|
94
94
|
"typescript": "5.9.3",
|
|
95
95
|
"vitest": "4.0.18"
|
|
96
96
|
},
|