@lingui/cli 5.5.2 → 5.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export declare function buildIncludeDepsFilter(includeDeps: string[]): (id: string) => boolean;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildIncludeDepsFilter = buildIncludeDepsFilter;
4
+ function createPackageRegExp(packageName) {
5
+ return new RegExp("^" + packageName + "(?:\\/.+)?");
6
+ }
7
+ function buildIncludeDepsFilter(includeDeps) {
8
+ const include = includeDeps.map(createPackageRegExp);
9
+ return (id) => include.some((regExp) => regExp.test(id));
10
+ }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.bundleSource = bundleSource;
4
4
  const linguiEsbuildPlugin_1 = require("./linguiEsbuildPlugin");
5
+ const buildIncludeDepsFilter_1 = require("./buildIncludeDepsFilter");
5
6
  function createExtRegExp(extensions) {
6
7
  return new RegExp("\\.(?:" + extensions.join("|") + ")(?:\\?.*)?$");
7
8
  }
@@ -41,10 +42,26 @@ async function bundleSource(linguiConfig, entryPoints, outDir, rootDir) {
41
42
  sourcemap: "inline",
42
43
  sourceRoot: outDir,
43
44
  sourcesContent: false,
44
- packages: "external",
45
45
  metafile: true,
46
46
  plugins: [
47
47
  (0, linguiEsbuildPlugin_1.pluginLinguiMacro)({ linguiConfig }),
48
+ {
49
+ name: "externalize-deps",
50
+ setup(build) {
51
+ const shouldInclude = (0, buildIncludeDepsFilter_1.buildIncludeDepsFilter)(config.includeDeps || []);
52
+ // considers all import paths that "look like" package imports in the original source code to be package imports.
53
+ // Specifically import paths that don't start with a path segment of / or . or .. are considered to be package imports.
54
+ // The only two exceptions to this rule are subpath imports (which start with a # character) and deps specified in the `includeDeps`
55
+ build.onResolve({ filter: /^[^.#/].*/ }, async (args) => {
56
+ if (shouldInclude(args.path)) {
57
+ return { external: false };
58
+ }
59
+ return {
60
+ external: true,
61
+ };
62
+ });
63
+ },
64
+ },
48
65
  {
49
66
  name: "externalize-files",
50
67
  setup(build) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingui/cli",
3
- "version": "5.5.2",
3
+ "version": "5.6.1",
4
4
  "description": "CLI for working wit message catalogs",
5
5
  "keywords": [
6
6
  "cli",
@@ -62,12 +62,12 @@
62
62
  "@babel/parser": "^7.22.0",
63
63
  "@babel/runtime": "^7.21.0",
64
64
  "@babel/types": "^7.21.2",
65
- "@lingui/babel-plugin-extract-messages": "5.5.2",
66
- "@lingui/babel-plugin-lingui-macro": "5.5.2",
67
- "@lingui/conf": "5.5.2",
68
- "@lingui/core": "5.5.2",
69
- "@lingui/format-po": "5.5.2",
70
- "@lingui/message-utils": "5.5.2",
65
+ "@lingui/babel-plugin-extract-messages": "5.6.1",
66
+ "@lingui/babel-plugin-lingui-macro": "5.6.1",
67
+ "@lingui/conf": "5.6.1",
68
+ "@lingui/core": "5.6.1",
69
+ "@lingui/format-po": "5.6.1",
70
+ "@lingui/message-utils": "5.6.1",
71
71
  "chokidar": "3.5.1",
72
72
  "cli-table": "^0.3.11",
73
73
  "commander": "^10.0.0",
@@ -95,5 +95,5 @@
95
95
  "mockdate": "^3.0.5",
96
96
  "ts-node": "^10.9.2"
97
97
  },
98
- "gitHead": "197bcd9ab7eca588ba9436a2d20996f92deb7547"
98
+ "gitHead": "eeab3720888fac544c3410f0148c5b13a0f0acff"
99
99
  }