gas-webpack-plugin
Advanced tools
Comparing version 2.4.0 to 2.5.0
@@ -1,7 +0,12 @@ | ||
# [2.4.0](https://github.com/fossamagna/gas-webpack-plugin/compare/v2.3.0...v2.4.0) (2023-04-19) | ||
# [2.5.0](https://github.com/fossamagna/gas-webpack-plugin/compare/v2.4.0...v2.5.0) (2023-04-25) | ||
# [2.4.0](https://github.com/fossamagna/gas-webpack-plugin/compare/v2.3.0...v2.4.0) (2023-04-25) | ||
### Features | ||
* support export named declaration when use autoGlobalExportsFiles ([#795](https://github.com/fossamagna/gas-webpack-plugin/issues/795)) ([83eb97c](https://github.com/fossamagna/gas-webpack-plugin/commit/83eb97ccfa3c4103d5c8ea7c88848ee885cdb760)) | ||
* support export named declaration when use autoGlobalExportsFiles ([#801](https://github.com/fossamagna/gas-webpack-plugin/issues/801)) ([03fe306](https://github.com/fossamagna/gas-webpack-plugin/commit/03fe3069385e9540c967d121c10d65b9e19fd48b)) | ||
@@ -8,0 +13,0 @@ |
17
index.js
@@ -5,3 +5,3 @@ 'use strict'; | ||
const { SourceMapSource, RawSource } = require('webpack-sources'); | ||
const Dependency = require('webpack/lib/Dependency'); | ||
const { RuntimeGlobals, Dependency } = require('webpack'); | ||
const minimatch = require('minimatch'); | ||
@@ -41,7 +41,3 @@ const path = require('path'); | ||
const needGloablObject = compilation.chunkGraph.getChunkModules(chunk) | ||
.filter(module => !!entryFunctions.get(module.rootModule || module)) | ||
.some(module => !!entryFunctions.get(module.rootModule || module).globalAssignments); | ||
const gasify = (needGloablObject ? 'var global = this;\n' : '') + entries + source; | ||
const gasify = entries + source; | ||
compilation.assets[filename] = map | ||
@@ -79,2 +75,4 @@ ? new SourceMapSource(gasify, filename, map) | ||
autoGlobalExports: module.resource && this.autoGlobalExportsFilePatterns.some(file => this.match(module.resource, file)), | ||
exportsIdentifierName: RuntimeGlobals.exports, | ||
globalIdentifierName: RuntimeGlobals.global, | ||
}; | ||
@@ -133,2 +131,9 @@ | ||
}); | ||
compilation.hooks.additionalModuleRuntimeRequirements.tap( | ||
plugin, | ||
(_module, set) => { | ||
set.add(RuntimeGlobals.global); | ||
} | ||
); | ||
}; | ||
@@ -135,0 +140,0 @@ |
{ | ||
"name": "gas-webpack-plugin", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "Webpack Plugin for Google Apps Script", | ||
@@ -8,3 +8,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"gas-entry-generator": "2.3.0", | ||
"gas-entry-generator": "2.5.1", | ||
"minimatch": "^7.4.2", | ||
@@ -17,3 +17,3 @@ "slash": "^3.0.0", | ||
"es3ify-webpack-plugin": "^0.1.0", | ||
"eslint": "8.38.0", | ||
"eslint": "8.39.0", | ||
"memory-fs": "0.5.0", | ||
@@ -20,0 +20,0 @@ "nyc": "15.1.0", |
@@ -48,4 +48,3 @@ const webpack = require("webpack"); | ||
const bundle = mfs.readFileSync(__dirname + '/output/bundle.js', 'utf8'); | ||
const output = `var global = this; | ||
/** | ||
const output = `/** | ||
* Return write arguments. | ||
@@ -62,3 +61,3 @@ */ | ||
t.ok(bundle.replace(/\r\n/g, "\n").startsWith(output), bundle); | ||
t.match(bundle, /.*global\.foo = exports\.foo;.*/); | ||
t.match(bundle, /.*__webpack_require__\.g\.foo = __webpack_exports__\.foo;.*/); | ||
t.end(); | ||
@@ -79,7 +78,7 @@ }); | ||
const bundle = mfs.readFileSync(__dirname + '/output/bundle.js', 'utf8'); | ||
const output = 'var global=this;function echo(){}function plus(){}function minus(){}function foo(){}' | ||
const output = 'function echo(){}function plus(){}function minus(){}function foo(){}' | ||
t.ok(bundle.startsWith(output), bundle); | ||
t.match(bundle, /.*global\.foo=.+\.foo.*/); | ||
t.match(bundle, /.*\.g\.foo=.+\.foo.*/); | ||
t.end(); | ||
}); | ||
}); |
@@ -34,4 +34,3 @@ const webpack = require("webpack"); | ||
const bundle = mfs.readFileSync(__dirname + '/output/bundle.js', 'utf8'); | ||
const output = `var global = this; | ||
function foo() { | ||
const output = `function foo() { | ||
} | ||
@@ -48,3 +47,3 @@ /** | ||
t.ok(bundle.replace(/\r\n/g, "\n").startsWith(output), 'plugin and expected output match:' + bundle); | ||
t.match(bundle, /.*global\.foo = exports\.foo;.*/); | ||
t.match(bundle, /.*__webpack_require__\.g\.foo = __webpack_exports__\.foo;.*/); | ||
t.end(); | ||
@@ -66,3 +65,3 @@ }); | ||
const bundle = mfs.readFileSync(__dirname + '/output/bundle.js', 'utf8'); | ||
const output = 'var global=this;function foo(){}function echo(){}function plus(){}function minus(){}' | ||
const output = 'function foo(){}function echo(){}function plus(){}function minus(){}' | ||
t.ok(bundle.toString().startsWith(output), 'plugin and expected output match'); | ||
@@ -86,4 +85,3 @@ t.match(bundle, /.+\.foo=.+\.foo.*/); | ||
const bundle = mfs.readFileSync(__dirname + '/output/bundle.js', 'utf8'); | ||
const output = `var global = this; | ||
function foo() { | ||
const output = `function foo() { | ||
} | ||
@@ -100,3 +98,3 @@ /** | ||
t.ok(bundle.replace(/\r\n/g, "\n").startsWith(output), 'plugin and expected output match'); | ||
t.match(bundle, /.*global\.foo = exports\.foo;.*/); | ||
t.match(bundle, /.*__webpack_require__\.g\.foo = __webpack_exports__\.foo;.*/); | ||
t.end(); | ||
@@ -119,4 +117,3 @@ }); | ||
const bundle = mfs.readFileSync(__dirname + '/output/bundle.js', 'utf8'); | ||
const output = `var global = this; | ||
function foo() { | ||
const output = `function foo() { | ||
} | ||
@@ -123,0 +120,0 @@ function test() { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
93291
1827
+ Addedgas-entry-generator@2.5.1(transitive)
- Removedgas-entry-generator@2.3.0(transitive)
Updatedgas-entry-generator@2.5.1