@adobe/aio-lib-web 6.0.0 → 6.0.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/.eslintrc CHANGED
@@ -4,5 +4,8 @@
4
4
  "globals": {
5
5
  "n": "readonly",
6
6
  "r": "readonly"
7
- }
7
+ },
8
+ "parserOptions": {
9
+ "ecmaVersion": 2018
10
+ }
8
11
  }
@@ -150,7 +150,7 @@ module.exports = class RemoteStorage {
150
150
  // parallel upload
151
151
  return Promise.all(files.map(async f => {
152
152
  // get file's relative folder to the base directory.
153
- var prefixDirectory = path.dirname(path.relative(dir, f))
153
+ let prefixDirectory = path.dirname(path.relative(dir, f))
154
154
  // base directory returns ".", ignore that.
155
155
  prefixDirectory = prefixDirectory === '.' ? '' : prefixDirectory
156
156
  // newPrefix is now the initial prefix plus the files relative directory path.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/aio-lib-web",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "Utility tooling library to build and deploy Adobe I/O Project Firefly app static sites to CDN",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -32,29 +32,30 @@
32
32
  "@adobe/aio-lib-core-config": "^3.0.0",
33
33
  "@adobe/aio-lib-core-logging": "^2.0.0",
34
34
  "@adobe/aio-lib-core-tvm": "^3.0.0",
35
- "aws-sdk": "^2.600.0",
36
- "fs-extra": "^9.0.0",
35
+ "aws-sdk": "^2.1211.0",
36
+ "core-js": "^3.25.1",
37
+ "fs-extra": "^10",
37
38
  "joi": "^17.2.1",
38
- "js-yaml": "^3.13.1",
39
- "klaw": "^3.0.0",
39
+ "klaw": "^4",
40
40
  "lodash.clonedeep": "^4.5.0",
41
41
  "mime-types": "^2.1.24",
42
- "parcel": "2.5.0",
42
+ "parcel": "^2.7.0",
43
43
  "regenerator-runtime": "^0.13.7"
44
44
  },
45
45
  "devDependencies": {
46
- "@types/hapi__joi": "^16.0.2",
47
- "@types/jest": "^25.1.0",
48
- "eslint": "^7",
49
- "eslint-config-standard": "^14.1.0",
46
+ "@types/hapi__joi": "^17",
47
+ "@types/jest": "^29",
48
+ "eslint": "^8",
49
+ "eslint-config-standard": "^17",
50
50
  "eslint-plugin-import": "^2.18.2",
51
- "eslint-plugin-jest": "^23.1.1",
52
- "eslint-plugin-node": "^11.0.0",
53
- "eslint-plugin-promise": "^4.2.1",
54
- "eslint-plugin-standard": "^4.0.1",
55
- "jest": "^27",
51
+ "eslint-plugin-jest": "^27.0.2",
52
+ "eslint-plugin-n": "^15.2.5",
53
+ "eslint-plugin-node": "^11",
54
+ "eslint-plugin-promise": "^6",
55
+ "eslint-plugin-standard": "^5",
56
+ "jest": "^29",
56
57
  "jsdoc-to-markdown": "^7",
57
- "memfs": "^3.0.1",
58
- "node-fetch": "^2.6.1"
58
+ "memfs": "^3.4.7",
59
+ "node-fetch": "^2.6.7"
59
60
  }
60
61
  }
package/src/bundle.js CHANGED
@@ -49,7 +49,7 @@ module.exports = async (entries, dest, options = { shouldOptimize: false }, log
49
49
 
50
50
  // set defaults, but allow override by passed in values
51
51
  const parcelBundleOptions = {
52
- entries: entries,
52
+ entries,
53
53
  defaultConfig: require.resolve('@parcel/config-default'),
54
54
  shouldDisableCache: false,
55
55
  targets: {
@@ -12,7 +12,7 @@ governing permissions and limitations under the License.
12
12
 
13
13
  const AppScripts = require('../index')
14
14
 
15
- describe('AppScripts has expected interface ', () => {
15
+ describe('AppScripts has expected interface', () => {
16
16
  test('exports functions', async () => {
17
17
  expect(AppScripts.buildWeb).toBeDefined()
18
18
  expect(typeof AppScripts.buildWeb).toBe('function')
@@ -19,11 +19,6 @@ process.on('unhandledRejection', error => {
19
19
  throw error
20
20
  })
21
21
 
22
- beforeEach(() => {
23
- // expect every test to have assertions
24
- expect.hasAssertions()
25
- })
26
-
27
22
  const fixturePath = path.join(__dirname, '__fixtures__')
28
23
 
29
24
  // quick normalization to test windows paths
@@ -45,7 +40,7 @@ global.r = p => path.resolve(p)
45
40
  * @returns {object}
46
41
  */
47
42
  function readFilesIntoObjectSync (filePath, toDir) {
48
- const fsReal = require.requireActual('fs')
43
+ const fsReal = jest.requireActual('fs')
49
44
  const flatObj = {}
50
45
 
51
46
  function _readFilesIntoObjectSync (_filePathRec, _toDirRec, first = false) {
@@ -59,7 +54,7 @@ function readFilesIntoObjectSync (filePath, toDir) {
59
54
  }
60
55
  // is dir
61
56
  const files = fsReal.readdirSync(_filePathRec)
62
- files.map(f => {
57
+ files.forEach(f => {
63
58
  const fullPath = path.join(_filePathRec, f)
64
59
  // skip first dir from path
65
60
  _readFilesIntoObjectSync(fullPath, first ? _toDirRec : path.join(_toDirRec, path.basename(_filePathRec)))
@@ -44,7 +44,7 @@ describe('getS3Credentials', () => {
44
44
  test('gets credentials from tvm', async () => {
45
45
  await expect(getS3Credentials({ ow: { namespace: 'ns', auth: 'auth' } }))
46
46
  .resolves.toEqual(fakeReturnedTvmCreds)
47
- expect(mockTVM.init).toBeCalledWith({
47
+ expect(mockTVM.init).toHaveBeenCalledWith({
48
48
  apiUrl: undefined,
49
49
  cacheFile: undefined,
50
50
  ow: { auth: 'auth', namespace: 'ns' }
@@ -54,7 +54,7 @@ describe('getS3Credentials', () => {
54
54
  test('gets credentials from tvm with custom tvmurl', async () => {
55
55
  await expect(getS3Credentials({ ow: { namespace: 'ns', auth: 'auth' }, s3: { tvmUrl: 'custom' } }))
56
56
  .resolves.toEqual(fakeReturnedTvmCreds)
57
- expect(mockTVM.init).toBeCalledWith({
57
+ expect(mockTVM.init).toHaveBeenCalledWith({
58
58
  apiUrl: 'custom',
59
59
  cacheFile: undefined,
60
60
  ow: { auth: 'auth', namespace: 'ns' }
@@ -64,7 +64,7 @@ describe('getS3Credentials', () => {
64
64
  test('gets credentials from tvm with custom credsCacheFile', async () => {
65
65
  await expect(getS3Credentials({ ow: { namespace: 'ns', auth: 'auth' }, s3: { credsCacheFile: 'custom' } }))
66
66
  .resolves.toEqual(fakeReturnedTvmCreds)
67
- expect(mockTVM.init).toBeCalledWith({
67
+ expect(mockTVM.init).toHaveBeenCalledWith({
68
68
  apiUrl: undefined,
69
69
  cacheFile: 'custom',
70
70
  ow: { auth: 'auth', namespace: 'ns' }
@@ -194,31 +194,31 @@ describe('RemoteStorage', () => {
194
194
  expect(cbMock).toHaveBeenCalledTimes(4)
195
195
  })
196
196
 
197
- test('test cachecontrol string for html', async () => {
197
+ test('cachecontrol string for html', async () => {
198
198
  const rs = new RemoteStorage(global.fakeTVMResponse)
199
199
  const response = rs._getCacheControlConfig('text/html', global.fakeConfig.cna)
200
200
  expect(response).toBe('s-maxage=0, max-age=60')
201
201
  })
202
202
 
203
- test('test cachecontrol string for JS', async () => {
203
+ test('cachecontrol string for JS', async () => {
204
204
  const rs = new RemoteStorage(global.fakeTVMResponse)
205
205
  const response = rs._getCacheControlConfig('application/javascript', global.fakeConfig.cna)
206
206
  expect(response).toBe('s-maxage=0, max-age=604800')
207
207
  })
208
208
 
209
- test('test cachecontrol string for CSS', async () => {
209
+ test('cachecontrol string for CSS', async () => {
210
210
  const rs = new RemoteStorage(global.fakeTVMResponse)
211
211
  const response = rs._getCacheControlConfig('text/css', global.fakeConfig.cna)
212
212
  expect(response).toBe('s-maxage=0, max-age=604800')
213
213
  })
214
214
 
215
- test('test cachecontrol string for Image', async () => {
215
+ test('cachecontrol string for Image', async () => {
216
216
  const rs = new RemoteStorage(global.fakeTVMResponse)
217
217
  const response = rs._getCacheControlConfig('image/jpeg', global.fakeConfig.cna)
218
218
  expect(response).toBe('s-maxage=0, max-age=604800')
219
219
  })
220
220
 
221
- test('test cachecontrol string for default', async () => {
221
+ test('cachecontrol string for default', async () => {
222
222
  const rs = new RemoteStorage(global.fakeTVMResponse)
223
223
  const response = rs._getCacheControlConfig('application/pdf', global.fakeConfig.cna)
224
224
  expect(response).toBe('s-maxage=0')