Giter Club home page Giter Club logo

assets-retry's Introduction

English | 简体中文

Auto Assets Retry

styled with prettier Build Status

A tiny non-intrusive library to retry your assets (scripts, stylesheets, images) when they failed to load, only 3 KB gzipped, even works with dynamic import!

Demo GIF

Table of Contents

Installation

Install with npm

$ npm install assets-retry --save

Then, inject the library at the beginning of the page with proper webpack configurations. See example

Use inline script directly

If you don't want to spend your time fiddling around with webpack configurations, you can inline the minified file with a script tag, and place it at the beginning of the page.

Usage

All you have to provide is the domain parameter, which are the domains to retry when assets failed to load.

// information of assets
var assetsRetryStatistics = window.assetsRetry({
    // domain list, only resources in the domain list will be retried.
    domain: ['your.first.domain', 'your.second.domain/namespace'],
    // maximum retry count for each asset, default is 3
    maxRetryCount: 3,
    // onRetry hook is how you can customize retry logic with, default is x => x
    onRetry: function(currentUrl, originalUrl, statistics) {
        return currentUrl
    },
    // for a given resource (except background-images in css),
    // either onSuccess or onFail will be eventually called to
    // indicate whether the resource has been successfully loaded
    onSuccess: function(currentUrl) {
        console.log(currentUrl, assetsRetryStatistics[currentUrl])
    },
    onFail: function(currentUrl) {
        console.log(currentUrl, assetsRetryStatistics[currentUrl])
    }
})

When the initialization is finished, following content gains the power of retrying automatically.

  • All <script> tag in html
  • All <link rel="stylesheet"> tag in html (properly configured)
  • All <img> tag in html
  • All dynamic script element created with document.createElement, such as dynamic import.
  • All background-image in css

Config

The assetsRetry function takes an AssetsRetryOptions, which is defined as follows:

interface AssetsRetryOptions {
    maxRetryCount: number
    onRetry: RetryFunction
    onSuccess: SuccessFunction
    onFail: FailFunction
    domain: Domain
}
type RetryFunction = (
    currentUrl: string,
    originalUrl: string,
    retryCollector: null | RetryStatistics
) => string | null
interface RetryStatistics {
    retryTimes: number
    succeeded: string[]
    failed: string[]
}
type SuccessFunction = (currentUrl: string) => void
type FailFunction = (currentUrl: string) => void
type Domain = string[] | { [x: string]: string }
  • domain: domain list, can be array or object type
    • array type: assets will be retried from each domain in sequence, until it's loaded successfully or exceed maximum retry times.
    • object type: { 'a.cdn': 'b.cdn', 'c.cdn': 'd.cdn' } means failed assets from a.cdn should be retried from b.cdn, failed assets from c.cdn should be retried from d.cdn
  • maxRetryCount: maximum retry count for each asset, default is 3
  • onRetry: hook function which was called before trying to load any assets
    • the function takes 3 parameters:
      • currentUrl: next url to try
      • originalUrl: last failed url
      • retryCollector: information collector for current asset, if the asset was from url() function defined in your stylesheets, it will be null. When it's not null, it's an object with following properties:
        • retryTimes: current retry times (starts from 1)
        • failed: failed assets list(may be duplicated when retrying from the same domain multiple times)
        • succeeded: succeeded assets list
    • the function must return a String or null:
      • when null was returned, current retry will be terminated.
      • when string was returned, current retry url will be the return value.
  • onSuccess: hook function which was called when asset has loaded
    • currentUrl: return the asset name which you can use to get statistics from information collector
  • onFail: hook function which was called when asset failed to load
    • currentUrl: return the asset name which you can use to get statistics from information collector

FAQ

  1. Q: Stylesheets or background images are not retried from backup domain, why?

    A: Due to security policies of browsers, access to cssRules is not allowed for cross origin stylesheets by default. To fix this:

    1. Add crossorigin="anonymous" attribute on link element for cross origin stylesheets.
    2. Make sure that Access-Control-Allow-Origin HTTP Header is correct.

