import-in-the-middle 1.12.0 → 1.13.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.
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "1.12.0"
2
+ ".": "1.13.0"
3
3
  }
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.13.0](https://github.com/nodejs/import-in-the-middle/compare/import-in-the-middle-v1.12.0...import-in-the-middle-v1.13.0) (2025-02-06)
4
+
5
+
6
+ ### Features
7
+
8
+ * Support import attributes ([#176](https://github.com/nodejs/import-in-the-middle/issues/176)) ([916af26](https://github.com/nodejs/import-in-the-middle/commit/916af2627e0e8cb6d50a3b54c1a280dc16e20925))
9
+
3
10
  ## [1.12.0](https://github.com/nodejs/import-in-the-middle/compare/import-in-the-middle-v1.11.3...import-in-the-middle-v1.12.0) (2024-12-13)
4
11
 
5
12
 
@@ -1,14 +1,14 @@
1
1
  'use strict'
2
2
 
3
3
  const { Parser } = require('acorn')
4
- const { importAssertions } = require('acorn-import-attributes')
4
+ const { importAttributesOrAssertions } = require('acorn-import-attributes')
5
5
 
6
6
  const acornOpts = {
7
7
  ecmaVersion: 'latest',
8
8
  sourceType: 'module'
9
9
  }
10
10
 
11
- const parser = Parser.extend(importAssertions)
11
+ const parser = Parser.extend(importAttributesOrAssertions)
12
12
 
13
13
  function warn (txt) {
14
14
  process.emitWarning(txt, 'get-esm-exports')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "import-in-the-middle",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "Intercept imports in Node.js",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -56,7 +56,7 @@
56
56
  "vue": "^3.4.31"
57
57
  },
58
58
  "dependencies": {
59
- "acorn": "^8.8.2",
59
+ "acorn": "^8.14.0",
60
60
  "acorn-import-attributes": "^1.9.5",
61
61
  "cjs-module-lexer": "^1.2.2",
62
62
  "module-details-from-path": "^1.0.3"
@@ -2,16 +2,14 @@
2
2
  //
3
3
  // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc.
4
4
 
5
+ import Hook from '../../index.js'
5
6
  import jsonMjs from '../fixtures/json-attributes.mjs'
6
7
  import { strictEqual } from 'assert'
7
8
 
8
- // Acorn does not support import attributes so an error is logged but the import
9
- // still works!
10
- //
11
- // Hook((exports, name) => {
12
- // if (name.match(/json\.mjs/)) {
13
- // exports.default.data += '-dawg'
14
- // }
15
- // })
9
+ Hook((exports, name) => {
10
+ if (name.match(/json-attributes\.mjs/)) {
11
+ exports.default.data += '-dawg'
12
+ }
13
+ })
16
14
 
17
- strictEqual(jsonMjs.data, 'dog')
15
+ strictEqual(jsonMjs.data, 'dog-dawg')