{"action":"created","issue":{"url":"https://api.github.com/repos/GoogleChrome/sw-precache/issues/195","repository_url":"https://api.github.com/repos/GoogleChrome/sw-precache","labels_url":"https://api.github.com/repos/GoogleChrome/sw-precache/issues/195/labels{/name}","comments_url":"https://api.github.com/repos/GoogleChrome/sw-precache/issues/195/comments","events_url":"https://api.github.com/repos/GoogleChrome/sw-precache/issues/195/events","html_url":"https://github.com/GoogleChrome/sw-precache/issues/195","id":182092168,"number":195,"title":"runtimeCaching: urlPattern in json config not properly converted to regex","user":{"login":"markbrocato","id":10118693,"avatar_url":"https://avatars.githubusercontent.com/u/10118693?v=3","gravatar_id":"","url":"https://api.github.com/users/markbrocato","html_url":"https://github.com/markbrocato","followers_url":"https://api.github.com/users/markbrocato/followers","following_url":"https://api.github.com/users/markbrocato/following{/other_user}","gists_url":"https://api.github.com/users/markbrocato/gists{/gist_id}","starred_url":"https://api.github.com/users/markbrocato/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markbrocato/subscriptions","organizations_url":"https://api.github.com/users/markbrocato/orgs","repos_url":"https://api.github.com/users/markbrocato/repos","events_url":"https://api.github.com/users/markbrocato/events{/privacy}","received_events_url":"https://api.github.com/users/markbrocato/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-10T19:11:44Z","updated_at":"2016-10-18T17:38:42Z","closed_at":null,"body":"My json config has the following:\r\n\r\n```\r\n  \"runtimeCaching\": [{\r\n    \"urlPattern\": \"/users\\\\.json/\",\r\n    \"handler\": \"networkFirst\",\r\n    \"options\": {\r\n      \"cache\": {\r\n        \"name\": \"api\"\r\n      }\r\n    }\r\n  }]\r\n```\r\n\r\nwhich produces:\r\n\r\n`toolbox.router.get(\"/users\\\\.json/\", toolbox.networkFirst, {\"cache\":{\"name\":\"api\"}});`\r\n\r\nIt should produce the following, right?\r\n\r\n`toolbox.router.get(/users\\.json/, toolbox.networkFirst, {\"cache\":{\"name\":\"api\"}});`\r\n "},"comment":{"url":"https://api.github.com/repos/GoogleChrome/sw-precache/issues/comments/254582590","html_url":"https://github.com/GoogleChrome/sw-precache/issues/195#issuecomment-254582590","issue_url":"https://api.github.com/repos/GoogleChrome/sw-precache/issues/195","id":254582590,"user":{"login":"jeffposnick","id":1749548,"avatar_url":"https://avatars.githubusercontent.com/u/1749548?v=3","gravatar_id":"","url":"https://api.github.com/users/jeffposnick","html_url":"https://github.com/jeffposnick","followers_url":"https://api.github.com/users/jeffposnick/followers","following_url":"https://api.github.com/users/jeffposnick/following{/other_user}","gists_url":"https://api.github.com/users/jeffposnick/gists{/gist_id}","starred_url":"https://api.github.com/users/jeffposnick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeffposnick/subscriptions","organizations_url":"https://api.github.com/users/jeffposnick/orgs","repos_url":"https://api.github.com/users/jeffposnick/repos","events_url":"https://api.github.com/users/jeffposnick/events{/privacy}","received_events_url":"https://api.github.com/users/jeffposnick/received_events","type":"User","site_admin":false},"created_at":"2016-10-18T17:38:42Z","updated_at":"2016-10-18T17:38:42Z","body":"Thanks for bringing this up. I was toying with the idea of looking at any strings that begin and end with `/` and implicitly converting them to `RegExp` objects, but the idea of just promoting JavaScript configuration via `module.exports` is really a better approach, and should be backwards compatible with people who pass in JSON.\r\n\r\nAs @mactookmyname mentions, there's no code change needed to the `sw-precache` command line interface to support this, but I'm going to update the documentation and sample external configuration file to make it clear that the `module.exports` approach is preferred to JSON."}}
{"actor":{"display_login":"jeffposnick"}}