Browser Support

Chrome logo Edge logo Firefox logo Internet Explorer logo Opera logo Safari logo ios logo android logo
47+ ✔ 15+ ✔ 32+ ✔ 10+ ✔ 34+ ✔ 10+ ✔ 10+ ✔ 4.4+ ✔

NPM scripts

  • npm t: Run test suite
  • npm start: Run npm run build in watch mode
  • npm run test:watch: Run test suite in interactive watch mode
  • npm run test:prod: Run linting and generate coverage
  • npm run build: Generate bundles and typings, create docs
  • npm run lint: Lints code
  • npm run commit: Commit using conventional commit style (husky will tell you to use it if you haven't 😉)

Acknowledgement

RealWorldBrowserStack

  1. The example projects are based on amazing RealWorld demo apps.
  2. Cross browser testing are based on the rather excellent BrowserStack UI testing technology.

assets-retry's People

Contributors

dependabot[bot] avatar greenkeeper[bot] avatar nikaple avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

assets-retry's Issues

dist文件中,带上了sourcemap

rt,带上了soucemap,但是目录是相对路径的。webpack无法直接识别,会一直报错

sourceMappingURL=assets-retry.umd.js.map

need to support retries that ignore specified resources

When using this library, I had a problem: I already had retry logic for some of the resources, such as the important js resources, how I avoid retrying these resources, I don't know the exact url of these resources, using the following function is not a good idea:

// onRetry hook is how you can customize retry logic with, default is x => x
onRetry: function(currentUrl, originalUrl, statistics) {
// Here is a judgment. It seems unfriendly to my situation
if(currentUrl.indexOf('xxx') > -1){
return null;
}
return currentUrl
},

I am thinking add a custom attribute to the html tag to control retry,e.g. when creating html tags, add an attribute data-assets-retry-ignore to <script> tag, then the resources with the special attribute will not retry to load by this library, even if it fails. I am looking forward to the library support retries that ignore certain specified resources.

Thanks~

An in-range update of @types/node is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye 👋 and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The devDependency @types/node was updated from 13.9.2 to 13.9.3.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of lint-staged is breaking the build 🚨

The devDependency lint-staged was updated from 10.0.7 to 10.0.8.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

lint-staged is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v10.0.8

10.0.8 (2020-02-25)

Bug Fixes

  • do not drop backup stash when reverting to original state fails (f589336)
  • evaluate functional configuration only once (abe4b92)
Commits

The new version differs by 3 commits.

  • b3c2ffd Merge pull request #798 from okonet/fixes
  • f589336 fix: do not drop backup stash when reverting to original state fails
  • abe4b92 fix: evaluate functional configuration only once

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

加载下一个资源时如何重置使用的 domain?

I'm submitting a...


[ ] Regression 
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request

Current behavior

当上一个资源重试后,会永久性的改变使用的 domain,导致下一个资源也是使用该 domain.

image

Expected behavior

每次加载新的资源都重置使用的 domain,从第一个 domain 开始加载,不然可能 cdn 只是少了一个文件,导致后面的资源都用不了该 cdn 地址。

What is the motivation / use case for changing the behavior?

可能 cdn 只是少了一个文件,导致后面的资源都用不了该 cdn 地址。

Environment


Assets-retry version: 0.3.2

js重载顺序问题

下面这里不是很明白,如下script的的写法执行顺序是串行同步的,app.js 加载出错的情况下,vendor已经是加载完了,而且,document.createElement 只是创建一个script标签而已,在还是loading的状态下,依旧这样处理会有什么问题?

image

image

[Bug] js和css资源使用了preload预加载特性的时候,无法正常retry

I'm submitting a...


[ ] Regression 
[✅] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request

Current behavior

当js链接使用link标签进行preload预加载后,只retry了预加载的link标签,而对同一个url的js的script标签没有进行retry,导致js没有重试执行
css链接同样的问题

Expected behavior

不仅preload的资源retry,同一个url的script或者style标签也能正确retry

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Environment


Assets-retry version: 0.3.4

 
For Tooling issues:
- Browser version: Google Chrome Version 112.0.5615.137 (Official Build) (arm64)
- Platform:   Mac M1

Others:

An in-range update of rollup is breaking the build 🚨

The devDependency rollup was updated from 1.31.0 to 1.31.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

rollup is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v1.31.1

2020-02-14

Bug Fixes

  • Make sure errored files are always re-evaluated in watch mode to avoid an issue in the typescript plugin (#3388)

Pull Requests

Commits

The new version differs by 6 commits.

  • 6f28151 1.31.1
  • 4ed7091 Update changelog
  • 305363a Run transform hooks again in watch mode on files that errored (#3388)
  • f3d3cd8 Update changelog
  • bc52fbb Adjust bug template to mention REPL.it (#3371)
  • 7c0417f docs: correct spelling minifaction to minification (#3366)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

support inline style tags

add support images defined in inline style tags

<style>
	.img {
		background-image: url('//your.cdn/path/to/image')
	}
</style>

about defer

Hello I wanna know is this lib can confirm the scripts with defer attribute will works the same as browser default behavior ?

  • origin with order
  1. cdn1/a.js (200)
  2. cdn1/b.js (403)
  3. cdn1/c.js (200)
  • expected browser excecution order
  1. cdn1/a.js (200)
  2. cdn1/b.js (403) -> 3. cdn2.b.js
  3. cdn1/c.js (200)

An in-range update of lint-staged is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye 👋 and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The devDependency lint-staged was updated from 10.0.8 to 10.0.9.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

lint-staged is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v10.0.9

10.0.9 (2020-03-24)

Bug Fixes

  • use path.join and normalize to improve msys compatibility in resolveGitRepo (1ad263a)
Commits

The new version differs by 1 commits.

  • 1ad263a fix: use path.join and normalize to improve msys compatibility in resolveGitRepo

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

createHookedElement 为什么返回了一个代理对象,而不是在源对象上代理方法

请问下,在 retry-async 中的 createHookedElement 是返回了一个新构造的代理对象 $hookedElement:
image
为此,还需要 hack Node 和 Element (hookPrototype) 来识别新的对象;

另一种做法是在源对象上代理 onload,onerror 和 addEventListener,这样似乎就不需要 hack Node 和 Element 了。

采用返回新对象的方式有什么特别的考虑吗?

hookPrototype 作用是啥?

image

没太懂这里的方式是做啥?

hookCreateElement(opts) 已经修改了document.createElement的方法,出错的时候就可以重试了呀。

下面这两个方法是在干嘛?

 target[key] = function(): any {
            const args = [].slice.call(arguments).map((item: any) => {
                if (!item) return item;
                return hasOwn.call(item, innerScriptProp) ? item[innerScriptProp] : item
            })
            return originalFunc.apply(this, args)
        }
        // keep original toString
        if (/^\w+$/.test(key)) {
            target[key].toString = new Function(`return 'function ${key}() { [native code] }'`)
        }

An in-range update of @typescript-eslint/eslint-plugin-tslint is breaking the build 🚨

The devDependency @typescript-eslint/eslint-plugin-tslint was updated from 2.18.0 to 2.19.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@typescript-eslint/eslint-plugin-tslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v2.19.0

2.19.0 (2020-02-03)

Bug Fixes

  • eslint-plugin: [embt] fix allowTypedFunctionExpressions (#1553) (9e7d161)
  • eslint-plugin: [require-await] improve performance (#1536) (45ae0b9)
  • typescript-estree: fix regression introduced in #1525 (#1543) (bec4572)
  • typescript-estree: persisted parse and module none (#1516) (7c70323)

Features

  • eslint-plugin: [no-extra-non-null-assert] add fixer (#1468) (54201ab)
  • eslint-plugin: [no-float-prom] fixer + msg for ignoreVoid (#1473) (159b16e)
  • eslint-plugin: [unbound-method] support bound builtins (#1526) (0a110eb)
  • eslint-plugin: add extension [no-dupe-class-members] (#1492) (b22424e)
  • eslint-plugin: add no-unnecessary-boolean-literal-compare (#242) (6bebb1d)
  • eslint-plugin: add switch-exhaustiveness-check rule (#972) (9e0f6dd)
  • eslint-plugin: support negative matches for filter (#1517) (b24fbe8)
Commits

The new version differs by 17 commits.

  • bec59ff chore: publish v2.19.0
  • 0a110eb feat(eslint-plugin): [unbound-method] support bound builtins (#1526)
  • 9e0f6dd feat(eslint-plugin): add switch-exhaustiveness-check rule (#972)
  • 7c70323 fix(typescript-estree): persisted parse and module none (#1516)
  • 159b16e feat(eslint-plugin): [no-float-prom] fixer + msg for ignoreVoid (#1473)
  • b22424e feat(eslint-plugin): add extension [no-dupe-class-members] (#1492)
  • 9e7d161 fix(eslint-plugin): [embt] fix allowTypedFunctionExpressions (#1553)
  • 45ae0b9 fix(eslint-plugin): [require-await] improve performance (#1536)
  • 39929b2 test(typescript-estree): fix issue in jest config (#1559)
  • 95174d5 docs(eslint-plugin): corrected typo unbounded-method (#1558)
  • 8643d56 chore(eslint-plugin): remove redundant code and update tests (#1557)
  • 569259e test: enable isolatedModules for tests (#1546)
  • b24fbe8 feat(eslint-plugin): support negative matches for filter (#1517)
  • 6613fad test: update jest and babel dependencies (#1530)
  • 54201ab feat(eslint-plugin): [no-extra-non-null-assert] add fixer (#1468)

There are 17 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of cross-env is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye 👋 and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The devDependency cross-env was updated from 7.0.1 to 7.0.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

cross-env is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v7.0.2

7.0.2 (2020-03-05)

Reverts

Commits

The new version differs by 1 commits.

  • 2a1f44c Revert "fix: signal handling (#227)"

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of typedoc is breaking the build 🚨

The devDependency typedoc was updated from 0.15.3 to 0.15.4.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

typedoc is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v0.15.4 - Incremental builds + Computed names

Fixed 🐛

  • #1140 - Ignore tsBuildInfoFile compiler option

Feature ✨

  • #1039 - Improve output for computed property names

Thanks 👏

Commits

The new version differs by 4 commits.

  • 637b51f v0.15.4
  • 3ec2e66 Add tests for computed property names
  • caae509 Improve output for computed property names
  • 60b49a8 Ignore tsBuildInfoFile TypeScript compiler option

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

异步脚本加载超时没有重试

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request

Current behavior

异步脚本加载超时没有触发重试机制。
image

Expected behavior

当异步脚本加载超时也能触发重试机制。

Minimal reproduction of the problem with instructions

使用 whistle 延迟脚本加载时长。

xxx reqDelay://180000

FYI: https://wproxy.org/whistle/rules/reqDelay.html

What is the motivation / use case for changing the behavior?

Environment


Assets-retry version: 0.3.3

 
For Tooling issues:
- Browser version: Chrome 105.0.5195.125
- Platform:  Mac

Others:

An in-range update of @typescript-eslint/parser is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye 👋 and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The devDependency @typescript-eslint/parser was updated from 2.24.0 to 2.25.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@typescript-eslint/parser is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v2.25.0

2.25.0 (2020-03-23)

Bug Fixes

Features

  • eslint-plugin: [no-unnec-type-assertion] allow const assertions (#1741) (f76a1b3)
  • eslint-plugin: [no-unnecessary-condition] ignore basic array indexing false positives (#1534) (2b9603d)
  • eslint-plugin: add class-literal-property-style rule (#1582) (b2dbd89)
  • experimental-utils: expose ast utility functions (#1670) (3eb5d45)
Commits

The new version differs by 19 commits.

  • 9cd3e4f chore: publish v2.25.0
  • b2dbd89 feat(eslint-plugin): add class-literal-property-style rule (#1582)
  • 3eb5d45 feat(experimental-utils): expose ast utility functions (#1670)
  • 2b9603d feat(eslint-plugin): [no-unnecessary-condition] ignore basic array indexing false positives (#1534)
  • c82d121 chore(typescript-estree): remove unfinished comment (#1770)
  • 199863d fix(eslint-plugin): [quotes] false positive with backtick in import equals statement (#1769)
  • 6646959 fix(eslint-plugin): fix message of no-base-to-string (#1755)
  • f76a1b3 feat(eslint-plugin): [no-unnec-type-assertion] allow const assertions (#1741)
  • 09d8afc fix(typescript-estree): export * regression from 133f622f (#1751)
  • 52b061e chore: try fetching all tags and history in canary job
  • 19cc9a9 chore: try fetching all tags and history in canary job
  • 61a779c chore: try fetching all history in canary job
  • d6e273d chore: standardise issue templates (#1760)
  • abf1a2f fix(eslint-plugin-tslint): fix tslintConfig memoization key (#1719)
  • 3814d4e fix: only run publish_canary_version on master

There are 19 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

偶现情况: hookElement 出来的不是 Node,导致 appendChild 的时候出错。

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request

Current behavior

hookElement 出来的不是 Node,导致 appendChild 的时候出错。

{
  "message":"Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.",
  "name":"TypeError",
  "stack":"TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.\n"
}

Expected behavior

能确保 hookElement 出来的一定是 Node.

Minimal reproduction of the problem with instructions

偶现情况,暂未找到原因

What is the motivation / use case for changing the behavior?

不会阻塞其他脚本的加载

Environment


Assets-retry version: 0.3.3

 
For Tooling issues:
- Browser version: Edge(103.0)
- Platform:  Windows

Others:
- userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Safari/537.36 Edg/103.0.1264.37

An in-range update of rollup is breaking the build 🚨

The devDependency rollup was updated from 1.27.8 to 1.27.9.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

rollup is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v1.27.9

2019-12-07

Bug Fixes

  • Fix an issue where reexports could be missing when preserving modules (#3273)
  • Allow turning of color output via NO_COLOR or FORCE_COLOR=0 environment variables (#3272)

Pull Requests

  • #3272: Support either NO_COLOR or FORCE_COLOR=0 to turn off color (@kikonen)
  • #3273: Make sure that indirectly reexported modules also become chunk dependencies when preserving modules(@lukastaegert)
Commits

The new version differs by 6 commits.

  • 4d809d1 1.27.9
  • 3c36f7d Update changelog
  • 2b56d7d FIX support either NO_COLOR or FORCE_COLOR=0 to turn off color (#3272)
  • 27201d8 Make sure that indirectly reexported modules also become chunk dependencies when preserving modules (#3273)
  • 6e92e52 Try to fix docs formatting issues
  • f489472 Update changelog

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

CSS 背景图采用拼接多个 url 方案会导致浏览器额外多出资源请求

讨论:CSS 背景图采用拼接多个 url 方案会导致浏览器额外多出资源请求

image

[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request

Current behavior

CSS 背景图采用拼接多个 url 方案会导致浏览器额外多出资源请求,在实际大规模业务使用中这部分方案应该是有问题的

Expected behavior

目前思考思路:
1、通过 serviceworker 进行拦截请求处理
2、通过 performance 监听,判断可能为异常再 insertRule (移除当前的 setInterval)

讨论:同步加载资源的异常监听

I'm submitting a...


[ ] Regression 
[ ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request
[x ] confusion

同步资源的加载监听核心是通过如下代码实现的
document.addEventListener('error', errorHandler, true) document.addEventListener('load', loadHandler, true)
想请教的是,这里的监听回调函数是会被同步触发的么?我认知里理解的这些回调函数都是异步触发的,如果是异步触发的,js script 加载异常的场景下,怎么能保证及时拦截并重试加载呢?

@Nikaple 求大佬帮忙解惑,感激不尽。

An in-range update of @typescript-eslint/eslint-plugin is breaking the build 🚨

The devDependency @typescript-eslint/eslint-plugin was updated from 2.19.0 to 2.19.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@typescript-eslint/eslint-plugin is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v2.19.1

2.19.1 (2020-02-10)

Bug Fixes

  • eslint-plugin: [unbound-method] blacklist a few unbound natives (#1562) (4670aab)
  • typescript-estree: ts returning wrong file with project references (#1575) (4c12dac)
Commits

The new version differs by 5 commits.

  • 1c8f0df chore: publish v2.19.1
  • 4c12dac fix(typescript-estree): ts returning wrong file with project references (#1575)
  • e9cf734 docs(eslint-plugin): fix typo in readme
  • 10d86b1 docs(eslint-plugin): [no-dupe-class-members] fix typo (#1566)
  • 4670aab fix(eslint-plugin): [unbound-method] blacklist a few unbound natives (#1562)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

JS 执行报错导致误认为加载失败

src/retry-sync.ts 中没有判断 event 对象是不是由于网络错误导致的 error,那么 script 标签本身执行报错了是不是也会触发这个函数呢?

An in-range update of @typescript-eslint/eslint-plugin-tslint is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye 👋 and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The devDependency @typescript-eslint/eslint-plugin-tslint was updated from 2.24.0 to 2.25.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@typescript-eslint/eslint-plugin-tslint is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Release Notes for v2.25.0

2.25.0 (2020-03-23)

Bug Fixes

Features

  • eslint-plugin: [no-unnec-type-assertion] allow const assertions (#1741) (f76a1b3)
  • eslint-plugin: [no-unnecessary-condition] ignore basic array indexing false positives (#1534) (2b9603d)
  • eslint-plugin: add class-literal-property-style rule (#1582) (b2dbd89)
  • experimental-utils: expose ast utility functions (#1670) (3eb5d45)
Commits

The new version differs by 19 commits.

  • 9cd3e4f chore: publish v2.25.0
  • b2dbd89 feat(eslint-plugin): add class-literal-property-style rule (#1582)
  • 3eb5d45 feat(experimental-utils): expose ast utility functions (#1670)
  • 2b9603d feat(eslint-plugin): [no-unnecessary-condition] ignore basic array indexing false positives (#1534)
  • c82d121 chore(typescript-estree): remove unfinished comment (#1770)
  • 199863d fix(eslint-plugin): [quotes] false positive with backtick in import equals statement (#1769)
  • 6646959 fix(eslint-plugin): fix message of no-base-to-string (#1755)
  • f76a1b3 feat(eslint-plugin): [no-unnec-type-assertion] allow const assertions (#1741)
  • 09d8afc fix(typescript-estree): export * regression from 133f622f (#1751)
  • 52b061e chore: try fetching all tags and history in canary job
  • 19cc9a9 chore: try fetching all tags and history in canary job
  • 61a779c chore: try fetching all history in canary job
  • d6e273d chore: standardise issue templates (#1760)
  • abf1a2f fix(eslint-plugin-tslint): fix tslintConfig memoization key (#1719)
  • 3814d4e fix: only run publish_canary_version on master

There are 19 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

原生方法改写引起的问题

类似 new Function(return 'function ${key}() { [native code] }')的代码
会引起
1: csp严格模式下会有问题
2: 改写原生属性上的方法时,业务中再次调用方法会出现问题,如下图
image

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 12.12.14 to 12.12.15.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @typescript-eslint/parser is breaking the build 🚨

The devDependency @typescript-eslint/parser was updated from 2.19.0 to 2.19.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@typescript-eslint/parser is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v2.19.1

2.19.1 (2020-02-10)

Bug Fixes

  • eslint-plugin: [unbound-method] blacklist a few unbound natives (#1562) (4670aab)
  • typescript-estree: ts returning wrong file with project references (#1575) (4c12dac)
Commits

The new version differs by 5 commits.

  • 1c8f0df chore: publish v2.19.1
  • 4c12dac fix(typescript-estree): ts returning wrong file with project references (#1575)
  • e9cf734 docs(eslint-plugin): fix typo in readme
  • 10d86b1 docs(eslint-plugin): [no-dupe-class-members] fix typo (#1566)
  • 4670aab fix(eslint-plugin): [unbound-method] blacklist a few unbound natives (#1562)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

retry backgroundImage in tag style

我的应用代码是这样的

window.assetsRetryStatistics = window.assetsRetry({
    domain: ['cdn.a.com', 'cdn.b.com'],
    maxRetryCount: 1
})

css中的background-image会自动添加备用域名cdn.b.com域名的url

.normal-module_contentLessonsPracticeNothing_2H-mB::before {
    background-image: url(http://cdn.a.com/img/no-task.7e4726d6.png), 
        url(http://cdn.b.com/img/no-task.7e4726d6.png) !important;
}

这样浏览器会向这两个资源都发起请求,请问这样是否符合css背景图片重试的预期。
谢谢!

An in-range update of eslint-plugin-import is breaking the build 🚨

The devDependency eslint-plugin-import was updated from 2.18.2 to 2.19.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

eslint-plugin-import is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 46 commits.

  • 9b76635 Bump to v2.19.0
  • 47a232e [resolvers/webpack] v0.12.0
  • 26ad476 [resolvers/webpack] [deps] update debug, enhanced-resolve, has, interpret, lodash, resolve, semver
  • 3f0e8f3 [resolvers/node] [Deps] update resolve
  • 7190c3e bump utils to v2.5.0
  • a60e5c6 [New] no-commonjs: add allowConditionalRequire option
  • 414c923 [New] enable passing cwd as an option to eslint-import-resolver-webpack
  • 8224e51 [New] order/no-extraneous-dependencies: Alphabetize imports within groups
  • f12ae59 [New] no-duplicates: add a considerQueryString option to handle false positives when using some webpack loaders.
  • 2d3d045 [fix] importType: Accept '@example' as internal
  • 0426f16 [New] order: add pathGroups option to add support to order by paths
  • 99b3fbf [Fix] no-extraneous-dependencies: Add support for export from
  • 21bf8c6 [Fix] no-cycle: should not warn for Flow imports
  • 0cd5e43 [Fix] no-unused-modules: fix crash due to export *
  • 05085bb [flow] no-unused-modules: add flow type support

There are 46 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of typedoc is breaking the build 🚨

The devDependency typedoc was updated from 0.16.10 to 0.16.11.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

typedoc is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Release Notes for v0.16.11

Bug Fixes 🐛

Features ✨

  • Add support for `` inside of Marked Link Brackets (#1091) (1ec2fb8)
  • Config option to exclude not explicitly documented symbols (#996) (20db9a5), closes #995
  • Support for extended config in typedoc.json (07fb1ce), closes #493 #1115

Thanks 👏

v0.16.10...v0.16.11

Commits

The new version differs by 8 commits.

  • c19b1d9 chore: Bump version to 0.16.11
  • 148bd12 fix: Support code blocks with four spaces
  • 1ec2fb8 feat: Add support for `` inside of Marked Link Brackets (#1091)
  • 07fb1ce feat: Support for extended config in typedoc.json
  • 20db9a5 feat: Config option to exclude not explicitly documented symbols (#996)
  • 541fbcf fix: Ensure child comment tags get set (#1221)
  • 796349a fix: Re-export TypeScript namespace (#1217)
  • c4ce9a5 fix: Logger extensions now also count the warnings (#1210)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 13.7.0 to 13.7.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

retryTimes问题

在vue单页项目或者单个页面有多个相同资源请求的情况下,retryTimes超过maxRetryCount时被视为fail,导致资源不会重试。

<img src="http://cdn.a.com/img/1.png">
<img src="http://cdn.a.com/img/1.png">
<img src="http://cdn.a.com/img/1.png">

在单页应用中,在路由来回切换过程中 currentCollector['/img/1.png']的retryTimes属性会累加,导致超过maxRetryCount,然后之后的/img/1.png不会被重试

动态加载问题

image
一、这里没太看明白,我在项目中模拟动态加载

一样是可以被 document.addEventListener('error', errorHandler, true) 捕获的到啊,不用动态的也可以重试

  // 模拟动态加载js报错
    function test() {
        var chunk
        new Promise(function (resolve, reject) {
            chunk = [resolve, reject];
        });

        const scriptVal = document.createElement('script');
        scriptVal.src = 'https://www.test.com/ajax/libs/jquery/3.5.1/jquery.js';

        scriptVal.onerror = chunk[1](new Error('加载报错'))

        document.body.appendChild(scriptVal);

    }
    document.getElementById('test').addEventListener('click', test);

An in-range update of rimraf is breaking the build 🚨

The devDependency rimraf was updated from 3.0.1 to 3.0.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

rimraf is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 2 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

动态加载没有重试问题

image

//省略其他代码
<style scoped>
@import "https://www.test.com/ajax/libs/bootstrap-vue/2.16.0/bootstrap-vue.css";

button {
    border: 1px solid #ccc;
    border-radius: 5px;
}
</style>

retry-css

超级赞👍的代码,这两天正好在做这块
我在document.stylesheets时
uncaught DOMException: Failed to read the 'rules' property from 'CSSStyleSheet': Cannot access rules
at HTMLDocument.

是您在文档常见问题里说的那个问题么。
在实际应用时是不是会经常出现读不到CSSStyleSheet的情况,就不能正常retrycss,处理背景图这样的问题。

An in-range update of selenium-webdriver is breaking the build 🚨

The devDependency selenium-webdriver was updated from 4.0.0-alpha.5 to 4.0.0-alpha.6.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

selenium-webdriver is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @rollup/plugin-json is breaking the build 🚨

The devDependency @rollup/plugin-json was updated from 4.0.1 to 4.0.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@rollup/plugin-json is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

使用 js 动态添加/移除 style 标签,style 元素无法被 GC

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request

Current behavior

使用 js 动态添加/移除 style 标签
style 标签会变成 Detached Element 无法被 GC 造成内存泄漏

image
使用 Edge 的 Detached Elements 分析,调用 removeChild 将 style 移除后,style 标签变成 Detached Element
image

Expected behavior

style 标签被 remove 后可以被正确 GC

Minimal reproduction of the problem with instructions

执行以下代码


    let styleElement: any = document.createElement('style')
    document.body.appendChild(styleElement)
    setTimeout(() => {
      document.body.removeChild(styleElement)
      styleElement = undefined
    }, 1000)

可以使用 Edge 浏览器的 Detached Elements 确认
image

What is the motivation / use case for changing the behavior?

Environment


Assets-retry version: 0.3.3

 
For Tooling issues:
- Browser version: Microsoft Edge 107.0.1418.24  
- Platform:  Mac

Others:

查看源码发现 retry-css.ts 中, handledStylesheets 缓存了 style 标签的引用,当 style 标签移除时,没有清理这里的缓存,这里还保留引用导致无法被 GC

html内存在多个带defer的<script>,而且必须按顺序执行,若只挂了第一个script,retry插入的<script>执行顺序不正确

I'm submitting a...


[ ] Regression 
[ ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request

Current behavior

html内存在多个带defer的<script>,而且必须按顺序执行,若只挂了第一个script,retry插入的<script>执行顺序不正确。我清楚问题原因,但是没有好的方案。有什么好的解决办法吗?

Expected behavior

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Environment


Assets-retry version: X.Y.Z

 
For Tooling issues:
- Browser version: XX 
- Platform:  

Others:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.