@lingui/loader 3.16.1 → 3.17.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.17.1](https://github.com/lingui/js-lingui/compare/v3.17.0...v3.17.1) (2023-02-07)
7
+
8
+ **Note:** Version bump only for package @lingui/loader
9
+
10
+
11
+
12
+
13
+
14
+ # [3.17.0](https://github.com/lingui/js-lingui/compare/v3.16.1...v3.17.0) (2023-02-01)
15
+
16
+ **Note:** Version bump only for package @lingui/loader
17
+
18
+
19
+
20
+
21
+
6
22
  ## [3.16.1](https://github.com/lingui/js-lingui/compare/v3.16.0...v3.16.1) (2023-01-24)
7
23
 
8
24
  **Note:** Version bump only for package @lingui/loader
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017 Tomáš Ehrlich
3
+ Copyright (c) 2017-2022 Tomáš Ehrlich, (c) 2022-2023 Crowdin.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -18,7 +18,7 @@ npm install --save-dev @lingui/loader
18
18
 
19
19
  ## Usage
20
20
 
21
- See the [reference][reference] documenation.
21
+ See the [reference][reference] documentation.
22
22
 
23
23
  ## License
24
24
 
@@ -26,8 +26,8 @@ This package is licensed under [MIT][license] license.
26
26
 
27
27
  [license]: https://github.com/lingui/js-lingui/blob/main/LICENSE
28
28
  [linguijs]: https://github.com/lingui/js-lingui
29
- [documentation]: https://lingui.js.org/
30
- [reference]: https://lingui.js.org/ref/loader.html
29
+ [documentation]: https://lingui.dev
30
+ [reference]: https://lingui.dev/ref/loader
31
31
  [package]: https://www.npmjs.com/package/@lingui/loader
32
32
  [badge-downloads]: https://img.shields.io/npm/dw/@lingui/loader.svg
33
33
  [badge-version]: https://img.shields.io/npm/v/@lingui/loader.svg
package/build/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017 Tomáš Ehrlich
3
+ Copyright (c) 2017-2022 Tomáš Ehrlich, (c) 2022-2023 Crowdin.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/build/index.js CHANGED
@@ -3,18 +3,15 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.remoteLoader = remoteLoader;
7
6
  Object.defineProperty(exports, "default", {
8
7
  enumerable: true,
9
8
  get: function () {
10
9
  return _webpackLoader.default;
11
10
  }
12
11
  });
13
-
12
+ exports.remoteLoader = remoteLoader;
14
13
  var _webpackLoader = _interopRequireDefault(require("./webpackLoader"));
15
-
16
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
15
  function remoteLoader() {
19
16
  console.error(`
20
17
  DEPRECATED: { remoteLoader } from "@lingui/loader"
@@ -4,23 +4,17 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = _default;
7
-
8
7
  var _path = _interopRequireDefault(require("path"));
9
-
10
8
  var _conf = require("@lingui/conf");
11
-
12
9
  var _api = require("@lingui/cli/api");
13
-
14
10
  var _loaderUtils = _interopRequireDefault(require("loader-utils"));
15
-
16
11
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
-
18
12
  // Check if webpack 5
19
- const isWebpack5 = parseInt(require("webpack").version) === 5; // Check if JavascriptParser and JavascriptGenerator exists -> Webpack 4
13
+ const isWebpack5 = parseInt(require("webpack").version) === 5;
20
14
 
15
+ // Check if JavascriptParser and JavascriptGenerator exists -> Webpack 4
21
16
  let JavascriptParser;
22
17
  let JavascriptGenerator;
23
-
24
18
  try {
25
19
  JavascriptParser = require("webpack/lib/Parser");
26
20
  JavascriptGenerator = require("webpack/lib/JavascriptGenerator");
@@ -29,12 +23,9 @@ try {
29
23
  throw error;
30
24
  }
31
25
  }
32
-
33
26
  const requiredType = "javascript/auto";
34
-
35
27
  function _default(source) {
36
28
  const options = _loaderUtils.default.getOptions(this) || {};
37
-
38
29
  if (!isWebpack5 && JavascriptParser && JavascriptGenerator) {
39
30
  // Webpack 4 uses json-loader automatically, which breaks this loader because it
40
31
  // doesn't return JSON, but JS module. This is a temporary workaround before
@@ -44,26 +35,22 @@ function _default(source) {
44
35
  this._module.parser = new JavascriptParser();
45
36
  this._module.generator = new JavascriptGenerator();
46
37
  }
47
-
48
38
  const config = (0, _conf.getConfig)({
49
39
  configPath: options.config,
50
40
  cwd: _path.default.dirname(this.resourcePath)
51
41
  });
52
42
  const EMPTY_EXT = /\.[0-9a-z]+$/.test(this.resourcePath);
53
43
  const JS_EXT = /\.js+$/.test(this.resourcePath);
54
-
55
44
  const catalogRelativePath = _path.default.relative(config.rootDir, this.resourcePath);
56
-
57
45
  if (!EMPTY_EXT || JS_EXT) {
58
46
  const formats = {
59
47
  minimal: ".json",
60
48
  po: ".po",
61
49
  lingui: ".json"
62
- }; // we replace the .js, because webpack appends automatically the .js on imports without extension
63
-
50
+ };
51
+ // we replace the .js, because webpack appends automatically the .js on imports without extension
64
52
  throw new Error(`File extension is mandatory, for ex: import("@lingui/loader!./${catalogRelativePath.replace(".js", formats[config.format])}")`);
65
53
  }
66
-
67
54
  const {
68
55
  locale,
69
56
  catalog
@@ -71,12 +58,13 @@ function _default(source) {
71
58
  const messages = catalog.getTranslations(locale, {
72
59
  fallbackLocales: config.fallbackLocales,
73
60
  sourceLocale: config.sourceLocale
74
- }); // In production we don't want untranslated strings. It's better to use message
61
+ });
62
+
63
+ // In production we don't want untranslated strings. It's better to use message
75
64
  // keys as a last resort.
76
65
  // In development, however, we want to catch missing strings with `missing` parameter
77
66
  // of I18nProvider (React) or setupI18n (core) and therefore we need to get
78
67
  // empty translations if missing.
79
-
80
68
  const strict = process.env.NODE_ENV !== "production";
81
69
  return (0, _api.createCompiledCatalog)(locale, messages, {
82
70
  strict,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingui/loader",
3
- "version": "3.16.1",
3
+ "version": "3.17.1",
4
4
  "description": "webpack loader for lingui message catalogs",
5
5
  "types": "./build/index.d.ts",
6
6
  "main": "./build/index.js",
@@ -35,9 +35,9 @@
35
35
  "build/"
36
36
  ],
37
37
  "dependencies": {
38
- "@babel/runtime": "^7.11.2",
39
- "@lingui/cli": "3.16.1",
40
- "@lingui/conf": "3.16.1",
38
+ "@babel/runtime": "^7.20.13",
39
+ "@lingui/cli": "3.17.1",
40
+ "@lingui/conf": "3.17.1",
41
41
  "loader-utils": "^2.0.0"
42
42
  },
43
43
  "devDependencies": {
@@ -47,5 +47,5 @@
47
47
  "peerDependencies": {
48
48
  "webpack": "^4.0.0 || ^5.0.0"
49
49
  },
50
- "gitHead": "bae762a1ef15d0a4d883bc8c1837603b4e79175e"
50
+ "gitHead": "76ef4e8d1c668578ce2c3829ebf35d22ca5e679c"
51
51
  }