@wordpress/babel-plugin-makepot 4.2.1-next.5df0cd52b7.0 → 4.2.2-next.a55ed9455a.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/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Gutenberg
2
2
 
3
- Copyright 2016-2021 by the contributors
3
+ Copyright 2016-2022 by the contributors
4
4
 
5
5
  **License for Contributions (on and after April 15, 2021)**
6
6
 
package/README.md CHANGED
@@ -23,4 +23,10 @@ npm install @wordpress/babel-plugin-makepot --save-dev
23
23
 
24
24
  **Note**: This package requires Node.js 12.0.0 or later. It is not compatible with older versions.
25
25
 
26
- <br/><br/><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>
26
+ ## Contributing to this package
27
+
28
+ This is an individual package that's part of the Gutenberg project. The project is organized as a monorepo. It's made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to [npm](https://www.npmjs.com/) and used by [WordPress](https://make.wordpress.org/core/) as well as other software projects.
29
+
30
+ To find out more about contributing to this package or Gutenberg as a whole, please read the project's main [contributor guide](https://github.com/WordPress/gutenberg/tree/HEAD/CONTRIBUTING.md).
31
+
32
+ <br /><br /><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>
package/index.js CHANGED
@@ -125,7 +125,7 @@ function getExtractedComment( path, _originalNodeLine ) {
125
125
  const { node, parent, parentPath } = path;
126
126
 
127
127
  // Assign original node line so we can keep track in recursion whether a
128
- // matched comment or parent occurs on the same or previous line
128
+ // matched comment or parent occurs on the same or previous line.
129
129
  if ( ! _originalNodeLine ) {
130
130
  _originalNodeLine = node.loc.start.line;
131
131
  }
@@ -143,13 +143,13 @@ function getExtractedComment( path, _originalNodeLine ) {
143
143
 
144
144
  const match = commentNode.value.match( REGEXP_TRANSLATOR_COMMENT );
145
145
  if ( match ) {
146
- // Extract text from matched translator prefix
146
+ // Extract text from matched translator prefix.
147
147
  comment = match[ 1 ]
148
148
  .split( '\n' )
149
149
  .map( ( text ) => text.trim() )
150
150
  .join( ' ' );
151
151
 
152
- // False return indicates to Lodash to break iteration
152
+ // False return indicates to Lodash to break iteration.
153
153
  return false;
154
154
  }
155
155
  } );
@@ -162,7 +162,7 @@ function getExtractedComment( path, _originalNodeLine ) {
162
162
  return;
163
163
  }
164
164
 
165
- // Only recurse as long as parent node is on the same or previous line
165
+ // Only recurse as long as parent node is on the same or previous line.
166
166
  const { line } = parent.loc.start;
167
167
  if ( line >= _originalNodeLine - 1 && line <= _originalNodeLine ) {
168
168
  return getExtractedComment( parentPath, _originalNodeLine );
@@ -207,7 +207,7 @@ module.exports = () => {
207
207
  CallExpression( path, state ) {
208
208
  const { callee } = path.node;
209
209
 
210
- // Determine function name by direct invocation or property name
210
+ // Determine function name by direct invocation or property name.
211
211
  let name;
212
212
  if ( 'MemberExpression' === callee.type ) {
213
213
  name = callee.property.name;
@@ -215,14 +215,14 @@ module.exports = () => {
215
215
  name = callee.name;
216
216
  }
217
217
 
218
- // Skip unhandled functions
218
+ // Skip unhandled functions.
219
219
  const functionKeys = ( state.opts.functions ||
220
220
  DEFAULT_FUNCTIONS )[ name ];
221
221
  if ( ! functionKeys ) {
222
222
  return;
223
223
  }
224
224
 
225
- // Assign translation keys by argument position
225
+ // Assign translation keys by argument position.
226
226
  const translation = path.node.arguments.reduce(
227
227
  ( memo, arg, i ) => {
228
228
  const key = functionKeys[ i ];
@@ -241,7 +241,7 @@ module.exports = () => {
241
241
  }
242
242
 
243
243
  // At this point we assume we'll save data, so initialize if
244
- // we haven't already
244
+ // we haven't already.
245
245
  if ( ! baseData ) {
246
246
  baseData = {
247
247
  charset: 'utf-8',
@@ -262,7 +262,7 @@ module.exports = () => {
262
262
  );
263
263
  }
264
264
 
265
- // Attempt to exract nplurals from header
265
+ // Attempt to exract nplurals from header.
266
266
  const pluralsMatch = (
267
267
  baseData.headers[ 'plural-forms' ] || ''
268
268
  ).match( /nplurals\s*=\s*(\d+);/ );
@@ -271,7 +271,7 @@ module.exports = () => {
271
271
  }
272
272
  }
273
273
 
274
- // Create empty msgstr or array of empty msgstr by nplurals
274
+ // Create empty msgstr or array of empty msgstr by nplurals.
275
275
  if ( translation.msgid_plural ) {
276
276
  translation.msgstr = Array.from( Array( nplurals ) ).map(
277
277
  () => ''
@@ -281,7 +281,7 @@ module.exports = () => {
281
281
  }
282
282
 
283
283
  // Assign file reference comment, ensuring consistent pathname
284
- // reference between Win32 and POSIX
284
+ // reference between Win32 and POSIX.
285
285
  const { filename } = this.file.opts;
286
286
  const pathname = relative( '.', filename )
287
287
  .split( sep )
@@ -290,13 +290,13 @@ module.exports = () => {
290
290
  reference: pathname + ':' + path.node.loc.start.line,
291
291
  };
292
292
 
293
- // If exists, also assign translator comment
293
+ // If exists, also assign translator comment.
294
294
  const translator = getExtractedComment( path );
295
295
  if ( translator ) {
296
296
  translation.comments.extracted = translator;
297
297
  }
298
298
 
299
- // Create context grouping for translation if not yet exists
299
+ // Create context grouping for translation if not yet exists.
300
300
  const { msgctxt = '', msgid } = translation;
301
301
  if ( ! strings[ filename ].hasOwnProperty( msgctxt ) ) {
302
302
  strings[ filename ][ msgctxt ] = {};
@@ -315,15 +315,15 @@ module.exports = () => {
315
315
  return;
316
316
  }
317
317
 
318
- // Sort translations by filename for deterministic output
318
+ // Sort translations by filename for deterministic output.
319
319
  const files = Object.keys( strings ).sort();
320
320
 
321
- // Combine translations from each file grouped by context
321
+ // Combine translations from each file grouped by context.
322
322
  const translations = reduce(
323
323
  files,
324
324
  ( memo, file ) => {
325
325
  for ( const context in strings[ file ] ) {
326
- // Within the same file, sort translations by line
326
+ // Within the same file, sort translations by line.
327
327
  const sortedTranslations = sortBy(
328
328
  strings[ file ][ context ],
329
329
  'comments.reference'
@@ -342,7 +342,7 @@ module.exports = () => {
342
342
  memo[ msgctxt ] = {};
343
343
  }
344
344
 
345
- // Merge references if translation already exists
345
+ // Merge references if translation already exists.
346
346
  if (
347
347
  isSameTranslation(
348
348
  translation,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/babel-plugin-makepot",
3
- "version": "4.2.1-next.5df0cd52b7.0",
3
+ "version": "4.2.2-next.a55ed9455a.0",
4
4
  "description": "WordPress Babel internationalization (i18n) plugin.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "558d577d12bec15f05e694eb49a094836d885cca"
40
+ "gitHead": "c5108185851b824d531bce55991a3589947e8551"
41
41
  }